diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4d17b70028810..a0b1464bae23e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -48,11 +48,11 @@ variables:
CARGO_INCREMENTAL: 0
DOCKER_OS: "debian:stretch"
ARCH: "x86_64"
- # staging image with rust 1.65 and nightly-2022-11-16
- CI_IMAGE: "paritytech/ci-linux@sha256:786869e731963b3cc0a4aa9deb83367ed9e87a6ae48b6eb029d62b0cab4d87c1"
+ CI_IMAGE: "paritytech/ci-linux:production"
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27"
RUSTY_CACHIER_SINGLE_BRANCH: master
RUSTY_CACHIER_DONT_OPERATE_ON_MAIN_BRANCH: "true"
+ RUSTY_CACHIER_COMPRESSION_METHOD: zstd
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.22"
default:
diff --git a/Cargo.lock b/Cargo.lock
index c8d1d8d83f0d7..d333b79c8c403 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -187,9 +187,9 @@ checksum = "29d47fbf90d5149a107494b15a7dc8d69b351be2db3bb9691740e88ec17fd880"
[[package]]
name = "arc-swap"
-version = "1.5.1"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164"
+checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
[[package]]
name = "array-bytes"
@@ -1022,9 +1022,9 @@ dependencies = [
[[package]]
name = "comfy-table"
-version = "6.1.3"
+version = "6.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e621e7e86c46fd8a14c32c6ae3cb95656621b4743a27d0cffedb831d46e7ad21"
+checksum = "6e7b787b0dc42e8111badfdbe4c3059158ccb2db8780352fa1b01e8ccf45cc4d"
dependencies = [
"strum",
"strum_macros",
@@ -3217,7 +3217,7 @@ checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
dependencies = [
"hermit-abi 0.2.6",
"io-lifetimes 1.0.3",
- "rustix 0.36.5",
+ "rustix 0.36.6",
"windows-sys 0.42.0",
]
@@ -3458,6 +3458,7 @@ dependencies = [
"pallet-message-queue",
"pallet-mmr",
"pallet-multisig",
+ "pallet-nfts",
"pallet-nis",
"pallet-nomination-pools",
"pallet-nomination-pools-benchmarking",
@@ -3706,9 +3707,9 @@ dependencies = [
[[package]]
name = "libp2p-kad"
-version = "0.42.0"
+version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40ee545eedf4f88502b2a4a2323405c3225d212d643212b0615856ca227fb9c3"
+checksum = "2766dcd2be8c87d5e1f35487deb22d765f49c6ae1251b3633efe3b25698bd3d2"
dependencies = [
"arrayvec 0.7.2",
"asynchronous-codec",
@@ -4272,7 +4273,7 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb"
dependencies = [
- "rustix 0.36.5",
+ "rustix 0.36.6",
]
[[package]]
@@ -4981,9 +4982,9 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]]
name = "nom"
-version = "7.1.1"
+version = "7.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
+checksum = "e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c"
dependencies = [
"memchr",
"minimal-lexical",
@@ -5118,9 +5119,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.16.0"
+version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
+checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
[[package]]
name = "oorandom"
@@ -5897,6 +5898,24 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-nfts"
+version = "4.0.0-dev"
+dependencies = [
+ "enumflags2",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "log",
+ "pallet-balances",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-nicks"
version = "4.0.0-dev"
@@ -6788,9 +6807,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pest"
-version = "2.5.1"
+version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0"
+checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4"
dependencies = [
"thiserror",
"ucd-trie",
@@ -6798,9 +6817,9 @@ dependencies = [
[[package]]
name = "pest_derive"
-version = "2.5.1"
+version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cdc078600d06ff90d4ed238f0119d84ab5d43dbaad278b0e33a8820293b32344"
+checksum = "96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603"
dependencies = [
"pest",
"pest_generator",
@@ -6808,9 +6827,9 @@ dependencies = [
[[package]]
name = "pest_generator"
-version = "2.5.1"
+version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28a1af60b1c4148bb269006a750cff8e2ea36aff34d2d96cf7be0b14d1bed23c"
+checksum = "798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7"
dependencies = [
"pest",
"pest_meta",
@@ -6821,9 +6840,9 @@ dependencies = [
[[package]]
name = "pest_meta"
-version = "2.5.1"
+version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fec8605d59fc2ae0c6c1aefc0c7c7a9769732017c0ce07f7a9cfffa7b4404f20"
+checksum = "984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065"
dependencies = [
"once_cell",
"pest",
@@ -6990,9 +7009,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "predicates"
-version = "2.1.4"
+version = "2.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f54fc5dc63ed3bbf19494623db4f3af16842c0d975818e469022d09e53f0aa05"
+checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd"
dependencies = [
"difflib",
"float-cmp",
@@ -7668,9 +7687,9 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.36.5"
+version = "0.36.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588"
+checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549"
dependencies = [
"bitflags",
"errno",
@@ -7916,6 +7935,7 @@ dependencies = [
"sp-keystore",
"sp-panic-handler",
"sp-runtime",
+ "sp-tracing",
"sp-version",
"tempfile",
"thiserror",
@@ -8416,6 +8436,7 @@ dependencies = [
"assert_matches",
"async-trait",
"asynchronous-codec",
+ "backtrace",
"bytes",
"either",
"fnv",
@@ -8627,6 +8648,7 @@ dependencies = [
"pin-project",
"sc-network-common",
"sc-peerset",
+ "sc-utils",
"sp-consensus",
"sp-runtime",
"substrate-prometheus-endpoint",
@@ -8963,6 +8985,7 @@ dependencies = [
"parking_lot 0.12.1",
"pin-project",
"rand 0.8.5",
+ "sc-utils",
"serde",
"serde_json",
"thiserror",
@@ -9061,6 +9084,7 @@ dependencies = [
name = "sc-utils"
version = "4.0.0-dev"
dependencies = [
+ "backtrace",
"futures",
"futures-timer",
"lazy_static",
@@ -9267,9 +9291,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
-version = "1.0.151"
+version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0"
+checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [
"serde_derive",
]
@@ -9286,9 +9310,9 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.151"
+version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8"
+checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [
"proc-macro2",
"quote",
@@ -11344,6 +11368,7 @@ dependencies = [
"sc-executor",
"sc-service",
"serde",
+ "serde_json",
"sp-api",
"sp-core",
"sp-debug-derive",
diff --git a/Cargo.toml b/Cargo.toml
index eb78d5e104486..8f55d8e527ecd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -122,6 +122,7 @@ members = [
"frame/preimage",
"frame/proxy",
"frame/message-queue",
+ "frame/nfts",
"frame/nomination-pools",
"frame/nomination-pools/fuzzer",
"frame/nomination-pools/benchmarking",
diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs
index 358c09779d59a..c8f9e2b3d3c82 100644
--- a/bin/node/cli/tests/common.rs
+++ b/bin/node/cli/tests/common.rs
@@ -161,6 +161,7 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) {
let line =
line.expect("failed to obtain next line from stdout for WS address discovery");
data.push_str(&line);
+ data.push_str("\n");
// does the line contain our port (we expect this specific output from substrate).
let sock_addr = match line.split_once("Running JSON-RPC WS server: addr=") {
@@ -170,7 +171,10 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) {
Some(format!("ws://{}", sock_addr))
})
- .expect("We should get a WebSocket address");
+ .unwrap_or_else(|| {
+ eprintln!("Observed node output:\n{}", data);
+ panic!("We should get a WebSocket address")
+ });
(ws_url, data)
}
diff --git a/bin/node/cli/tests/remember_state_pruning_works.rs b/bin/node/cli/tests/remember_state_pruning_works.rs
new file mode 100644
index 0000000000000..5b8e34cc7a00d
--- /dev/null
+++ b/bin/node/cli/tests/remember_state_pruning_works.rs
@@ -0,0 +1,38 @@
+// This file is part of Substrate.
+
+// Copyright (C) 2022 Parity Technologies (UK) Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+use tempfile::tempdir;
+
+pub mod common;
+
+#[tokio::test]
+#[cfg(unix)]
+async fn remember_state_pruning_works() {
+ let base_path = tempdir().expect("could not create a temp dir");
+
+ // First run with `--state-pruning=archive`.
+ common::run_node_for_a_while(
+ base_path.path(),
+ &["--dev", "--state-pruning=archive", "--no-hardware-benchmarks"],
+ )
+ .await;
+
+ // Then run again without specifying the state pruning.
+ // This should load state pruning settings from the db.
+ common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
+}
diff --git a/bin/node/executor/tests/basic.rs b/bin/node/executor/tests/basic.rs
index c88703b929e6b..02b2a8787b5d5 100644
--- a/bin/node/executor/tests/basic.rs
+++ b/bin/node/executor/tests/basic.rs
@@ -30,7 +30,7 @@ use sp_runtime::{
use kitchensink_runtime::{
constants::{currency::*, time::SLOT_DURATION},
Balances, CheckedExtrinsic, Header, Runtime, RuntimeCall, RuntimeEvent, System,
- TransactionPayment, UncheckedExtrinsic,
+ TransactionPayment, Treasury, UncheckedExtrinsic,
};
use node_primitives::{Balance, Hash};
use node_testing::keyring::*;
@@ -398,6 +398,7 @@ fn full_native_block_import_works() {
});
fees = t.execute_with(|| transfer_fee(&xt()));
+ let pot = t.execute_with(|| Treasury::pot());
executor_call(&mut t, "Core_execute_block", &block2.0, true).0.unwrap();
@@ -408,6 +409,14 @@ fn full_native_block_import_works() {
);
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - fees);
let events = vec![
+ EventRecord {
+ phase: Phase::Initialization,
+ event: RuntimeEvent::Treasury(pallet_treasury::Event::UpdatedInactive {
+ reactivated: 0,
+ deactivated: pot,
+ }),
+ topics: vec![],
+ },
EventRecord {
phase: Phase::ApplyExtrinsic(0),
event: RuntimeEvent::System(frame_system::Event::ExtrinsicSuccess {
diff --git a/bin/node/runtime/Cargo.toml b/bin/node/runtime/Cargo.toml
index 477545c9ac332..201e3a85f8941 100644
--- a/bin/node/runtime/Cargo.toml
+++ b/bin/node/runtime/Cargo.toml
@@ -78,6 +78,7 @@ pallet-membership = { version = "4.0.0-dev", default-features = false, path = ".
pallet-message-queue = { version = "7.0.0-dev", default-features = false, path = "../../../frame/message-queue" }
pallet-mmr = { version = "4.0.0-dev", default-features = false, path = "../../../frame/merkle-mountain-range" }
pallet-multisig = { version = "4.0.0-dev", default-features = false, path = "../../../frame/multisig" }
+pallet-nfts = { version = "4.0.0-dev", default-features = false, path = "../../../frame/nfts" }
pallet-nomination-pools = { version = "1.0.0", default-features = false, path = "../../../frame/nomination-pools"}
pallet-nomination-pools-benchmarking = { version = "1.0.0", default-features = false, optional = true, path = "../../../frame/nomination-pools/benchmarking" }
pallet-nomination-pools-runtime-api = { version = "1.0.0-dev", default-features = false, path = "../../../frame/nomination-pools/runtime-api" }
@@ -197,6 +198,7 @@ std = [
"pallet-root-testing/std",
"pallet-recovery/std",
"pallet-uniques/std",
+ "pallet-nfts/std",
"pallet-vesting/std",
"log/std",
"frame-try-runtime?/std",
@@ -253,6 +255,7 @@ runtime-benchmarks = [
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-uniques/runtime-benchmarks",
+ "pallet-nfts/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-whitelist/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
@@ -312,6 +315,7 @@ try-runtime = [
"pallet-asset-tx-payment/try-runtime",
"pallet-transaction-storage/try-runtime",
"pallet-uniques/try-runtime",
+ "pallet-nfts/try-runtime",
"pallet-vesting/try-runtime",
"pallet-whitelist/try-runtime",
]
diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs
index e5776e3fd692c..0c946fa180f20 100644
--- a/bin/node/runtime/src/lib.rs
+++ b/bin/node/runtime/src/lib.rs
@@ -56,6 +56,7 @@ use pallet_grandpa::{
fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
+use pallet_nfts::PalletFeatures;
use pallet_nis::WithMaximumOf;
use pallet_session::historical::{self as pallet_session_historical};
pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier, TargetedFeeAdjustment};
@@ -301,6 +302,7 @@ impl InstanceFilter for ProxyType {
RuntimeCall::Balances(..) |
RuntimeCall::Assets(..) |
RuntimeCall::Uniques(..) |
+ RuntimeCall::Nfts(..) |
RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) |
RuntimeCall::Indices(pallet_indices::Call::transfer { .. })
),
@@ -565,7 +567,7 @@ impl pallet_staking::Config for Runtime {
type BondingDuration = BondingDuration;
type SlashDeferDuration = SlashDeferDuration;
/// A super-majority of the council can cancel the slash.
- type SlashCancelOrigin = EitherOfDiverse<
+ type AdminOrigin = EitherOfDiverse<
EnsureRoot,
pallet_collective::EnsureProportionAtLeast,
>;
@@ -1528,6 +1530,10 @@ parameter_types! {
pub const ItemDeposit: Balance = 1 * DOLLARS;
pub const KeyLimit: u32 = 32;
pub const ValueLimit: u32 = 256;
+ pub const ApprovalsLimit: u32 = 20;
+ pub const ItemAttributesApprovalsLimit: u32 = 20;
+ pub const MaxTips: u32 = 10;
+ pub const MaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS;
}
impl pallet_uniques::Config for Runtime {
@@ -1551,6 +1557,36 @@ impl pallet_uniques::Config for Runtime {
type Locker = ();
}
+parameter_types! {
+ pub Features: PalletFeatures = PalletFeatures::all_enabled();
+}
+
+impl pallet_nfts::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type CollectionId = u32;
+ type ItemId = u32;
+ type Currency = Balances;
+ type ForceOrigin = frame_system::EnsureRoot;
+ type CollectionDeposit = CollectionDeposit;
+ type ItemDeposit = ItemDeposit;
+ type MetadataDepositBase = MetadataDepositBase;
+ type AttributeDepositBase = MetadataDepositBase;
+ type DepositPerByte = MetadataDepositPerByte;
+ type StringLimit = StringLimit;
+ type KeyLimit = KeyLimit;
+ type ValueLimit = ValueLimit;
+ type ApprovalsLimit = ApprovalsLimit;
+ type ItemAttributesApprovalsLimit = ItemAttributesApprovalsLimit;
+ type MaxTips = MaxTips;
+ type MaxDeadlineDuration = MaxDeadlineDuration;
+ type Features = Features;
+ type WeightInfo = pallet_nfts::weights::SubstrateWeight;
+ #[cfg(feature = "runtime-benchmarks")]
+ type Helper = ();
+ type CreateOrigin = AsEnsureOriginWithArg>;
+ type Locker = ();
+}
+
impl pallet_transaction_storage::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
@@ -1705,6 +1741,7 @@ construct_runtime!(
Lottery: pallet_lottery,
Nis: pallet_nis,
Uniques: pallet_uniques,
+ Nfts: pallet_nfts,
TransactionStorage: pallet_transaction_storage,
VoterList: pallet_bags_list::,
StateTrieMigration: pallet_state_trie_migration,
@@ -1836,6 +1873,7 @@ mod benches {
[pallet_transaction_storage, TransactionStorage]
[pallet_treasury, Treasury]
[pallet_uniques, Uniques]
+ [pallet_nfts, Nfts]
[pallet_utility, Utility]
[pallet_vesting, Vesting]
[pallet_whitelist, Whitelist]
diff --git a/client/api/src/client.rs b/client/api/src/client.rs
index 05e3163dcc7bd..0d00257fa7b06 100644
--- a/client/api/src/client.rs
+++ b/client/api/src/client.rs
@@ -21,7 +21,7 @@
use sp_consensus::BlockOrigin;
use sp_core::storage::StorageKey;
use sp_runtime::{
- generic::{BlockId, SignedBlock},
+ generic::SignedBlock,
traits::{Block as BlockT, NumberFor},
Justifications,
};
@@ -120,14 +120,13 @@ pub trait BlockBackend {
/// that are indexed by the runtime with `storage_index_transaction`.
fn block_indexed_body(&self, hash: Block::Hash) -> sp_blockchain::Result