From d2a7100e3b9832e5288d6d035be6d32bf8961f84 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Sun, 17 Mar 2024 15:21:29 +0200 Subject: [PATCH 1/9] Crowdload burn remaining funds (#3707) Crowdloan account should burn all funds after a crowd loan got dissolved to ensure that the account is reaped correctly. --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: Francisco Aguirre --- polkadot/runtime/common/src/crowdloan/mod.rs | 49 ++++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/polkadot/runtime/common/src/crowdloan/mod.rs b/polkadot/runtime/common/src/crowdloan/mod.rs index 6543bf305c41..d405278411b7 100644 --- a/polkadot/runtime/common/src/crowdloan/mod.rs +++ b/polkadot/runtime/common/src/crowdloan/mod.rs @@ -60,7 +60,7 @@ use frame_support::{ pallet_prelude::{DispatchResult, Weight}, storage::{child, ChildTriePrefixIterator}, traits::{ - Currency, + Currency, Defensive, ExistenceRequirement::{self, AllowDeath, KeepAlive}, Get, ReservableCurrency, }, @@ -563,6 +563,7 @@ pub mod pallet { let who = ensure_signed(origin)?; let fund = Self::funds(index).ok_or(Error::::InvalidParaId)?; + let pot = Self::fund_account_id(fund.fund_index); let now = frame_system::Pallet::::block_number(); // Only allow dissolution when the raised funds goes to zero, @@ -576,7 +577,10 @@ pub mod pallet { // can take care of that. debug_assert!(Self::contribution_iterator(fund.fund_index).count().is_zero()); - frame_system::Pallet::::dec_providers(&Self::fund_account_id(fund.fund_index))?; + // Crowdloan over, burn all funds. + let _imba = CurrencyOf::::make_free_balance_be(&pot, Zero::zero()); + let _ = frame_system::Pallet::::dec_providers(&pot).defensive(); + CurrencyOf::::unreserve(&fund.depositor, fund.deposit); Funds::::remove(index); Self::deposit_event(Event::::Dissolved { para_id: index }); @@ -1609,6 +1613,7 @@ mod tests { new_test_ext().execute_with(|| { let para = new_para(); let index = NextFundIndex::::get(); + let issuance = Balances::total_issuance(); // Set up a crowdloan assert_ok!(Crowdloan::create(RuntimeOrigin::signed(1), para, 1000, 1, 1, 9, None)); @@ -1629,9 +1634,10 @@ mod tests { // Some funds are left over assert_eq!(Balances::free_balance(&account_id), 10); - // They wil be left in the account at the end + // Remaining funds will be burned assert_ok!(Crowdloan::dissolve(RuntimeOrigin::signed(1), para)); - assert_eq!(Balances::free_balance(&account_id), 10); + assert_eq!(Balances::free_balance(&account_id), 0); + assert_eq!(Balances::total_issuance(), issuance - 10); }); } @@ -1740,6 +1746,41 @@ mod tests { }); } + // Regression test to check that a pot account with just one provider can be dissolved. + #[test] + fn dissolve_provider_refs_total_issuance_works() { + new_test_ext().execute_with(|| { + let para = new_para(); + let issuance = Balances::total_issuance(); + + // Set up a crowdloan + assert_ok!(Crowdloan::create(RuntimeOrigin::signed(1), para, 1000, 1, 1, 9, None)); + assert_ok!(Crowdloan::contribute(RuntimeOrigin::signed(2), para, 100, None)); + assert_ok!(Crowdloan::contribute(RuntimeOrigin::signed(3), para, 50, None)); + + run_to_block(10); + + // We test the historic case where crowdloan accounts only have one provider: + { + let fund = Crowdloan::funds(para).unwrap(); + let pot = Crowdloan::fund_account_id(fund.fund_index); + System::dec_providers(&pot).unwrap(); + assert_eq!(System::providers(&pot), 1); + } + + // All funds are refunded + assert_ok!(Crowdloan::refund(RuntimeOrigin::signed(2), para)); + + // Now that `fund.raised` is zero, it can be dissolved. + assert_ok!(Crowdloan::dissolve(RuntimeOrigin::signed(1), para)); + + assert_eq!(Balances::free_balance(1), 1000); + assert_eq!(Balances::free_balance(2), 2000); + assert_eq!(Balances::free_balance(3), 3000); + assert_eq!(Balances::total_issuance(), issuance); + }); + } + #[test] fn dissolve_works() { new_test_ext().execute_with(|| { From 1f9505c0d358c20a7f95839ff1f8aa65ad843a0a Mon Sep 17 00:00:00 2001 From: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:02:11 +0100 Subject: [PATCH 2/9] Eliminate `experimental` feature (#3654) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Totally removes the `experimental` feature. Closes #3648. --------- Co-authored-by: Bastian Köcher --- cumulus/pallets/collator-selection/Cargo.toml | 2 -- .../pallets/collator-selection/src/mock.rs | 1 - .../assets/asset-hub-rococo/Cargo.toml | 2 -- .../assets/asset-hub-rococo/src/lib.rs | 4 ---- .../assets/asset-hub-westend/Cargo.toml | 2 -- .../assets/asset-hub-westend/src/lib.rs | 4 ---- .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 1 - .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 4 ---- .../bridge-hubs/bridge-hub-westend/Cargo.toml | 2 -- .../bridge-hubs/bridge-hub-westend/src/lib.rs | 4 ---- .../collectives-westend/Cargo.toml | 2 -- .../collectives-westend/src/lib.rs | 4 ---- .../contracts/contracts-rococo/Cargo.toml | 2 -- .../contracts/contracts-rococo/src/lib.rs | 4 ---- .../coretime/coretime-rococo/Cargo.toml | 2 -- .../coretime/coretime-rococo/src/lib.rs | 4 ---- .../coretime/coretime-westend/Cargo.toml | 2 -- .../coretime/coretime-westend/src/lib.rs | 4 ---- .../glutton/glutton-westend/Cargo.toml | 2 -- .../glutton/glutton-westend/src/lib.rs | 4 ---- .../runtimes/people/people-rococo/Cargo.toml | 2 -- .../runtimes/people/people-rococo/src/lib.rs | 4 ---- .../runtimes/people/people-westend/Cargo.toml | 2 -- .../runtimes/people/people-westend/src/lib.rs | 4 ---- .../runtimes/starters/seedling/Cargo.toml | 2 -- .../runtimes/starters/seedling/src/lib.rs | 4 ---- .../runtimes/starters/shell/Cargo.toml | 2 -- .../runtimes/starters/shell/src/lib.rs | 4 ---- .../runtimes/testing/penpal/Cargo.toml | 2 -- .../runtimes/testing/penpal/src/lib.rs | 1 - .../testing/rococo-parachain/Cargo.toml | 2 -- .../testing/rococo-parachain/src/lib.rs | 4 ---- docs/sdk/Cargo.toml | 3 --- docs/sdk/src/polkadot_sdk/cumulus.rs | 1 - prdoc/pr_3654.prdoc | 14 ++++++++++++++ substrate/frame/aura/src/lib.rs | 19 +------------------ substrate/frame/aura/src/mock.rs | 2 -- templates/parachain/runtime/Cargo.toml | 2 -- templates/parachain/runtime/src/lib.rs | 1 - templates/solochain/runtime/Cargo.toml | 2 -- templates/solochain/runtime/src/lib.rs | 2 -- 41 files changed, 15 insertions(+), 120 deletions(-) create mode 100644 prdoc/pr_3654.prdoc diff --git a/cumulus/pallets/collator-selection/Cargo.toml b/cumulus/pallets/collator-selection/Cargo.toml index 20f048b97d55..241a78466d61 100644 --- a/cumulus/pallets/collator-selection/Cargo.toml +++ b/cumulus/pallets/collator-selection/Cargo.toml @@ -77,5 +77,3 @@ try-runtime = [ "pallet-timestamp/try-runtime", "sp-runtime/try-runtime", ] - -experimental = ["pallet-aura/experimental"] diff --git a/cumulus/pallets/collator-selection/src/mock.rs b/cumulus/pallets/collator-selection/src/mock.rs index 061d8b1cb311..4a440dfe1e92 100644 --- a/cumulus/pallets/collator-selection/src/mock.rs +++ b/cumulus/pallets/collator-selection/src/mock.rs @@ -125,7 +125,6 @@ impl pallet_aura::Config for Test { type MaxAuthorities = ConstU32<100_000>; type DisabledValidators = (); type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml index 05936e939932..95691a045b72 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml @@ -251,8 +251,6 @@ std = [ "xcm/std", ] -experimental = ["pallet-aura/experimental"] - # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 7da9869dd2c7..e6b5e55bcd3a 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -187,10 +187,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -723,7 +720,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml index 78c48507a7a4..950c6e62d72f 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml @@ -236,8 +236,6 @@ std = [ "xcm/std", ] -experimental = ["pallet-aura/experimental"] - # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 3d69e104bd59..1ba108234c8e 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -171,10 +171,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -703,7 +700,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 7a1951fd24bd..8a6823ea3ee8 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -296,7 +296,6 @@ try-runtime = [ "sp-runtime/try-runtime", ] -experimental = ["pallet-aura/experimental"] fast-runtime = [] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 843acffe03e7..31069778e386 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -277,10 +277,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -445,7 +442,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml index 8623f7cb366e..4eb201eedc11 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml @@ -246,8 +246,6 @@ try-runtime = [ "sp-runtime/try-runtime", ] -experimental = ["pallet-aura/experimental"] - # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index d70d880c50c4..d96c762fe19d 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -251,10 +251,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -407,7 +404,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml index ed264f28c26e..4224b3971398 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml @@ -232,8 +232,6 @@ std = [ "xcm/std", ] -experimental = ["pallet-aura/experimental"] - # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index 15a2391fa5b3..5bf3519ac3d2 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs @@ -184,10 +184,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -483,7 +480,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index dcc6c4e853a3..e4ac2016a726 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml @@ -196,8 +196,6 @@ try-runtime = [ "sp-runtime/try-runtime", ] -experimental = ["pallet-aura/experimental"] - # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 928c3ecc5324..f148ceadccba 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -193,10 +193,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = pallet_timestamp::weights::SubstrateWeight; } @@ -349,7 +346,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml index 0bc3b510ed50..eb92afc43114 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml @@ -194,6 +194,4 @@ try-runtime = [ "sp-runtime/try-runtime", ] -experimental = ["pallet-aura/experimental"] - fast-runtime = [] diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index 41b9ffa0af84..6efbdde58997 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -206,10 +206,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -369,7 +366,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml index a7d52dfd7849..b8efecffc507 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml @@ -190,6 +190,4 @@ try-runtime = [ "sp-runtime/try-runtime", ] -experimental = ["pallet-aura/experimental"] - fast-runtime = [] diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index d93c2a61ff45..2bb179b5b056 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -206,10 +206,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -369,7 +366,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml index 23c5ce1c7f80..a357bf519e40 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml @@ -135,8 +135,6 @@ try-runtime = [ "sp-runtime/try-runtime", ] -experimental = ["pallet-aura/experimental"] - # A feature that should be enabled when the runtime should be built for on-chain # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs index 6967ac58e3b1..e7fdb53b2531 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs @@ -221,10 +221,7 @@ impl cumulus_pallet_aura_ext::Config for Runtime {} impl pallet_timestamp::Config for Runtime { type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -233,7 +230,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml index c0b8fb7636b5..eebd662c3fd5 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml @@ -188,5 +188,3 @@ try-runtime = [ "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", ] - -experimental = ["pallet-aura/experimental"] diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index 05da00ac5550..98f76984dd45 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -187,10 +187,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -337,7 +334,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml index e87e825a34e8..39cb69e679cc 100644 --- a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml @@ -188,5 +188,3 @@ try-runtime = [ "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", ] - -experimental = ["pallet-aura/experimental"] diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index e921df1e5da8..5adbdc1f38cc 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -187,10 +187,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = weights::pallet_timestamp::WeightInfo; } @@ -337,7 +334,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/cumulus/parachains/runtimes/starters/seedling/Cargo.toml b/cumulus/parachains/runtimes/starters/seedling/Cargo.toml index 1f5bee7784e9..9f08fdf59437 100644 --- a/cumulus/parachains/runtimes/starters/seedling/Cargo.toml +++ b/cumulus/parachains/runtimes/starters/seedling/Cargo.toml @@ -79,5 +79,3 @@ std = [ "sp-version/std", "substrate-wasm-builder", ] - -experimental = ["pallet-aura/experimental"] diff --git a/cumulus/parachains/runtimes/starters/seedling/src/lib.rs b/cumulus/parachains/runtimes/starters/seedling/src/lib.rs index 179bda356aed..bf4768d8457a 100644 --- a/cumulus/parachains/runtimes/starters/seedling/src/lib.rs +++ b/cumulus/parachains/runtimes/starters/seedling/src/lib.rs @@ -213,17 +213,13 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } impl pallet_timestamp::Config for Runtime { type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ parachains_common::SLOT_DURATION / 2 }>; type WeightInfo = (); } diff --git a/cumulus/parachains/runtimes/starters/shell/Cargo.toml b/cumulus/parachains/runtimes/starters/shell/Cargo.toml index 5a8f2a9d1253..2f82547afe9a 100644 --- a/cumulus/parachains/runtimes/starters/shell/Cargo.toml +++ b/cumulus/parachains/runtimes/starters/shell/Cargo.toml @@ -99,5 +99,3 @@ try-runtime = [ "parachain-info/try-runtime", "sp-runtime/try-runtime", ] - -experimental = ["pallet-aura/experimental"] diff --git a/cumulus/parachains/runtimes/starters/shell/src/lib.rs b/cumulus/parachains/runtimes/starters/shell/src/lib.rs index c0904f0faef5..51fdfac5b1c1 100644 --- a/cumulus/parachains/runtimes/starters/shell/src/lib.rs +++ b/cumulus/parachains/runtimes/starters/shell/src/lib.rs @@ -241,17 +241,13 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } impl pallet_timestamp::Config for Runtime { type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ parachains_common::SLOT_DURATION / 2 }>; type WeightInfo = (); } diff --git a/cumulus/parachains/runtimes/testing/penpal/Cargo.toml b/cumulus/parachains/runtimes/testing/penpal/Cargo.toml index 7f3e898d923d..c18f6571f416 100644 --- a/cumulus/parachains/runtimes/testing/penpal/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/penpal/Cargo.toml @@ -191,5 +191,3 @@ try-runtime = [ "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", ] - -experimental = ["pallet-aura/experimental"] diff --git a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs index 24a325c6f5b8..3063601e030f 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs @@ -582,7 +582,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml index 42169e8949f5..577ed749167f 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml @@ -134,5 +134,3 @@ runtime-benchmarks = [ "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", ] - -experimental = ["pallet-aura/experimental"] diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs index aea139fb66ec..753d2d120652 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -228,10 +228,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - #[cfg(feature = "experimental")] type MinimumPeriod = ConstU64<0>; - #[cfg(not(feature = "experimental"))] - type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; type WeightInfo = (); } @@ -594,7 +591,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/docs/sdk/Cargo.toml b/docs/sdk/Cargo.toml index 8b498d407c02..3f40a950c286 100644 --- a/docs/sdk/Cargo.toml +++ b/docs/sdk/Cargo.toml @@ -86,6 +86,3 @@ sp-version = { path = "../../substrate/primitives/version" } # XCM xcm = { package = "staging-xcm", path = "../../polkadot/xcm" } - -[features] -experimental = ["pallet-aura/experimental"] diff --git a/docs/sdk/src/polkadot_sdk/cumulus.rs b/docs/sdk/src/polkadot_sdk/cumulus.rs index 7d9daf9067c7..9bd957c7c1c0 100644 --- a/docs/sdk/src/polkadot_sdk/cumulus.rs +++ b/docs/sdk/src/polkadot_sdk/cumulus.rs @@ -110,7 +110,6 @@ mod tests { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } diff --git a/prdoc/pr_3654.prdoc b/prdoc/pr_3654.prdoc new file mode 100644 index 000000000000..de4a68d23569 --- /dev/null +++ b/prdoc/pr_3654.prdoc @@ -0,0 +1,14 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: Remove `experimental` feature from `pallet-aura` + +doc: + - audience: Runtime Dev + description: | + The `experimental` feature in `pallet-aura`, previously used to gate different experimental + changes, became redundant with the introduction of the async backing which relies on the + mentioned changes, therefore, it is removed. + +crates: + - name: pallet-aura diff --git a/substrate/frame/aura/src/lib.rs b/substrate/frame/aura/src/lib.rs index f7506db05d1d..55653de97a8b 100644 --- a/substrate/frame/aura/src/lib.rs +++ b/substrate/frame/aura/src/lib.rs @@ -66,9 +66,6 @@ const LOG_TARGET: &str = "runtime::aura"; /// /// This was the default behavior of the Aura pallet and may be used for /// backwards compatibility. -/// -/// Note that this type is likely not useful without the `experimental` -/// feature. pub struct MinimumPeriodTimesTwo(sp_std::marker::PhantomData); impl Get for MinimumPeriodTimesTwo { @@ -117,10 +114,6 @@ pub mod pallet { /// The effective value of this type should not change while the chain is running. /// /// For backwards compatibility either use [`MinimumPeriodTimesTwo`] or a const. - /// - /// This associated type is only present when compiled with the `experimental` - /// feature. - #[cfg(feature = "experimental")] type SlotDuration: Get<::Moment>; } @@ -250,17 +243,7 @@ impl Pallet { /// Determine the Aura slot-duration based on the Timestamp module configuration. pub fn slot_duration() -> T::Moment { - #[cfg(feature = "experimental")] - { - T::SlotDuration::get() - } - - #[cfg(not(feature = "experimental"))] - { - // we double the minimum block-period so each author can always propose within - // the majority of its slot. - ::MinimumPeriod::get().saturating_mul(2u32.into()) - } + T::SlotDuration::get() } /// Ensure the correctness of the state of this pallet. diff --git a/substrate/frame/aura/src/mock.rs b/substrate/frame/aura/src/mock.rs index 535e27fa35ee..786e6e2efafb 100644 --- a/substrate/frame/aura/src/mock.rs +++ b/substrate/frame/aura/src/mock.rs @@ -84,8 +84,6 @@ impl pallet_aura::Config for Test { type DisabledValidators = MockDisabledValidators; type MaxAuthorities = ConstU32<10>; type AllowMultipleBlocksPerSlot = AllowMultipleBlocksPerSlot; - - #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } diff --git a/templates/parachain/runtime/Cargo.toml b/templates/parachain/runtime/Cargo.toml index 9d9da2b4b974..41a510c5ed35 100644 --- a/templates/parachain/runtime/Cargo.toml +++ b/templates/parachain/runtime/Cargo.toml @@ -194,5 +194,3 @@ try-runtime = [ "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", ] - -experimental = ["pallet-aura/experimental"] diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index dcfab59eb812..acaabc0dbc36 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -453,7 +453,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; type AllowMultipleBlocksPerSlot = ConstBool; - #[cfg(feature = "experimental")] type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } diff --git a/templates/solochain/runtime/Cargo.toml b/templates/solochain/runtime/Cargo.toml index a7fc0519ba20..33da035878a7 100644 --- a/templates/solochain/runtime/Cargo.toml +++ b/templates/solochain/runtime/Cargo.toml @@ -147,5 +147,3 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "sp-runtime/try-runtime", ] - -experimental = ["pallet-aura/experimental"] diff --git a/templates/solochain/runtime/src/lib.rs b/templates/solochain/runtime/src/lib.rs index 358db0849a09..9b52ee60a635 100644 --- a/templates/solochain/runtime/src/lib.rs +++ b/templates/solochain/runtime/src/lib.rs @@ -180,8 +180,6 @@ impl pallet_aura::Config for Runtime { type DisabledValidators = (); type MaxAuthorities = ConstU32<32>; type AllowMultipleBlocksPerSlot = ConstBool; - - #[cfg(feature = "experimental")] type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; } From fe343cc71cbe85264a1df4ecf4d6848a707f0982 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:19:21 +0100 Subject: [PATCH 3/9] Bump the known_good_semver group with 3 updates (#3717) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the known_good_semver group with 3 updates: [log](https://github.com/rust-lang/log), [syn](https://github.com/dtolnay/syn) and [clap](https://github.com/clap-rs/clap). Updates `log` from 0.4.20 to 0.4.21
Changelog

Sourced from log's changelog.

[0.4.21] - 2024-02-27

What's Changed

New Contributors

Commits
  • 3ccdc28 Merge pull request #617 from rust-lang/cargo/0.4.21
  • 6153cb2 prepare for 0.4.21 release
  • f0f7494 Merge pull request #613 from rust-lang/feat/kv-cleanup
  • 2b220bf clean up structured logging example
  • 646e9ab use original Visitor name for VisitValue
  • cf85c38 add needed subfeatures to kv_unstable
  • 73e9539 fix up capturing of :err
  • 31bb4b0 move error macros together
  • ad91711 support field shorthand in macros
  • 90a347b restore removed APIs as deprecated
  • Additional commits viewable in compare view

Updates `syn` from 2.0.50 to 2.0.52
Release notes

Sourced from syn's releases.

2.0.52

  • Add an expression parser that uses match-arm's boundary rules (#1593)

2.0.51

  • Resolve non_local_definitions warnings in generated code under rustc 1.78-nightly
Commits
  • 07ede6a Release 2.0.52
  • acbcfbc Merge pull request #1593 from dtolnay/boundary
  • 4924a99 Add an expression parser that uses match-arm's boundary rules
  • e06122b Resolve unnecessary_get_then_check clippy lint
  • 018fc5a Update test suite to nightly-2024-02-27
  • 5e15a9b Release 2.0.51
  • 7e0d4e1 Resolve non_local_definitions warning in debug impls
  • 8667ad9 Ignore module_name_repetitions pedantic clippy lint in codegen
  • 1fc3200 Update test suite to nightly-2024-02-26
  • 07a2065 Update test suite to nightly-2024-02-23
  • See full diff in compare view

Updates `clap` from 4.5.1 to 4.5.3
Release notes

Sourced from clap's releases.

v4.5.3

[4.5.3] - 2024-03-15

Internal

  • (derive) Update heck

v4.5.2

[4.5.2] - 2024-03-06

Fixes

  • (macros) Silence a warning
Changelog

Sourced from clap's changelog.

[4.5.3] - 2024-03-15

Internal

  • (derive) Update heck

[4.5.2] - 2024-03-06

Fixes

  • (macros) Silence a warning
Commits
  • 4e07b43 chore: Release
  • 8247c7d docs: Update changelog
  • 677c52c chore: Update heck requirement (#5396)
  • f65d421 chore: Release
  • 886b272 docs: Update changelog
  • 3ba4297 Merge pull request #5386 from amaanq/static-var-name
  • 2aea950 fix: Use SCREAMING_SNAKE_CASE for static variable authors
  • 690f555 Merge pull request #5382 from clap-rs/renovate/pre-commit-action-3.x
  • a2aa644 chore(deps): update compatible (dev) (#5381)
  • c233de5 chore(deps): update pre-commit/action action to v3.0.1
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 240 +++++++++--------- Cargo.toml | 4 +- cumulus/client/cli/Cargo.toml | 2 +- cumulus/polkadot-parachain/Cargo.toml | 2 +- cumulus/test/service/Cargo.toml | 2 +- polkadot/cli/Cargo.toml | 2 +- polkadot/node/malus/Cargo.toml | 2 +- polkadot/node/subsystem-bench/Cargo.toml | 2 +- .../test-parachains/adder/collator/Cargo.toml | 2 +- .../undying/collator/Cargo.toml | 2 +- polkadot/utils/generate-bags/Cargo.toml | 2 +- .../remote-ext-tests/bags-list/Cargo.toml | 2 +- substrate/bin/node/bench/Cargo.toml | 2 +- substrate/bin/node/cli/Cargo.toml | 4 +- substrate/bin/node/inspect/Cargo.toml | 2 +- .../bin/utils/chain-spec-builder/Cargo.toml | 2 +- substrate/bin/utils/subkey/Cargo.toml | 2 +- substrate/client/cli/Cargo.toml | 2 +- substrate/client/storage-monitor/Cargo.toml | 2 +- .../solution-type/fuzzer/Cargo.toml | 2 +- .../single-block-migrations/Cargo.toml | 2 +- substrate/frame/migrations/Cargo.toml | 2 +- .../npos-elections/fuzzer/Cargo.toml | 2 +- .../ci/node-template-release/Cargo.toml | 2 +- .../utils/frame/benchmarking-cli/Cargo.toml | 2 +- .../frame/frame-utilities-cli/Cargo.toml | 2 +- .../generate-bags/node-runtime/Cargo.toml | 2 +- .../utils/frame/try-runtime/cli/Cargo.toml | 2 +- templates/minimal/node/Cargo.toml | 2 +- templates/parachain/node/Cargo.toml | 2 +- templates/solochain/node/Cargo.toml | 2 +- 31 files changed, 155 insertions(+), 149 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 699fd35a8246..f3535d509ff7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -191,7 +191,7 @@ checksum = "c0391754c09fab4eae3404d19d0d297aa1c670c1775ab51d8a5312afeca23157" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -202,11 +202,11 @@ checksum = "8a98ad1696a2e17f010ae8e43e9f2a1e930ed176a8e3ff77acfeff6dfb07b42c" dependencies = [ "const-hex", "dunce", - "heck", + "heck 0.4.1", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", "syn-solidity", "tiny-keccak", ] @@ -347,7 +347,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -1228,7 +1228,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -1245,7 +1245,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -1427,7 +1427,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -2613,12 +2613,12 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.1" +version = "4.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" +checksum = "949626d00e063efc93b6dca932419ceb5432f99769911c0b995f7e884c778813" dependencies = [ "clap_builder", - "clap_derive 4.5.0", + "clap_derive 4.5.3", ] [[package]] @@ -2632,9 +2632,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", @@ -2649,7 +2649,7 @@ version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "586a385f7ef2f8b4d86bddaa0c094794e7ccbfe5ffef1f434fe928143fc783a5" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", ] [[package]] @@ -2658,7 +2658,7 @@ version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-error", "proc-macro2", "quote", @@ -2667,14 +2667,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.0" +version = "4.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "90239a040c80f5e14809ca132ddc4176ab33d5e17e49691793296e3fcb34d72f" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -3383,7 +3383,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.5.1", + "clap 4.5.3", "criterion-plot", "futures", "is-terminal", @@ -3536,7 +3536,7 @@ dependencies = [ name = "cumulus-client-cli" version = "0.7.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "parity-scale-codec", "sc-chain-spec", "sc-cli", @@ -3895,7 +3895,7 @@ dependencies = [ "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -4299,7 +4299,7 @@ name = "cumulus-test-service" version = "0.1.0" dependencies = [ "async-trait", - "clap 4.5.1", + "clap 4.5.3", "criterion 0.5.1", "cumulus-client-cli", "cumulus-client-consensus-common", @@ -4410,7 +4410,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -4450,7 +4450,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -4467,7 +4467,7 @@ checksum = "50c49547d73ba8dcfd4ad7325d64c6d5391ff4224d498fc39a6f3f49825a530d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -4675,7 +4675,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -4745,7 +4745,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.50", + "syn 2.0.52", "termcolor", "walkdir", ] @@ -4762,7 +4762,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.50", + "syn 2.0.52", "termcolor", "toml 0.8.8", "walkdir", @@ -4967,7 +4967,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", @@ -4990,7 +4990,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -5001,7 +5001,7 @@ checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -5054,9 +5054,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.30" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "837c0466252947ada828b975e12daf82e18bb5444e4df87be6038d4469e2a3d2" +checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3" dependencies = [ "serde", ] @@ -5191,7 +5191,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -5512,7 +5512,7 @@ dependencies = [ "Inflector", "array-bytes 6.1.0", "chrono", - "clap 4.5.1", + "clap 4.5.3", "comfy-table", "frame-benchmarking", "frame-support", @@ -5578,7 +5578,7 @@ dependencies = [ "quote", "scale-info", "sp-arithmetic", - "syn 2.0.50", + "syn 2.0.52", "trybuild", ] @@ -5604,7 +5604,7 @@ dependencies = [ name = "frame-election-solution-type-fuzzer" version = "2.0.0-alpha.5" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-support", @@ -5735,7 +5735,7 @@ dependencies = [ "quote", "regex", "sp-crypto-hashing", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -5746,7 +5746,7 @@ dependencies = [ "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -5755,7 +5755,7 @@ version = "11.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -5988,7 +5988,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -6342,6 +6342,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -6935,7 +6941,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fc56131589f82e57805f7338b87023db4aafef813555708b159787e34ad6bc" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-crate 3.0.0", "proc-macro2", "quote", @@ -7586,7 +7592,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fba456131824ab6acd4c7bf61e9c0f0a3014b5fc9868ccb8e10d344594cdc4f" dependencies = [ - "heck", + "heck 0.4.1", "quote", "syn 1.0.109", ] @@ -7839,9 +7845,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" dependencies = [ "serde", "value-bag", @@ -7927,7 +7933,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -7941,7 +7947,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -7952,7 +7958,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -7963,7 +7969,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -8120,7 +8126,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" name = "minimal-template-node" version = "0.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "frame", "futures", "futures-timer", @@ -8589,7 +8595,7 @@ name = "node-bench" version = "0.9.0-dev" dependencies = [ "array-bytes 6.1.0", - "clap 4.5.1", + "clap 4.5.3", "derive_more", "fs_extra", "futures", @@ -8666,7 +8672,7 @@ dependencies = [ name = "node-runtime-generate-bags" version = "3.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "generate-bags", "kitchensink-runtime", ] @@ -8675,7 +8681,7 @@ dependencies = [ name = "node-template-release" version = "3.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "flate2", "fs_extra", "glob", @@ -9624,7 +9630,7 @@ version = "18.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -10852,7 +10858,7 @@ dependencies = [ "proc-macro2", "quote", "sp-runtime", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -11257,7 +11263,7 @@ dependencies = [ name = "parachain-template-node" version = "0.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "color-print", "cumulus-client-cli", "cumulus-client-collator", @@ -11947,7 +11953,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -11988,7 +11994,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -12203,7 +12209,7 @@ name = "polkadot-cli" version = "7.0.0" dependencies = [ "cfg-if", - "clap 4.5.1", + "clap 4.5.3", "frame-benchmarking-cli", "futures", "log", @@ -13053,7 +13059,7 @@ dependencies = [ "async-trait", "bridge-hub-rococo-runtime", "bridge-hub-westend-runtime", - "clap 4.5.1", + "clap 4.5.3", "collectives-westend-runtime", "color-print", "contracts-rococo-runtime", @@ -13589,7 +13595,7 @@ dependencies = [ "async-trait", "bincode", "bitvec", - "clap 4.5.1", + "clap 4.5.3", "clap-num", "color-eyre", "colored", @@ -13683,7 +13689,7 @@ version = "1.0.0" dependencies = [ "assert_matches", "async-trait", - "clap 4.5.1", + "clap 4.5.3", "color-eyre", "futures", "futures-timer", @@ -13830,7 +13836,7 @@ dependencies = [ name = "polkadot-voter-bags" version = "7.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "generate-bags", "sp-io", "westend-runtime", @@ -13885,7 +13891,7 @@ dependencies = [ "polkavm-common", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -13895,7 +13901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" dependencies = [ "polkavm-derive-impl", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -14091,7 +14097,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" dependencies = [ "proc-macro2", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -14182,7 +14188,7 @@ checksum = "9b698b0b09d40e9b7c1a47b132d66a8b54bcd20583d9b6d06e4535e383b4405c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -14254,7 +14260,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -14316,7 +14322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", - "heck", + "heck 0.4.1", "itertools 0.10.5", "lazy_static", "log", @@ -14354,7 +14360,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -14697,7 +14703,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -14785,7 +14791,7 @@ checksum = "e898588f33fdd5b9420719948f9f2a32c922a246964576f71ba7f24f80610fbc" name = "remote-ext-tests-bags-list" version = "1.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "frame-system", "log", "pallet-bags-list-remote-tests", @@ -15188,7 +15194,7 @@ dependencies = [ "regex", "relative-path", "rustc_version 0.4.0", - "syn 2.0.50", + "syn 2.0.52", "unicode-ident", ] @@ -15642,7 +15648,7 @@ dependencies = [ "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -15651,7 +15657,7 @@ version = "0.36.0" dependencies = [ "array-bytes 6.1.0", "chrono", - "clap 4.5.1", + "clap 4.5.3", "fdlimit", "futures", "futures-timer", @@ -16822,7 +16828,7 @@ dependencies = [ name = "sc-storage-monitor" version = "0.16.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "fs4", "log", "sp-core", @@ -16924,7 +16930,7 @@ dependencies = [ "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -17326,7 +17332,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -17426,7 +17432,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -18224,7 +18230,7 @@ dependencies = [ name = "solochain-template-node" version = "0.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "frame-benchmarking-cli", "frame-system", "futures", @@ -18334,7 +18340,7 @@ dependencies = [ "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -18728,7 +18734,7 @@ version = "0.0.0" dependencies = [ "quote", "sp-crypto-hashing", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -18746,7 +18752,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk#82912acb33a9030c0ef3bf5 dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -18755,7 +18761,7 @@ version = "14.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -18915,7 +18921,7 @@ dependencies = [ name = "sp-npos-elections-fuzzer" version = "2.0.0-alpha.5" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "honggfuzz", "rand", "sp-npos-elections", @@ -19030,7 +19036,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -19042,7 +19048,7 @@ dependencies = [ "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -19314,7 +19320,7 @@ dependencies = [ "proc-macro2", "quote", "sp-version", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -19438,7 +19444,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" name = "staging-chain-spec-builder" version = "2.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "log", "sc-chain-spec", "serde_json", @@ -19451,7 +19457,7 @@ version = "3.0.0-dev" dependencies = [ "array-bytes 6.1.0", "assert_cmd", - "clap 4.5.1", + "clap 4.5.3", "clap_complete", "criterion 0.4.0", "frame-benchmarking", @@ -19561,7 +19567,7 @@ dependencies = [ name = "staging-node-inspect" version = "0.12.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "parity-scale-codec", "sc-cli", "sc-client-api", @@ -19742,7 +19748,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -19755,18 +19761,18 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] name = "subkey" version = "9.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "sc-cli", ] @@ -19808,7 +19814,7 @@ dependencies = [ name = "substrate-frame-cli" version = "32.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "frame-support", "frame-system", "sc-cli", @@ -20157,9 +20163,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.50" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -20175,7 +20181,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -20289,7 +20295,7 @@ dependencies = [ name = "test-parachain-adder-collator" version = "1.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "futures", "futures-timer", "log", @@ -20337,7 +20343,7 @@ dependencies = [ name = "test-parachain-undying-collator" version = "1.0.0" dependencies = [ - "clap 4.5.1", + "clap 4.5.3", "futures", "futures-timer", "log", @@ -20440,7 +20446,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -20601,7 +20607,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -20808,7 +20814,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -20850,7 +20856,7 @@ dependencies = [ "proc-macro-crate 3.0.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -21032,7 +21038,7 @@ version = "0.38.0" dependencies = [ "assert_cmd", "async-trait", - "clap 4.5.1", + "clap 4.5.3", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -21270,9 +21276,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.4.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" +checksum = "8fec26a25bd6fca441cdd0f769fd7f891bae119f996de31f86a5eddccef54c1d" dependencies = [ "value-bag-serde1", "value-bag-sval2", @@ -21280,9 +21286,9 @@ dependencies = [ [[package]] name = "value-bag-serde1" -version = "1.4.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b9f3feef403a50d4d67e9741a6d8fc688bcbb4e4f31bd4aab72cc690284394" +checksum = "ead5b693d906686203f19a49e88c477fb8c15798b68cf72f60b4b5521b4ad891" dependencies = [ "erased-serde", "serde", @@ -21291,9 +21297,9 @@ dependencies = [ [[package]] name = "value-bag-sval2" -version = "1.4.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b24f4146b6f3361e91cbf527d1fb35e9376c3c0cef72ca5ec5af6d640fad7d" +checksum = "3b9d0f4a816370c3a0d7d82d603b62198af17675b12fe5e91de6b47ceb505882" dependencies = [ "sval", "sval_buffer", @@ -21415,7 +21421,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", "wasm-bindgen-shared", ] @@ -21449,7 +21455,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -22466,7 +22472,7 @@ dependencies = [ "proc-macro2", "quote", "staging-xcm", - "syn 2.0.50", + "syn 2.0.52", "trybuild", ] @@ -22588,7 +22594,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] @@ -22608,7 +22614,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.52", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f256d02808a8..3acb6c1d0555 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -547,14 +547,14 @@ default_constructed_unit_structs = { level = "allow", priority = 2 } # stylistic polkavm = "0.9.3" polkavm-linker = "0.9.2" polkavm-derive = "0.9.1" -log = { version = "0.4.20", default-features = false } +log = { version = "0.4.21", default-features = false } quote = { version = "1.0.33" } serde = { version = "1.0.197", default-features = false } serde-big-array = { version = "0.3.2" } serde_derive = { version = "1.0.117" } serde_json = { version = "1.0.114", default-features = false } serde_yaml = { version = "0.9" } -syn = { version = "2.0.50" } +syn = { version = "2.0.52" } thiserror = { version = "1.0.48" } [profile.release] diff --git a/cumulus/client/cli/Cargo.toml b/cumulus/client/cli/Cargo.toml index eaf0d5d5d7f7..0b2edb593c40 100644 --- a/cumulus/client/cli/Cargo.toml +++ b/cumulus/client/cli/Cargo.toml @@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" workspace = true [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } url = "2.4.0" diff --git a/cumulus/polkadot-parachain/Cargo.toml b/cumulus/polkadot-parachain/Cargo.toml index 84a232e954fc..70423856d347 100644 --- a/cumulus/polkadot-parachain/Cargo.toml +++ b/cumulus/polkadot-parachain/Cargo.toml @@ -16,7 +16,7 @@ path = "src/main.rs" [dependencies] async-trait = "0.1.74" -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } futures = "0.3.28" hex-literal = "0.4.1" diff --git a/cumulus/test/service/Cargo.toml b/cumulus/test/service/Cargo.toml index 27273f4e0a8d..45e21432f5b8 100644 --- a/cumulus/test/service/Cargo.toml +++ b/cumulus/test/service/Cargo.toml @@ -14,7 +14,7 @@ path = "src/main.rs" [dependencies] async-trait = "0.1.74" -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } criterion = { version = "0.5.1", features = ["async_tokio"] } jsonrpsee = { version = "0.22", features = ["server"] } diff --git a/polkadot/cli/Cargo.toml b/polkadot/cli/Cargo.toml index b9232f95981b..f57efa7ba436 100644 --- a/polkadot/cli/Cargo.toml +++ b/polkadot/cli/Cargo.toml @@ -19,7 +19,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] cfg-if = "1.0" -clap = { version = "4.5.1", features = ["derive"], optional = true } +clap = { version = "4.5.3", features = ["derive"], optional = true } log = { workspace = true, default-features = true } thiserror = { workspace = true } futures = "0.3.21" diff --git a/polkadot/node/malus/Cargo.toml b/polkadot/node/malus/Cargo.toml index ea25b9077f3a..b3eb856f08ef 100644 --- a/polkadot/node/malus/Cargo.toml +++ b/polkadot/node/malus/Cargo.toml @@ -43,7 +43,7 @@ assert_matches = "1.5" async-trait = "0.1.74" sp-keystore = { path = "../../../substrate/primitives/keystore" } sp-core = { path = "../../../substrate/primitives/core" } -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } futures = "0.3.21" futures-timer = "3.0.2" gum = { package = "tracing-gum", path = "../gum" } diff --git a/polkadot/node/subsystem-bench/Cargo.toml b/polkadot/node/subsystem-bench/Cargo.toml index 7c60ff48269c..71711ad0fbd0 100644 --- a/polkadot/node/subsystem-bench/Cargo.toml +++ b/polkadot/node/subsystem-bench/Cargo.toml @@ -39,7 +39,7 @@ async-trait = "0.1.57" sp-keystore = { path = "../../../substrate/primitives/keystore" } sc-keystore = { path = "../../../substrate/client/keystore" } sp-core = { path = "../../../substrate/primitives/core" } -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } futures = "0.3.21" futures-timer = "3.0.2" bincode = "1.3.3" diff --git a/polkadot/parachain/test-parachains/adder/collator/Cargo.toml b/polkadot/parachain/test-parachains/adder/collator/Cargo.toml index 8ce4ceb47c24..cb283c271191 100644 --- a/polkadot/parachain/test-parachains/adder/collator/Cargo.toml +++ b/polkadot/parachain/test-parachains/adder/collator/Cargo.toml @@ -16,7 +16,7 @@ path = "src/main.rs" [dependencies] parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } futures = "0.3.21" futures-timer = "3.0.2" log = { workspace = true, default-features = true } diff --git a/polkadot/parachain/test-parachains/undying/collator/Cargo.toml b/polkadot/parachain/test-parachains/undying/collator/Cargo.toml index 25fdbfa74ea0..238b98a66801 100644 --- a/polkadot/parachain/test-parachains/undying/collator/Cargo.toml +++ b/polkadot/parachain/test-parachains/undying/collator/Cargo.toml @@ -16,7 +16,7 @@ path = "src/main.rs" [dependencies] parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] } -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } futures = "0.3.21" futures-timer = "3.0.2" log = { workspace = true, default-features = true } diff --git a/polkadot/utils/generate-bags/Cargo.toml b/polkadot/utils/generate-bags/Cargo.toml index c0e9bd332df7..ad6d7259d248 100644 --- a/polkadot/utils/generate-bags/Cargo.toml +++ b/polkadot/utils/generate-bags/Cargo.toml @@ -10,7 +10,7 @@ description = "CLI to generate voter bags for Polkadot runtimes" workspace = true [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } generate-bags = { path = "../../../substrate/utils/frame/generate-bags" } sp-io = { path = "../../../substrate/primitives/io" } diff --git a/polkadot/utils/remote-ext-tests/bags-list/Cargo.toml b/polkadot/utils/remote-ext-tests/bags-list/Cargo.toml index ddc5af97a166..20e4130f888b 100644 --- a/polkadot/utils/remote-ext-tests/bags-list/Cargo.toml +++ b/polkadot/utils/remote-ext-tests/bags-list/Cargo.toml @@ -18,6 +18,6 @@ sp-tracing = { path = "../../../../substrate/primitives/tracing" } frame-system = { path = "../../../../substrate/frame/system" } sp-core = { path = "../../../../substrate/primitives/core" } -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } log = { workspace = true, default-features = true } tokio = { version = "1.24.2", features = ["macros"] } diff --git a/substrate/bin/node/bench/Cargo.toml b/substrate/bin/node/bench/Cargo.toml index 8e0f7fb93b39..d5de1dbe6c44 100644 --- a/substrate/bin/node/bench/Cargo.toml +++ b/substrate/bin/node/bench/Cargo.toml @@ -16,7 +16,7 @@ workspace = true [dependencies] array-bytes = "6.1" -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } log = { workspace = true, default-features = true } node-primitives = { path = "../primitives" } node-testing = { path = "../testing" } diff --git a/substrate/bin/node/cli/Cargo.toml b/substrate/bin/node/cli/Cargo.toml index abe284c41da1..8bddbbe04828 100644 --- a/substrate/bin/node/cli/Cargo.toml +++ b/substrate/bin/node/cli/Cargo.toml @@ -41,7 +41,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] # third-party dependencies array-bytes = "6.1" -clap = { version = "4.5.1", features = ["derive"], optional = true } +clap = { version = "4.5.3", features = ["derive"], optional = true } codec = { package = "parity-scale-codec", version = "3.6.1" } serde = { features = ["derive"], workspace = true, default-features = true } jsonrpsee = { version = "0.22", features = ["server"] } @@ -165,7 +165,7 @@ sp-trie = { path = "../../../primitives/trie" } sp-state-machine = { path = "../../../primitives/state-machine" } [build-dependencies] -clap = { version = "4.5.1", optional = true } +clap = { version = "4.5.3", optional = true } clap_complete = { version = "4.0.2", optional = true } node-inspect = { package = "staging-node-inspect", path = "../inspect", optional = true } frame-benchmarking-cli = { path = "../../../utils/frame/benchmarking-cli", optional = true } diff --git a/substrate/bin/node/inspect/Cargo.toml b/substrate/bin/node/inspect/Cargo.toml index 7db6e3efd3a0..8453aa3cdeb1 100644 --- a/substrate/bin/node/inspect/Cargo.toml +++ b/substrate/bin/node/inspect/Cargo.toml @@ -15,7 +15,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.6.1" } thiserror = { workspace = true } sc-cli = { path = "../../../client/cli" } diff --git a/substrate/bin/utils/chain-spec-builder/Cargo.toml b/substrate/bin/utils/chain-spec-builder/Cargo.toml index 996372c8a0f8..c126a76b763f 100644 --- a/substrate/bin/utils/chain-spec-builder/Cargo.toml +++ b/substrate/bin/utils/chain-spec-builder/Cargo.toml @@ -23,7 +23,7 @@ name = "chain-spec-builder" crate-type = ["rlib"] [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } log = { workspace = true, default-features = true } sc-chain-spec = { path = "../../../client/chain-spec" } serde_json = { workspace = true, default-features = true } diff --git a/substrate/bin/utils/subkey/Cargo.toml b/substrate/bin/utils/subkey/Cargo.toml index 93b1368ca757..8dc4bf254b2d 100644 --- a/substrate/bin/utils/subkey/Cargo.toml +++ b/substrate/bin/utils/subkey/Cargo.toml @@ -20,5 +20,5 @@ path = "src/main.rs" name = "subkey" [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } sc-cli = { path = "../../../client/cli" } diff --git a/substrate/client/cli/Cargo.toml b/substrate/client/cli/Cargo.toml index c70a0893c725..47b29555e660 100644 --- a/substrate/client/cli/Cargo.toml +++ b/substrate/client/cli/Cargo.toml @@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] array-bytes = "6.1" chrono = "0.4.31" -clap = { version = "4.5.1", features = ["derive", "string", "wrap_help"] } +clap = { version = "4.5.3", features = ["derive", "string", "wrap_help"] } fdlimit = "0.3.0" futures = "0.3.21" itertools = "0.10.3" diff --git a/substrate/client/storage-monitor/Cargo.toml b/substrate/client/storage-monitor/Cargo.toml index b2120b3efc43..5248ebdf9a65 100644 --- a/substrate/client/storage-monitor/Cargo.toml +++ b/substrate/client/storage-monitor/Cargo.toml @@ -12,7 +12,7 @@ homepage = "https://substrate.io" workspace = true [dependencies] -clap = { version = "4.5.1", features = ["derive", "string"] } +clap = { version = "4.5.3", features = ["derive", "string"] } log = { workspace = true, default-features = true } fs4 = "0.7.0" sp-core = { path = "../../primitives/core" } diff --git a/substrate/frame/election-provider-support/solution-type/fuzzer/Cargo.toml b/substrate/frame/election-provider-support/solution-type/fuzzer/Cargo.toml index 8a73dd38fa2d..a27f0f7d4dd4 100644 --- a/substrate/frame/election-provider-support/solution-type/fuzzer/Cargo.toml +++ b/substrate/frame/election-provider-support/solution-type/fuzzer/Cargo.toml @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } honggfuzz = "0.5" rand = { version = "0.8", features = ["small_rng", "std"] } diff --git a/substrate/frame/examples/single-block-migrations/Cargo.toml b/substrate/frame/examples/single-block-migrations/Cargo.toml index 5059b2433c77..613742a6787c 100644 --- a/substrate/frame/examples/single-block-migrations/Cargo.toml +++ b/substrate/frame/examples/single-block-migrations/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] docify = { version = "0.2.3", default-features = false } -log = { version = "0.4.20", default-features = false } +log = { version = "0.4.21", default-features = false } codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-support = { path = "../../support", default-features = false } diff --git a/substrate/frame/migrations/Cargo.toml b/substrate/frame/migrations/Cargo.toml index 2914aa9ea973..40059fb9ec43 100644 --- a/substrate/frame/migrations/Cargo.toml +++ b/substrate/frame/migrations/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } docify = "0.1.14" impl-trait-for-tuples = "0.2.2" -log = "0.4.18" +log = "0.4.21" scale-info = { version = "2.0.0", default-features = false, features = ["derive"] } frame-benchmarking = { default-features = false, optional = true, path = "../benchmarking" } diff --git a/substrate/primitives/npos-elections/fuzzer/Cargo.toml b/substrate/primitives/npos-elections/fuzzer/Cargo.toml index bcd908b97050..8e1dbaf2377e 100644 --- a/substrate/primitives/npos-elections/fuzzer/Cargo.toml +++ b/substrate/primitives/npos-elections/fuzzer/Cargo.toml @@ -17,7 +17,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } honggfuzz = "0.5" rand = { version = "0.8", features = ["small_rng", "std"] } sp-npos-elections = { path = ".." } diff --git a/substrate/scripts/ci/node-template-release/Cargo.toml b/substrate/scripts/ci/node-template-release/Cargo.toml index cc60d0a45101..4327b6857433 100644 --- a/substrate/scripts/ci/node-template-release/Cargo.toml +++ b/substrate/scripts/ci/node-template-release/Cargo.toml @@ -14,7 +14,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } flate2 = "1.0" fs_extra = "1.3" glob = "0.3" diff --git a/substrate/utils/frame/benchmarking-cli/Cargo.toml b/substrate/utils/frame/benchmarking-cli/Cargo.toml index a25ab3a8f5b1..b7fbb24b1a09 100644 --- a/substrate/utils/frame/benchmarking-cli/Cargo.toml +++ b/substrate/utils/frame/benchmarking-cli/Cargo.toml @@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] array-bytes = "6.1" chrono = "0.4" -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.6.1" } comfy-table = { version = "7.1.0", default-features = false } handlebars = "5.1.0" diff --git a/substrate/utils/frame/frame-utilities-cli/Cargo.toml b/substrate/utils/frame/frame-utilities-cli/Cargo.toml index 919016b2d8f0..3952c9fd219f 100644 --- a/substrate/utils/frame/frame-utilities-cli/Cargo.toml +++ b/substrate/utils/frame/frame-utilities-cli/Cargo.toml @@ -14,7 +14,7 @@ readme = "README.md" workspace = true [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } frame-support = { path = "../../../frame/support" } frame-system = { path = "../../../frame/system" } sc-cli = { path = "../../../client/cli" } diff --git a/substrate/utils/frame/generate-bags/node-runtime/Cargo.toml b/substrate/utils/frame/generate-bags/node-runtime/Cargo.toml index 68d4733614c1..37d96d7e12b9 100644 --- a/substrate/utils/frame/generate-bags/node-runtime/Cargo.toml +++ b/substrate/utils/frame/generate-bags/node-runtime/Cargo.toml @@ -17,4 +17,4 @@ kitchensink-runtime = { path = "../../../../bin/node/runtime" } generate-bags = { path = ".." } # third-party -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } diff --git a/substrate/utils/frame/try-runtime/cli/Cargo.toml b/substrate/utils/frame/try-runtime/cli/Cargo.toml index d123fc5f62dc..3ff57745a2db 100644 --- a/substrate/utils/frame/try-runtime/cli/Cargo.toml +++ b/substrate/utils/frame/try-runtime/cli/Cargo.toml @@ -38,7 +38,7 @@ frame-try-runtime = { path = "../../../../frame/try-runtime", optional = true } substrate-rpc-client = { path = "../../rpc/client" } async-trait = "0.1.74" -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } hex = { version = "0.4.3", default-features = false } log = { workspace = true, default-features = true } parity-scale-codec = "3.6.1" diff --git a/templates/minimal/node/Cargo.toml b/templates/minimal/node/Cargo.toml index 410cfc9f6c34..65aa1e207520 100644 --- a/templates/minimal/node/Cargo.toml +++ b/templates/minimal/node/Cargo.toml @@ -17,7 +17,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } futures = { version = "0.3.21", features = ["thread-pool"] } futures-timer = "3.0.1" jsonrpsee = { version = "0.22", features = ["server"] } diff --git a/templates/parachain/node/Cargo.toml b/templates/parachain/node/Cargo.toml index b4f3a504a4d9..63267acdbca8 100644 --- a/templates/parachain/node/Cargo.toml +++ b/templates/parachain/node/Cargo.toml @@ -17,7 +17,7 @@ workspace = true # name = "parachain-template-node" [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } log = { workspace = true, default-features = true } codec = { package = "parity-scale-codec", version = "3.0.0" } serde = { features = ["derive"], workspace = true, default-features = true } diff --git a/templates/solochain/node/Cargo.toml b/templates/solochain/node/Cargo.toml index 48bb511bfd10..a0bb5c27ed3b 100644 --- a/templates/solochain/node/Cargo.toml +++ b/templates/solochain/node/Cargo.toml @@ -18,7 +18,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = { version = "4.5.1", features = ["derive"] } +clap = { version = "4.5.3", features = ["derive"] } futures = { version = "0.3.21", features = ["thread-pool"] } serde_json = { workspace = true, default-features = true } jsonrpsee = { version = "0.22", features = ["server"] } From 6b1179f13b4815685769c9f523720ec9ed0e2ff4 Mon Sep 17 00:00:00 2001 From: jokess123 <163112061+jokess123@users.noreply.github.com> Date: Mon, 18 Mar 2024 06:50:54 +0800 Subject: [PATCH 4/9] Fix typo (#3691) --- bridges/modules/grandpa/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/modules/grandpa/README.md b/bridges/modules/grandpa/README.md index 43ee5c316d1b..992bd2cc4722 100644 --- a/bridges/modules/grandpa/README.md +++ b/bridges/modules/grandpa/README.md @@ -27,7 +27,7 @@ for provided header. There are two main things in GRANDPA that help building light clients: - there's no need to import all headers of the bridged chain. Light client may import finalized headers or just - some of finalized headders that it consider useful. While the validators set stays the same, the client may + some of finalized headers that it consider useful. While the validators set stays the same, the client may import any header that is finalized by this set; - when validators set changes, the GRANDPA gadget adds next set to the header. So light client doesn't need to From 1b5f4243d159fbb7cf7067241aca8a37f3dbf7ed Mon Sep 17 00:00:00 2001 From: Squirrel Date: Mon, 18 Mar 2024 05:29:35 +0000 Subject: [PATCH 5/9] sp-std removal from substrate/primitives (#3274) This PR removes sp-std crate from substrate/primitives sub-directories. For now crates that have `pub use` of sp-std or export macros that would necessitate users of the macros to `extern crate alloc` have been excluded from this PR. There should be no breaking changes in this PR. --------- Co-authored-by: Koute --- Cargo.lock | 31 ------------------- substrate/primitives/arithmetic/Cargo.toml | 2 -- .../primitives/arithmetic/src/biguint.rs | 11 ++++--- .../primitives/arithmetic/src/fixed_point.rs | 19 ++++++------ substrate/primitives/arithmetic/src/lib.rs | 7 +++-- .../primitives/arithmetic/src/per_things.rs | 17 +++++----- .../primitives/arithmetic/src/rational.rs | 10 +++--- .../primitives/authority-discovery/Cargo.toml | 2 -- .../primitives/authority-discovery/src/lib.rs | 4 ++- substrate/primitives/block-builder/Cargo.toml | 3 +- substrate/primitives/block-builder/src/lib.rs | 4 ++- .../primitives/consensus/aura/Cargo.toml | 2 -- .../primitives/consensus/aura/src/lib.rs | 4 ++- .../primitives/consensus/babe/Cargo.toml | 2 -- .../primitives/consensus/babe/src/digests.rs | 3 +- .../primitives/consensus/babe/src/lib.rs | 5 ++- .../primitives/consensus/beefy/Cargo.toml | 2 -- .../consensus/beefy/src/commitment.rs | 11 ++++--- .../primitives/consensus/beefy/src/lib.rs | 4 ++- .../primitives/consensus/beefy/src/mmr.rs | 6 ++-- .../primitives/consensus/beefy/src/payload.rs | 2 +- .../primitives/consensus/beefy/src/witness.rs | 3 +- .../primitives/consensus/grandpa/Cargo.toml | 2 -- .../primitives/consensus/grandpa/src/lib.rs | 4 ++- substrate/primitives/consensus/pow/Cargo.toml | 2 -- substrate/primitives/consensus/pow/src/lib.rs | 5 ++- .../primitives/consensus/sassafras/Cargo.toml | 2 -- .../consensus/sassafras/src/digests.rs | 3 +- .../primitives/consensus/sassafras/src/lib.rs | 4 ++- .../primitives/consensus/sassafras/src/vrf.rs | 3 +- .../primitives/consensus/slots/Cargo.toml | 2 -- .../primitives/crypto/ec-utils/Cargo.toml | 4 +-- .../crypto/ec-utils/src/bls12_377.rs | 2 +- .../crypto/ec-utils/src/bls12_381.rs | 2 +- .../primitives/crypto/ec-utils/src/bw6_761.rs | 2 +- .../crypto/ec-utils/src/ed_on_bls12_377.rs | 2 +- .../src/ed_on_bls12_381_bandersnatch.rs | 2 +- .../primitives/crypto/ec-utils/src/lib.rs | 2 ++ .../primitives/crypto/ec-utils/src/utils.rs | 2 +- substrate/primitives/externalities/Cargo.toml | 3 +- .../externalities/src/extensions.rs | 6 ++-- substrate/primitives/externalities/src/lib.rs | 9 +++--- .../primitives/genesis-builder/Cargo.toml | 3 +- .../primitives/genesis-builder/src/lib.rs | 6 ++-- substrate/primitives/inherents/Cargo.toml | 2 -- substrate/primitives/inherents/src/lib.rs | 4 ++- .../merkle-mountain-range/Cargo.toml | 2 -- .../merkle-mountain-range/src/lib.rs | 12 ++++--- .../merkle-mountain-range/src/utils.rs | 6 ++-- substrate/primitives/metadata-ir/Cargo.toml | 3 +- substrate/primitives/metadata-ir/src/lib.rs | 6 ++-- substrate/primitives/mixnet/Cargo.toml | 2 -- substrate/primitives/mixnet/src/lib.rs | 2 ++ .../primitives/mixnet/src/runtime_api.rs | 2 +- substrate/primitives/mixnet/src/types.rs | 6 ++-- .../primitives/npos-elections/Cargo.toml | 2 -- .../npos-elections/src/assignments.rs | 2 +- .../npos-elections/src/balancing.rs | 2 +- .../primitives/npos-elections/src/helpers.rs | 2 +- .../primitives/npos-elections/src/lib.rs | 17 +++++----- .../primitives/npos-elections/src/mock.rs | 10 +++--- .../primitives/npos-elections/src/node.rs | 7 +++-- .../primitives/npos-elections/src/phragmen.rs | 2 +- .../primitives/npos-elections/src/phragmms.rs | 4 +-- .../primitives/npos-elections/src/pjr.rs | 2 +- .../primitives/npos-elections/src/reduce.rs | 7 +++-- .../primitives/npos-elections/src/traits.rs | 2 +- substrate/primitives/session/Cargo.toml | 2 -- substrate/primitives/session/src/lib.rs | 4 ++- .../primitives/session/src/runtime_api.rs | 2 +- substrate/primitives/staking/Cargo.toml | 2 -- substrate/primitives/staking/src/lib.rs | 7 +++-- substrate/primitives/staking/src/offence.rs | 2 +- substrate/primitives/state-machine/Cargo.toml | 2 -- .../primitives/state-machine/src/backend.rs | 4 +-- substrate/primitives/state-machine/src/ext.rs | 8 ++--- substrate/primitives/state-machine/src/lib.rs | 6 ++-- .../src/overlayed_changes/changeset.rs | 14 ++++----- .../src/overlayed_changes/mod.rs | 16 +++++----- .../src/overlayed_changes/offchain.rs | 4 +-- .../state-machine/src/trie_backend.rs | 6 ++-- .../state-machine/src/trie_backend_essence.rs | 9 +++--- .../primitives/statement-store/Cargo.toml | 2 -- .../primitives/statement-store/src/lib.rs | 4 ++- .../statement-store/src/runtime_api.rs | 2 +- substrate/primitives/storage/Cargo.toml | 2 -- substrate/primitives/storage/src/lib.rs | 15 +++++---- .../primitives/test-primitives/Cargo.toml | 2 -- .../primitives/test-primitives/src/lib.rs | 4 ++- substrate/primitives/timestamp/Cargo.toml | 2 -- substrate/primitives/tracing/Cargo.toml | 2 -- substrate/primitives/tracing/src/lib.rs | 2 ++ substrate/primitives/tracing/src/types.rs | 6 ++-- .../primitives/transaction-pool/src/lib.rs | 2 ++ .../transaction-storage-proof/Cargo.toml | 2 -- .../transaction-storage-proof/src/lib.rs | 5 ++- substrate/primitives/trie/Cargo.toml | 2 -- substrate/primitives/trie/src/error.rs | 2 +- substrate/primitives/trie/src/lib.rs | 7 +++-- substrate/primitives/trie/src/node_codec.rs | 5 +-- .../primitives/trie/src/storage_proof.rs | 8 ++--- substrate/primitives/trie/src/trie_codec.rs | 2 +- substrate/primitives/trie/src/trie_stream.rs | 2 +- .../primitives/wasm-interface/Cargo.toml | 3 +- .../primitives/wasm-interface/src/lib.rs | 7 +++-- substrate/primitives/weights/Cargo.toml | 2 -- substrate/test-utils/runtime/Cargo.toml | 2 -- substrate/test-utils/runtime/src/extrinsic.rs | 1 - substrate/test-utils/runtime/src/lib.rs | 13 +++++--- .../runtime/src/substrate_test_pallet.rs | 4 +-- 110 files changed, 254 insertions(+), 278 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f3535d509ff7..d641f5544318 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18402,7 +18402,6 @@ dependencies = [ "scale-info", "serde", "sp-crypto-hashing", - "sp-std 14.0.0", "static_assertions", ] @@ -18444,7 +18443,6 @@ dependencies = [ "sp-api", "sp-application-crypto", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -18454,7 +18452,6 @@ dependencies = [ "sp-api", "sp-inherents", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -18501,7 +18498,6 @@ dependencies = [ "sp-consensus-slots", "sp-inherents", "sp-runtime", - "sp-std 14.0.0", "sp-timestamp", ] @@ -18519,7 +18515,6 @@ dependencies = [ "sp-core", "sp-inherents", "sp-runtime", - "sp-std 14.0.0", "sp-timestamp", ] @@ -18540,7 +18535,6 @@ dependencies = [ "sp-keystore", "sp-mmr-primitives", "sp-runtime", - "sp-std 14.0.0", "strum 0.24.1", "w3f-bls", ] @@ -18559,7 +18553,6 @@ dependencies = [ "sp-core", "sp-keystore", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -18570,7 +18563,6 @@ dependencies = [ "sp-api", "sp-core", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -18585,7 +18577,6 @@ dependencies = [ "sp-consensus-slots", "sp-core", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -18595,7 +18586,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-std 14.0.0", "sp-timestamp", ] @@ -18711,7 +18701,6 @@ dependencies = [ "ark-ed-on-bls12-381-bandersnatch-ext", "ark-scale 0.0.12", "sp-runtime-interface 24.0.0", - "sp-std 14.0.0", ] [[package]] @@ -18781,7 +18770,6 @@ version = "0.25.0" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 14.0.0", "sp-storage 19.0.0", ] @@ -18792,7 +18780,6 @@ dependencies = [ "serde_json", "sp-api", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -18805,7 +18792,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0", "thiserror", ] @@ -18870,7 +18856,6 @@ dependencies = [ "frame-metadata", "parity-scale-codec", "scale-info", - "sp-std 14.0.0", ] [[package]] @@ -18881,7 +18866,6 @@ dependencies = [ "scale-info", "sp-api", "sp-application-crypto", - "sp-std 14.0.0", ] [[package]] @@ -18898,7 +18882,6 @@ dependencies = [ "sp-core", "sp-debug-derive 14.0.0", "sp-runtime", - "sp-std 14.0.0", "thiserror", ] @@ -18913,7 +18896,6 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-runtime", - "sp-std 14.0.0", "substrate-test-utils", ] @@ -19100,7 +19082,6 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -19113,7 +19094,6 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -19133,7 +19113,6 @@ dependencies = [ "sp-externalities 0.25.0", "sp-panic-handler", "sp-runtime", - "sp-std 14.0.0", "sp-trie", "thiserror", "tracing", @@ -19159,7 +19138,6 @@ dependencies = [ "sp-externalities 0.25.0", "sp-runtime", "sp-runtime-interface 24.0.0", - "sp-std 14.0.0", "thiserror", "x25519-dalek 2.0.0", ] @@ -19195,7 +19173,6 @@ dependencies = [ "ref-cast", "serde", "sp-debug-derive 14.0.0", - "sp-std 14.0.0", ] [[package]] @@ -19208,7 +19185,6 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -19219,7 +19195,6 @@ dependencies = [ "parity-scale-codec", "sp-inherents", "sp-runtime", - "sp-std 14.0.0", "thiserror", ] @@ -19240,7 +19215,6 @@ name = "sp-tracing" version = "16.0.0" dependencies = [ "parity-scale-codec", - "sp-std 14.0.0", "tracing", "tracing-core", "tracing-subscriber 0.2.25", @@ -19264,7 +19238,6 @@ dependencies = [ "sp-core", "sp-inherents", "sp-runtime", - "sp-std 14.0.0", "sp-trie", ] @@ -19287,7 +19260,6 @@ dependencies = [ "sp-core", "sp-externalities 0.25.0", "sp-runtime", - "sp-std 14.0.0", "thiserror", "tracing", "trie-bench", @@ -19344,7 +19316,6 @@ dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 14.0.0", "wasmtime", ] @@ -19360,7 +19331,6 @@ dependencies = [ "smallvec", "sp-arithmetic", "sp-debug-derive 14.0.0", - "sp-std 14.0.0", ] [[package]] @@ -19971,7 +19941,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-state-machine", - "sp-std 14.0.0", "sp-tracing 16.0.0", "sp-transaction-pool", "sp-trie", diff --git a/substrate/primitives/arithmetic/Cargo.toml b/substrate/primitives/arithmetic/Cargo.toml index 301821ad6893..29c406b10b7f 100644 --- a/substrate/primitives/arithmetic/Cargo.toml +++ b/substrate/primitives/arithmetic/Cargo.toml @@ -26,7 +26,6 @@ num-traits = { version = "0.2.17", default-features = false } scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } serde = { features = ["alloc", "derive"], optional = true, workspace = true } static_assertions = "1.1.0" -sp-std = { path = "../std", default-features = false } [dev-dependencies] criterion = "0.4.0" @@ -42,7 +41,6 @@ std = [ "scale-info/std", "serde/std", "sp-crypto-hashing/std", - "sp-std/std", ] # Serde support without relying on std features. serde = ["dep:serde", "scale-info/serde"] diff --git a/substrate/primitives/arithmetic/src/biguint.rs b/substrate/primitives/arithmetic/src/biguint.rs index d92b08c8eca9..164ec67a603f 100644 --- a/substrate/primitives/arithmetic/src/biguint.rs +++ b/substrate/primitives/arithmetic/src/biguint.rs @@ -17,9 +17,10 @@ //! Infinite precision unsigned integer for substrate runtime. +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; +use core::{cell::RefCell, cmp::Ordering, ops}; use num_traits::{One, Zero}; -use sp_std::{cell::RefCell, cmp::Ordering, ops, prelude::*, vec}; // A sensible value for this would be half of the dword size of the host machine. Since the // runtime is compiled to 32bit webassembly, using 32 and 64 for single and double respectively @@ -35,7 +36,7 @@ const SHIFT: usize = 32; const B: Double = Single::max_value() as Double + 1; static_assertions::const_assert!( - sp_std::mem::size_of::() - sp_std::mem::size_of::() == SHIFT / 8 + core::mem::size_of::() - core::mem::size_of::() == SHIFT / 8 ); /// Splits a [`Double`] limb number into a tuple of two [`Single`] limb numbers. @@ -438,9 +439,9 @@ impl BigUint { } } -impl sp_std::fmt::Debug for BigUint { +impl core::fmt::Debug for BigUint { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!( f, "BigUint {{ {:?} ({:?})}}", @@ -450,7 +451,7 @@ impl sp_std::fmt::Debug for BigUint { } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { Ok(()) } } diff --git a/substrate/primitives/arithmetic/src/fixed_point.rs b/substrate/primitives/arithmetic/src/fixed_point.rs index ce14d2957b5e..46c09df21868 100644 --- a/substrate/primitives/arithmetic/src/fixed_point.rs +++ b/substrate/primitives/arithmetic/src/fixed_point.rs @@ -26,17 +26,16 @@ use crate::{ PerThing, Perbill, Rounding, SignedRounding, }; use codec::{CompactAs, Decode, Encode}; -use sp_std::{ +use core::{ fmt::Debug, ops::{self, Add, Div, Mul, Sub}, - prelude::*, }; #[cfg(feature = "serde")] use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; #[cfg(all(not(feature = "std"), feature = "serde"))] -use sp_std::alloc::string::{String, ToString}; +use alloc::string::{String, ToString}; /// Integer types that can be used to interact with `FixedPointNumber` implementations. pub trait FixedPointOperand: @@ -899,9 +898,9 @@ macro_rules! implement_fixed { } } - impl sp_std::fmt::Debug for $name { + impl ::core::fmt::Debug for $name { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { let integral = { let int = self.0 / Self::accuracy(); let signum_for_zero = if int == 0 && self.is_negative() { "-" } else { "" }; @@ -917,7 +916,7 @@ macro_rules! implement_fixed { } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { Ok(()) } } @@ -933,13 +932,13 @@ macro_rules! implement_fixed { } } - impl sp_std::fmt::Display for $name { - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + impl ::core::fmt::Display for $name { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { write!(f, "{}", self.0) } } - impl sp_std::str::FromStr for $name { + impl ::core::str::FromStr for $name { type Err = &'static str; fn from_str(s: &str) -> Result { @@ -969,7 +968,7 @@ macro_rules! implement_fixed { where D: Deserializer<'de>, { - use sp_std::str::FromStr; + use ::core::str::FromStr; let s = String::deserialize(deserializer)?; $name::from_str(&s).map_err(de::Error::custom) } diff --git a/substrate/primitives/arithmetic/src/lib.rs b/substrate/primitives/arithmetic/src/lib.rs index 900f0b75c3bf..33992e15423f 100644 --- a/substrate/primitives/arithmetic/src/lib.rs +++ b/substrate/primitives/arithmetic/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + /// Copied from `sp-runtime` and documented there. #[macro_export] macro_rules! assert_eq_error_rate { @@ -49,7 +51,8 @@ pub use per_things::{ }; pub use rational::{MultiplyRational, Rational128, RationalInfinite}; -use sp_std::{cmp::Ordering, fmt::Debug, prelude::*}; +use alloc::vec::Vec; +use core::{cmp::Ordering, fmt::Debug}; use traits::{BaseArithmetic, One, SaturatedConversion, Unsigned, Zero}; use codec::{Decode, Encode, MaxEncodedLen}; @@ -429,7 +432,7 @@ mod normalize_tests { mod threshold_compare_tests { use super::*; use crate::traits::Saturating; - use sp_std::cmp::Ordering; + use core::cmp::Ordering; #[test] fn epsilon_ord_works() { diff --git a/substrate/primitives/arithmetic/src/per_things.rs b/substrate/primitives/arithmetic/src/per_things.rs index fe88b72e24c2..057bfd7bf885 100644 --- a/substrate/primitives/arithmetic/src/per_things.rs +++ b/substrate/primitives/arithmetic/src/per_things.rs @@ -23,12 +23,11 @@ use crate::traits::{ Saturating, UniqueSaturatedInto, Unsigned, Zero, }; use codec::{CompactAs, Encode}; -use num_traits::{Pow, SaturatingAdd, SaturatingSub}; -use sp_std::{ +use core::{ fmt, ops, ops::{Add, Sub}, - prelude::*, }; +use num_traits::{Pow, SaturatingAdd, SaturatingSub}; /// Get the inner type of a `PerThing`. pub type InnerOf

=

::Inner; @@ -414,7 +413,7 @@ pub trait PerThing: } /// The rounding method to use for unsigned quantities. -#[derive(Copy, Clone, sp_std::fmt::Debug)] +#[derive(Copy, Clone, core::fmt::Debug)] pub enum Rounding { // Towards infinity. Up, @@ -427,7 +426,7 @@ pub enum Rounding { } /// The rounding method to use. -#[derive(Copy, Clone, sp_std::fmt::Debug)] +#[derive(Copy, Clone, core::fmt::Debug)] pub enum SignedRounding { // Towards positive infinity. High, @@ -580,8 +579,8 @@ macro_rules! implement_per_thing { } #[cfg(feature = "std")] - impl sp_std::fmt::Debug for $name { - fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { + impl core::fmt::Debug for $name { + fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { if $max == <$type>::max_value() { // Not a power of ten: show as N/D and approx % let pc = (self.0 as f64) / (self.0 as f64) * 100f64; @@ -606,8 +605,8 @@ macro_rules! implement_per_thing { } #[cfg(not(feature = "std"))] - impl sp_std::fmt::Debug for $name { - fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + impl core::fmt::Debug for $name { + fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { if $max == <$type>::max_value() { // Not a power of ten: show as N/D and approx % write!(fmt, "{}/{}", self.0, $max) diff --git a/substrate/primitives/arithmetic/src/rational.rs b/substrate/primitives/arithmetic/src/rational.rs index ebd89c615a38..2ec83e6fd868 100644 --- a/substrate/primitives/arithmetic/src/rational.rs +++ b/substrate/primitives/arithmetic/src/rational.rs @@ -16,8 +16,8 @@ // limitations under the License. use crate::{biguint::BigUint, helpers_128bit, Rounding}; +use core::cmp::Ordering; use num_traits::{Bounded, One, Zero}; -use sp_std::{cmp::Ordering, prelude::*}; /// A wrapper for any rational number with infinitely large numerator and denominator. /// @@ -92,15 +92,15 @@ impl From for RationalInfinite { pub struct Rational128(u128, u128); #[cfg(feature = "std")] -impl sp_std::fmt::Debug for Rational128 { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for Rational128 { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "Rational128({} / {} ≈ {:.8})", self.0, self.1, self.0 as f64 / self.1 as f64) } } #[cfg(not(feature = "std"))] -impl sp_std::fmt::Debug for Rational128 { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for Rational128 { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "Rational128({} / {})", self.0, self.1) } } diff --git a/substrate/primitives/authority-discovery/Cargo.toml b/substrate/primitives/authority-discovery/Cargo.toml index 70f00897cdd6..8ee8bb94ed97 100644 --- a/substrate/primitives/authority-discovery/Cargo.toml +++ b/substrate/primitives/authority-discovery/Cargo.toml @@ -21,7 +21,6 @@ scale-info = { version = "2.10.0", default-features = false, features = ["derive sp-api = { path = "../api", default-features = false } sp-application-crypto = { path = "../application-crypto", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } [features] default = ["std"] @@ -31,7 +30,6 @@ std = [ "sp-api/std", "sp-application-crypto/std", "sp-runtime/std", - "sp-std/std", ] serde = [ "scale-info/serde", diff --git a/substrate/primitives/authority-discovery/src/lib.rs b/substrate/primitives/authority-discovery/src/lib.rs index 3b25e39d4045..5aba76a3abb6 100644 --- a/substrate/primitives/authority-discovery/src/lib.rs +++ b/substrate/primitives/authority-discovery/src/lib.rs @@ -19,7 +19,9 @@ #![cfg_attr(not(feature = "std"), no_std)] -use sp_std::vec::Vec; +extern crate alloc; + +use alloc::vec::Vec; mod app { use sp_application_crypto::{app_crypto, key_types::AUTHORITY_DISCOVERY, sr25519}; diff --git a/substrate/primitives/block-builder/Cargo.toml b/substrate/primitives/block-builder/Cargo.toml index c1317facd7fc..cc4b10851544 100644 --- a/substrate/primitives/block-builder/Cargo.toml +++ b/substrate/primitives/block-builder/Cargo.toml @@ -19,8 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"] sp-api = { path = "../api", default-features = false } sp-inherents = { path = "../inherents", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } [features] default = ["std"] -std = ["sp-api/std", "sp-inherents/std", "sp-runtime/std", "sp-std/std"] +std = ["sp-api/std", "sp-inherents/std", "sp-runtime/std"] diff --git a/substrate/primitives/block-builder/src/lib.rs b/substrate/primitives/block-builder/src/lib.rs index 29e04857f463..9d03aa4d7a01 100644 --- a/substrate/primitives/block-builder/src/lib.rs +++ b/substrate/primitives/block-builder/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use sp_inherents::{CheckInherentsResult, InherentData}; use sp_runtime::{traits::Block as BlockT, ApplyExtrinsicResult}; @@ -44,7 +46,7 @@ sp_api::decl_runtime_apis! { /// Generate inherent extrinsics. The inherent data will vary from chain to chain. fn inherent_extrinsics( inherent: InherentData, - ) -> sp_std::vec::Vec<::Extrinsic>; + ) -> alloc::vec::Vec<::Extrinsic>; /// Check that the inherents are valid. The inherent data will vary from chain to chain. fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult; diff --git a/substrate/primitives/consensus/aura/Cargo.toml b/substrate/primitives/consensus/aura/Cargo.toml index 52f6bc22ba40..0cedc59ea8fb 100644 --- a/substrate/primitives/consensus/aura/Cargo.toml +++ b/substrate/primitives/consensus/aura/Cargo.toml @@ -24,7 +24,6 @@ sp-application-crypto = { path = "../../application-crypto", default-features = sp-consensus-slots = { path = "../slots", default-features = false } sp-inherents = { path = "../../inherents", default-features = false } sp-runtime = { path = "../../runtime", default-features = false } -sp-std = { path = "../../std", default-features = false } sp-timestamp = { path = "../../timestamp", default-features = false } [features] @@ -38,7 +37,6 @@ std = [ "sp-consensus-slots/std", "sp-inherents/std", "sp-runtime/std", - "sp-std/std", "sp-timestamp/std", ] diff --git a/substrate/primitives/consensus/aura/src/lib.rs b/substrate/primitives/consensus/aura/src/lib.rs index 78409e84e93a..5173d5516cfa 100644 --- a/substrate/primitives/consensus/aura/src/lib.rs +++ b/substrate/primitives/consensus/aura/src/lib.rs @@ -19,9 +19,11 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use codec::{Codec, Decode, Encode}; use sp_runtime::ConsensusEngineId; -use sp_std::vec::Vec; pub mod digests; pub mod inherents; diff --git a/substrate/primitives/consensus/babe/Cargo.toml b/substrate/primitives/consensus/babe/Cargo.toml index 8b3006f79a7f..724b9fd3e289 100644 --- a/substrate/primitives/consensus/babe/Cargo.toml +++ b/substrate/primitives/consensus/babe/Cargo.toml @@ -26,7 +26,6 @@ sp-consensus-slots = { path = "../slots", default-features = false } sp-core = { path = "../../core", default-features = false } sp-inherents = { path = "../../inherents", default-features = false } sp-runtime = { path = "../../runtime", default-features = false } -sp-std = { path = "../../std", default-features = false } sp-timestamp = { path = "../../timestamp", optional = true } [features] @@ -42,7 +41,6 @@ std = [ "sp-core/std", "sp-inherents/std", "sp-runtime/std", - "sp-std/std", "sp-timestamp/std", ] diff --git a/substrate/primitives/consensus/babe/src/digests.rs b/substrate/primitives/consensus/babe/src/digests.rs index afc967e3af39..e7af8c5763a0 100644 --- a/substrate/primitives/consensus/babe/src/digests.rs +++ b/substrate/primitives/consensus/babe/src/digests.rs @@ -22,9 +22,10 @@ use super::{ BabeEpochConfiguration, Randomness, Slot, BABE_ENGINE_ID, }; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; use sp_core::sr25519::vrf::VrfSignature; use sp_runtime::{DigestItem, RuntimeDebug}; -use sp_std::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; diff --git a/substrate/primitives/consensus/babe/src/lib.rs b/substrate/primitives/consensus/babe/src/lib.rs index ff0b4568226e..6eb75b270a02 100644 --- a/substrate/primitives/consensus/babe/src/lib.rs +++ b/substrate/primitives/consensus/babe/src/lib.rs @@ -20,15 +20,18 @@ #![forbid(unsafe_code, missing_docs, unused_variables, unused_imports)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub mod digests; pub mod inherents; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use sp_runtime::{traits::Header, ConsensusEngineId, RuntimeDebug}; -use sp_std::vec::Vec; use crate::digests::{NextConfigDescriptor, NextEpochDescriptor}; diff --git a/substrate/primitives/consensus/beefy/Cargo.toml b/substrate/primitives/consensus/beefy/Cargo.toml index 8ab817d52ef9..fbcc6e0c1048 100644 --- a/substrate/primitives/consensus/beefy/Cargo.toml +++ b/substrate/primitives/consensus/beefy/Cargo.toml @@ -26,7 +26,6 @@ sp-io = { path = "../../io", default-features = false } sp-mmr-primitives = { path = "../../merkle-mountain-range", default-features = false } sp-runtime = { path = "../../runtime", default-features = false } sp-keystore = { path = "../../keystore", default-features = false } -sp-std = { path = "../../std", default-features = false } strum = { version = "0.24.1", features = ["derive"], default-features = false } lazy_static = { version = "1.4.0", optional = true } @@ -49,7 +48,6 @@ std = [ "sp-keystore/std", "sp-mmr-primitives/std", "sp-runtime/std", - "sp-std/std", "strum/std", ] diff --git a/substrate/primitives/consensus/beefy/src/commitment.rs b/substrate/primitives/consensus/beefy/src/commitment.rs index 335c6b604f04..4fd9e1b0a6ed 100644 --- a/substrate/primitives/consensus/beefy/src/commitment.rs +++ b/substrate/primitives/consensus/beefy/src/commitment.rs @@ -15,9 +15,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, Error, Input}; +use core::cmp; use scale_info::TypeInfo; -use sp_std::{cmp, prelude::*}; use crate::{Payload, ValidatorSetId}; @@ -97,10 +98,10 @@ pub struct SignedCommitment { pub signatures: Vec>, } -impl sp_std::fmt::Display +impl core::fmt::Display for SignedCommitment { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let signatures_count = self.signatures.iter().filter(|s| s.is_some()).count(); write!( f, @@ -254,8 +255,8 @@ pub enum VersionedFinalityProof { V1(SignedCommitment), } -impl sp_std::fmt::Display for VersionedFinalityProof { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Display for VersionedFinalityProof { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { VersionedFinalityProof::V1(sc) => write!(f, "VersionedFinalityProof::V1({})", sc), } diff --git a/substrate/primitives/consensus/beefy/src/lib.rs b/substrate/primitives/consensus/beefy/src/lib.rs index 1c3801e3a506..b3f62ead736c 100644 --- a/substrate/primitives/consensus/beefy/src/lib.rs +++ b/substrate/primitives/consensus/beefy/src/lib.rs @@ -31,6 +31,8 @@ //! it will use a different set of keys. For Polkadot use case we plan to use `secp256k1` for BEEFY, //! while GRANDPA uses `ed25519`. +extern crate alloc; + mod commitment; mod payload; @@ -44,13 +46,13 @@ pub mod test_utils; pub use commitment::{Commitment, SignedCommitment, VersionedFinalityProof}; pub use payload::{known_payloads, BeefyPayloadId, Payload, PayloadProvider}; +use alloc::vec::Vec; use codec::{Codec, Decode, Encode}; use core::fmt::{Debug, Display}; use scale_info::TypeInfo; use sp_application_crypto::{AppCrypto, AppPublic, ByteArray, RuntimeAppPublic}; use sp_core::H256; use sp_runtime::traits::{Hash, Keccak256, NumberFor}; -use sp_std::prelude::*; /// Key type for BEEFY module. pub const KEY_TYPE: sp_core::crypto::KeyTypeId = sp_application_crypto::key_types::BEEFY; diff --git a/substrate/primitives/consensus/beefy/src/mmr.rs b/substrate/primitives/consensus/beefy/src/mmr.rs index 1b9a45f86878..74851ece7acf 100644 --- a/substrate/primitives/consensus/beefy/src/mmr.rs +++ b/substrate/primitives/consensus/beefy/src/mmr.rs @@ -26,7 +26,8 @@ //! but we imagine they will be useful for other chains that either want to bridge with Polkadot //! or are completely standalone, but heavily inspired by Polkadot. -use crate::{ecdsa_crypto::AuthorityId, ConsensusLog, MmrRootHash, Vec, BEEFY_ENGINE_ID}; +use crate::{ecdsa_crypto::AuthorityId, ConsensusLog, MmrRootHash, BEEFY_ENGINE_ID}; +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::{ @@ -150,10 +151,11 @@ pub use mmr_root_provider::MmrRootProvider; mod mmr_root_provider { use super::*; use crate::{known_payloads, payload::PayloadProvider, Payload}; + use alloc::sync::Arc; + use core::marker::PhantomData; use sp_api::ProvideRuntimeApi; use sp_mmr_primitives::MmrApi; use sp_runtime::traits::NumberFor; - use sp_std::{marker::PhantomData, sync::Arc}; /// A [`crate::Payload`] provider where payload is Merkle Mountain Range root hash. /// diff --git a/substrate/primitives/consensus/beefy/src/payload.rs b/substrate/primitives/consensus/beefy/src/payload.rs index d520de445c95..dff017b49e09 100644 --- a/substrate/primitives/consensus/beefy/src/payload.rs +++ b/substrate/primitives/consensus/beefy/src/payload.rs @@ -15,10 +15,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_runtime::traits::Block; -use sp_std::prelude::*; /// Id of different payloads in the [`crate::Commitment`] data. pub type BeefyPayloadId = [u8; 2]; diff --git a/substrate/primitives/consensus/beefy/src/witness.rs b/substrate/primitives/consensus/beefy/src/witness.rs index b633453340bb..cfffc94254a4 100644 --- a/substrate/primitives/consensus/beefy/src/witness.rs +++ b/substrate/primitives/consensus/beefy/src/witness.rs @@ -23,9 +23,8 @@ //! verification. This allows lowering the data and computation cost of verifying the //! signed commitment. -use sp_std::prelude::*; - use crate::commitment::{Commitment, SignedCommitment}; +use alloc::vec::Vec; /// A light form of [SignedCommitment]. /// diff --git a/substrate/primitives/consensus/grandpa/Cargo.toml b/substrate/primitives/consensus/grandpa/Cargo.toml index b06208a4308b..1f2da55c5a16 100644 --- a/substrate/primitives/consensus/grandpa/Cargo.toml +++ b/substrate/primitives/consensus/grandpa/Cargo.toml @@ -27,7 +27,6 @@ sp-application-crypto = { path = "../../application-crypto", default-features = sp-core = { path = "../../core", default-features = false } sp-keystore = { path = "../../keystore", default-features = false, optional = true } sp-runtime = { path = "../../runtime", default-features = false } -sp-std = { path = "../../std", default-features = false } [features] default = ["std"] @@ -42,7 +41,6 @@ std = [ "sp-core/std", "sp-keystore/std", "sp-runtime/std", - "sp-std/std", ] # Serde support without relying on std features. diff --git a/substrate/primitives/consensus/grandpa/src/lib.rs b/substrate/primitives/consensus/grandpa/src/lib.rs index 1cf5504c5e7d..75ed81894c25 100644 --- a/substrate/primitives/consensus/grandpa/src/lib.rs +++ b/substrate/primitives/consensus/grandpa/src/lib.rs @@ -19,9 +19,12 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "serde")] use serde::Serialize; +use alloc::vec::Vec; use codec::{Codec, Decode, Encode}; use scale_info::TypeInfo; #[cfg(feature = "std")] @@ -30,7 +33,6 @@ use sp_runtime::{ traits::{Header as HeaderT, NumberFor}, ConsensusEngineId, RuntimeDebug, }; -use sp_std::vec::Vec; /// The log target to be used by client code. pub const CLIENT_LOG_TARGET: &str = "grandpa"; diff --git a/substrate/primitives/consensus/pow/Cargo.toml b/substrate/primitives/consensus/pow/Cargo.toml index 8147b063f6d3..7a884f865fbe 100644 --- a/substrate/primitives/consensus/pow/Cargo.toml +++ b/substrate/primitives/consensus/pow/Cargo.toml @@ -20,7 +20,6 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = sp-api = { path = "../../api", default-features = false } sp-core = { path = "../../core", default-features = false } sp-runtime = { path = "../../runtime", default-features = false } -sp-std = { path = "../../std", default-features = false } [features] default = ["std"] @@ -29,5 +28,4 @@ std = [ "sp-api/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] diff --git a/substrate/primitives/consensus/pow/src/lib.rs b/substrate/primitives/consensus/pow/src/lib.rs index f37aae1c5c01..c14d23cf068f 100644 --- a/substrate/primitives/consensus/pow/src/lib.rs +++ b/substrate/primitives/consensus/pow/src/lib.rs @@ -19,9 +19,12 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; use codec::Decode; use sp_runtime::ConsensusEngineId; -use sp_std::vec::Vec; /// The `ConsensusEngineId` of PoW. pub const POW_ENGINE_ID: ConsensusEngineId = [b'p', b'o', b'w', b'_']; diff --git a/substrate/primitives/consensus/sassafras/Cargo.toml b/substrate/primitives/consensus/sassafras/Cargo.toml index b707ad18b5b9..085709d4c8b5 100644 --- a/substrate/primitives/consensus/sassafras/Cargo.toml +++ b/substrate/primitives/consensus/sassafras/Cargo.toml @@ -26,7 +26,6 @@ sp-application-crypto = { path = "../../application-crypto", default-features = sp-consensus-slots = { path = "../slots", default-features = false } sp-core = { path = "../../core", default-features = false, features = ["bandersnatch-experimental"] } sp-runtime = { path = "../../runtime", default-features = false } -sp-std = { path = "../../std", default-features = false } [features] default = ["std"] @@ -39,7 +38,6 @@ std = [ "sp-consensus-slots/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] # Serde support without relying on std features. diff --git a/substrate/primitives/consensus/sassafras/src/digests.rs b/substrate/primitives/consensus/sassafras/src/digests.rs index 5274f1309d82..64190a41ce1c 100644 --- a/substrate/primitives/consensus/sassafras/src/digests.rs +++ b/substrate/primitives/consensus/sassafras/src/digests.rs @@ -25,8 +25,9 @@ use crate::{ use scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; use sp_runtime::{DigestItem, RuntimeDebug}; -use sp_std::vec::Vec; /// Epoch slot claim digest entry. /// diff --git a/substrate/primitives/consensus/sassafras/src/lib.rs b/substrate/primitives/consensus/sassafras/src/lib.rs index 1752f7658863..c1fea74d0452 100644 --- a/substrate/primitives/consensus/sassafras/src/lib.rs +++ b/substrate/primitives/consensus/sassafras/src/lib.rs @@ -21,11 +21,13 @@ #![forbid(unsafe_code, missing_docs, unused_variables, unused_imports)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_core::crypto::KeyTypeId; use sp_runtime::{ConsensusEngineId, RuntimeDebug}; -use sp_std::vec::Vec; pub use sp_consensus_slots::{Slot, SlotDuration}; diff --git a/substrate/primitives/consensus/sassafras/src/vrf.rs b/substrate/primitives/consensus/sassafras/src/vrf.rs index 5deacd8e9945..815edb5eb661 100644 --- a/substrate/primitives/consensus/sassafras/src/vrf.rs +++ b/substrate/primitives/consensus/sassafras/src/vrf.rs @@ -18,9 +18,10 @@ //! Utilities related to VRF input, pre-output and signatures. use crate::{Randomness, TicketBody, TicketId}; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; use scale_codec::Encode; use sp_consensus_slots::Slot; -use sp_std::vec::Vec; pub use sp_core::bandersnatch::{ ring_vrf::{RingProver, RingVerifier, RingVerifierData, RingVrfSignature}, diff --git a/substrate/primitives/consensus/slots/Cargo.toml b/substrate/primitives/consensus/slots/Cargo.toml index 8372b2b04a6b..94c02dba203d 100644 --- a/substrate/primitives/consensus/slots/Cargo.toml +++ b/substrate/primitives/consensus/slots/Cargo.toml @@ -19,7 +19,6 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } serde = { features = ["alloc", "derive"], optional = true, workspace = true } -sp-std = { path = "../../std", default-features = false } sp-timestamp = { path = "../../timestamp", default-features = false } [features] @@ -28,7 +27,6 @@ std = [ "codec/std", "scale-info/std", "serde/std", - "sp-std/std", "sp-timestamp/std", ] diff --git a/substrate/primitives/crypto/ec-utils/Cargo.toml b/substrate/primitives/crypto/ec-utils/Cargo.toml index 43daad089218..142a5abf9b30 100644 --- a/substrate/primitives/crypto/ec-utils/Cargo.toml +++ b/substrate/primitives/crypto/ec-utils/Cargo.toml @@ -28,7 +28,6 @@ ark-ed-on-bls12-377-ext = { version = "0.4.1", default-features = false, optiona ark-ed-on-bls12-377 = { version = "0.4.0", default-features = false, optional = true } ark-scale = { version = "0.0.12", default-features = false, features = ["hazmat"], optional = true } sp-runtime-interface = { path = "../../runtime-interface", default-features = false, optional = true } -sp-std = { path = "../../std", default-features = false, optional = true } [features] default = ["std"] @@ -47,9 +46,8 @@ std = [ "ark-ed-on-bls12-381-bandersnatch?/std", "ark-scale?/std", "sp-runtime-interface?/std", - "sp-std?/std", ] -common = ["ark-ec", "ark-scale", "sp-runtime-interface", "sp-std"] +common = ["ark-ec", "ark-scale", "sp-runtime-interface"] bls12-377 = ["ark-bls12-377", "ark-bls12-377-ext", "common"] bls12-381 = ["ark-bls12-381", "ark-bls12-381-ext", "common"] bw6-761 = ["ark-bw6-761", "ark-bw6-761-ext", "common"] diff --git a/substrate/primitives/crypto/ec-utils/src/bls12_377.rs b/substrate/primitives/crypto/ec-utils/src/bls12_377.rs index 8f19a2c4a191..a1ea5dbbf935 100644 --- a/substrate/primitives/crypto/ec-utils/src/bls12_377.rs +++ b/substrate/primitives/crypto/ec-utils/src/bls12_377.rs @@ -18,10 +18,10 @@ //! *BLS12-377* types and host functions. use crate::utils; +use alloc::vec::Vec; use ark_bls12_377_ext::CurveHooks; use ark_ec::{pairing::Pairing, CurveConfig}; use sp_runtime_interface::runtime_interface; -use sp_std::vec::Vec; /// First pairing group definitions. pub mod g1 { diff --git a/substrate/primitives/crypto/ec-utils/src/bls12_381.rs b/substrate/primitives/crypto/ec-utils/src/bls12_381.rs index 99a0289b7ad2..5e02862ed7ba 100644 --- a/substrate/primitives/crypto/ec-utils/src/bls12_381.rs +++ b/substrate/primitives/crypto/ec-utils/src/bls12_381.rs @@ -18,10 +18,10 @@ //! *BLS12-381* types and host functions. use crate::utils; +use alloc::vec::Vec; use ark_bls12_381_ext::CurveHooks; use ark_ec::{pairing::Pairing, CurveConfig}; use sp_runtime_interface::runtime_interface; -use sp_std::vec::Vec; /// First pairing group definitions. pub mod g1 { diff --git a/substrate/primitives/crypto/ec-utils/src/bw6_761.rs b/substrate/primitives/crypto/ec-utils/src/bw6_761.rs index a68abf6e43e0..4ee1035f670f 100644 --- a/substrate/primitives/crypto/ec-utils/src/bw6_761.rs +++ b/substrate/primitives/crypto/ec-utils/src/bw6_761.rs @@ -18,10 +18,10 @@ //! *BW6-761* types and host functions. use crate::utils; +use alloc::vec::Vec; use ark_bw6_761_ext::CurveHooks; use ark_ec::{pairing::Pairing, CurveConfig}; use sp_runtime_interface::runtime_interface; -use sp_std::vec::Vec; /// First pairing group definitions. pub mod g1 { diff --git a/substrate/primitives/crypto/ec-utils/src/ed_on_bls12_377.rs b/substrate/primitives/crypto/ec-utils/src/ed_on_bls12_377.rs index a03be41b8542..e068507b3473 100644 --- a/substrate/primitives/crypto/ec-utils/src/ed_on_bls12_377.rs +++ b/substrate/primitives/crypto/ec-utils/src/ed_on_bls12_377.rs @@ -18,10 +18,10 @@ //! *Ed-on-BLS12-377* types and host functions. use crate::utils; +use alloc::vec::Vec; use ark_ec::CurveConfig; use ark_ed_on_bls12_377_ext::CurveHooks; use sp_runtime_interface::runtime_interface; -use sp_std::vec::Vec; /// Curve hooks jumping into [`host_calls`] host functions. #[derive(Copy, Clone)] diff --git a/substrate/primitives/crypto/ec-utils/src/ed_on_bls12_381_bandersnatch.rs b/substrate/primitives/crypto/ec-utils/src/ed_on_bls12_381_bandersnatch.rs index 9d63f3587652..487ad98dac65 100644 --- a/substrate/primitives/crypto/ec-utils/src/ed_on_bls12_381_bandersnatch.rs +++ b/substrate/primitives/crypto/ec-utils/src/ed_on_bls12_381_bandersnatch.rs @@ -19,10 +19,10 @@ //! computationally expensive operations. use crate::utils; +use alloc::vec::Vec; use ark_ec::CurveConfig; use ark_ed_on_bls12_381_bandersnatch_ext::CurveHooks; use sp_runtime_interface::runtime_interface; -use sp_std::vec::Vec; /// Curve hooks jumping into [`host_calls`] host functions. #[derive(Copy, Clone)] diff --git a/substrate/primitives/crypto/ec-utils/src/lib.rs b/substrate/primitives/crypto/ec-utils/src/lib.rs index 970ad71765a5..3254bbe648f4 100644 --- a/substrate/primitives/crypto/ec-utils/src/lib.rs +++ b/substrate/primitives/crypto/ec-utils/src/lib.rs @@ -32,6 +32,8 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "bls12-377")] pub mod bls12_377; #[cfg(feature = "bls12-381")] diff --git a/substrate/primitives/crypto/ec-utils/src/utils.rs b/substrate/primitives/crypto/ec-utils/src/utils.rs index d0dd8ed8131c..47a49fe16cc2 100644 --- a/substrate/primitives/crypto/ec-utils/src/utils.rs +++ b/substrate/primitives/crypto/ec-utils/src/utils.rs @@ -21,6 +21,7 @@ // curve may be excluded by the build we resort to `#[allow(unused)]` to // suppress the expected warning. +use alloc::vec::Vec; use ark_ec::{ pairing::{MillerLoopOutput, Pairing}, short_weierstrass::{Affine as SWAffine, Projective as SWProjective, SWCurveConfig}, @@ -31,7 +32,6 @@ use ark_scale::{ ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Compress, Validate}, scale::{Decode, Encode}, }; -use sp_std::vec::Vec; // SCALE encoding parameters shared by all the enabled modules const SCALE_USAGE: u8 = ark_scale::make_usage(Compress::No, Validate::No); diff --git a/substrate/primitives/externalities/Cargo.toml b/substrate/primitives/externalities/Cargo.toml index 6dc4f0a0dadf..20fa3e3e397c 100644 --- a/substrate/primitives/externalities/Cargo.toml +++ b/substrate/primitives/externalities/Cargo.toml @@ -19,9 +19,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } environmental = { version = "1.1.3", default-features = false } -sp-std = { path = "../std", default-features = false } sp-storage = { path = "../storage", default-features = false } [features] default = ["std"] -std = ["codec/std", "environmental/std", "sp-std/std", "sp-storage/std"] +std = ["codec/std", "environmental/std", "sp-storage/std"] diff --git a/substrate/primitives/externalities/src/extensions.rs b/substrate/primitives/externalities/src/extensions.rs index d99dfe6cf530..a4aa847a1aa8 100644 --- a/substrate/primitives/externalities/src/extensions.rs +++ b/substrate/primitives/externalities/src/extensions.rs @@ -23,10 +23,12 @@ //! It is required that each extension implements the [`Extension`] trait. use crate::Error; -use sp_std::{ - any::{Any, TypeId}, +use alloc::{ boxed::Box, collections::btree_map::{BTreeMap, Entry}, +}; +use core::{ + any::{Any, TypeId}, ops::DerefMut, }; diff --git a/substrate/primitives/externalities/src/lib.rs b/substrate/primitives/externalities/src/lib.rs index 411ec97a6b82..142200f614a6 100644 --- a/substrate/primitives/externalities/src/lib.rs +++ b/substrate/primitives/externalities/src/lib.rs @@ -25,11 +25,10 @@ //! //! This crate exposes the main [`Externalities`] trait. -use sp_std::{ - any::{Any, TypeId}, - boxed::Box, - vec::Vec, -}; +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; +use core::any::{Any, TypeId}; use sp_storage::{ChildInfo, StateVersion, TrackedStorageKey}; diff --git a/substrate/primitives/genesis-builder/Cargo.toml b/substrate/primitives/genesis-builder/Cargo.toml index 15440b4811ec..5a8f1c2962ce 100644 --- a/substrate/primitives/genesis-builder/Cargo.toml +++ b/substrate/primitives/genesis-builder/Cargo.toml @@ -18,9 +18,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] sp-api = { path = "../api", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } serde_json = { features = ["alloc", "arbitrary_precision"], workspace = true } [features] default = ["std"] -std = ["serde_json/std", "sp-api/std", "sp-runtime/std", "sp-std/std"] +std = ["serde_json/std", "sp-api/std", "sp-runtime/std"] diff --git a/substrate/primitives/genesis-builder/src/lib.rs b/substrate/primitives/genesis-builder/src/lib.rs index bb1a2a352488..4970042187ce 100644 --- a/substrate/primitives/genesis-builder/src/lib.rs +++ b/substrate/primitives/genesis-builder/src/lib.rs @@ -31,6 +31,8 @@ //! allows to catch and build the raw storage of `RuntimeGenesisConfig` which is the foundation for //! genesis block. +extern crate alloc; + /// The result type alias, used in build methods. `Err` contains formatted error message. pub type Result = core::result::Result<(), sp_runtime::RuntimeString>; @@ -41,7 +43,7 @@ sp_api::decl_runtime_apis! { /// /// This function instantiates the default `RuntimeGenesisConfig` struct for the runtime and serializes it into a JSON /// blob. It returns a `Vec` containing the JSON representation of the default `RuntimeGenesisConfig`. - fn create_default_config() -> sp_std::vec::Vec; + fn create_default_config() -> alloc::vec::Vec; /// Build `RuntimeGenesisConfig` from a JSON blob not using any defaults and store it in the storage. /// @@ -50,6 +52,6 @@ sp_api::decl_runtime_apis! { /// It is recommended to log any errors encountered during the process. /// /// Please note that provided json blob must contain all `RuntimeGenesisConfig` fields, no defaults will be used. - fn build_config(json: sp_std::vec::Vec) -> Result; + fn build_config(json: alloc::vec::Vec) -> Result; } } diff --git a/substrate/primitives/inherents/Cargo.toml b/substrate/primitives/inherents/Cargo.toml index bfb1d7733471..6463c423fe7b 100644 --- a/substrate/primitives/inherents/Cargo.toml +++ b/substrate/primitives/inherents/Cargo.toml @@ -23,7 +23,6 @@ scale-info = { version = "2.10.0", default-features = false, features = ["derive impl-trait-for-tuples = "0.2.2" thiserror = { optional = true, workspace = true } sp-runtime = { path = "../runtime", default-features = false, optional = true } -sp-std = { path = "../std", default-features = false } [dev-dependencies] futures = "0.3.21" @@ -35,6 +34,5 @@ std = [ "codec/std", "scale-info/std", "sp-runtime/std", - "sp-std/std", "thiserror", ] diff --git a/substrate/primitives/inherents/src/lib.rs b/substrate/primitives/inherents/src/lib.rs index dd7c294f1e24..80787669856f 100644 --- a/substrate/primitives/inherents/src/lib.rs +++ b/substrate/primitives/inherents/src/lib.rs @@ -162,9 +162,11 @@ #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] +extern crate alloc; + use codec::{Decode, Encode}; -use sp_std::{ +use alloc::{ collections::btree_map::{BTreeMap, Entry, IntoIter}, vec::Vec, }; diff --git a/substrate/primitives/merkle-mountain-range/Cargo.toml b/substrate/primitives/merkle-mountain-range/Cargo.toml index 50d847782394..9c07f699b37a 100644 --- a/substrate/primitives/merkle-mountain-range/Cargo.toml +++ b/substrate/primitives/merkle-mountain-range/Cargo.toml @@ -24,7 +24,6 @@ sp-api = { path = "../api", default-features = false } sp-core = { path = "../core", default-features = false } sp-debug-derive = { path = "../debug-derive", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } thiserror = { optional = true, workspace = true } [dev-dependencies] @@ -43,7 +42,6 @@ std = [ "sp-core/std", "sp-debug-derive/std", "sp-runtime/std", - "sp-std/std", ] # Serde support without relying on std features. diff --git a/substrate/primitives/merkle-mountain-range/src/lib.rs b/substrate/primitives/merkle-mountain-range/src/lib.rs index 6c0e75005ead..c76d66bb08ea 100644 --- a/substrate/primitives/merkle-mountain-range/src/lib.rs +++ b/substrate/primitives/merkle-mountain-range/src/lib.rs @@ -20,14 +20,16 @@ #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] +extern crate alloc; + pub use mmr_lib; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; +use core::fmt; use scale_info::TypeInfo; use sp_debug_derive::RuntimeDebug; use sp_runtime::traits; -use sp_std::fmt; -#[cfg(not(feature = "std"))] -use sp_std::prelude::Vec; pub mod utils; @@ -248,10 +250,10 @@ impl DataOrHash { pub struct Compact { /// Internal tuple representation. pub tuple: T, - _hash: sp_std::marker::PhantomData, + _hash: core::marker::PhantomData, } -impl sp_std::ops::Deref for Compact { +impl core::ops::Deref for Compact { type Target = T; fn deref(&self) -> &Self::Target { diff --git a/substrate/primitives/merkle-mountain-range/src/utils.rs b/substrate/primitives/merkle-mountain-range/src/utils.rs index b9171c96a620..72674e24a272 100644 --- a/substrate/primitives/merkle-mountain-range/src/utils.rs +++ b/substrate/primitives/merkle-mountain-range/src/utils.rs @@ -20,9 +20,9 @@ use codec::Encode; use mmr_lib::helper; -use sp_runtime::traits::{CheckedAdd, CheckedSub, Header, One}; #[cfg(not(feature = "std"))] -use sp_std::prelude::Vec; +use alloc::vec::Vec; +use sp_runtime::traits::{CheckedAdd, CheckedSub, Header, One}; use crate::{Error, LeafIndex, NodeIndex}; @@ -131,7 +131,7 @@ impl NodesUtils { /// Used for nodes added by now finalized blocks. /// Never read keys using `node_canon_offchain_key` unless you sure that /// there's no `node_offchain_key` key in the storage. - pub fn node_canon_offchain_key(prefix: &[u8], pos: NodeIndex) -> sp_std::prelude::Vec { + pub fn node_canon_offchain_key(prefix: &[u8], pos: NodeIndex) -> alloc::vec::Vec { (prefix, pos).encode() } } diff --git a/substrate/primitives/metadata-ir/Cargo.toml b/substrate/primitives/metadata-ir/Cargo.toml index e4203d0e378e..31c839b5c485 100644 --- a/substrate/primitives/metadata-ir/Cargo.toml +++ b/substrate/primitives/metadata-ir/Cargo.toml @@ -19,8 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } frame-metadata = { version = "16.0.0", default-features = false, features = ["current"] } scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -sp-std = { path = "../std", default-features = false } [features] default = ["std"] -std = ["codec/std", "frame-metadata/std", "scale-info/std", "sp-std/std"] +std = ["codec/std", "frame-metadata/std", "scale-info/std"] diff --git a/substrate/primitives/metadata-ir/src/lib.rs b/substrate/primitives/metadata-ir/src/lib.rs index edfa58f86189..18b20f2ccaac 100644 --- a/substrate/primitives/metadata-ir/src/lib.rs +++ b/substrate/primitives/metadata-ir/src/lib.rs @@ -20,6 +20,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] +extern crate alloc; + // Re-export. #[doc(hidden)] pub use frame_metadata; @@ -52,8 +54,8 @@ pub fn into_version(metadata: MetadataIR, version: u32) -> Option sp_std::vec::Vec { - sp_std::vec![V14, V15] +pub fn supported_versions() -> alloc::vec::Vec { + alloc::vec![V14, V15] } /// Transform the IR to the latest stable metadata version. diff --git a/substrate/primitives/mixnet/Cargo.toml b/substrate/primitives/mixnet/Cargo.toml index 39cf684b9772..8ba7f36da43c 100644 --- a/substrate/primitives/mixnet/Cargo.toml +++ b/substrate/primitives/mixnet/Cargo.toml @@ -20,7 +20,6 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } sp-api = { default-features = false, path = "../api" } sp-application-crypto = { default-features = false, path = "../application-crypto" } -sp-std = { default-features = false, path = "../std" } [features] default = ["std"] @@ -29,5 +28,4 @@ std = [ "scale-info/std", "sp-api/std", "sp-application-crypto/std", - "sp-std/std", ] diff --git a/substrate/primitives/mixnet/src/lib.rs b/substrate/primitives/mixnet/src/lib.rs index 58b8a10f0cd8..462d7fc61f21 100644 --- a/substrate/primitives/mixnet/src/lib.rs +++ b/substrate/primitives/mixnet/src/lib.rs @@ -20,5 +20,7 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub mod runtime_api; pub mod types; diff --git a/substrate/primitives/mixnet/src/runtime_api.rs b/substrate/primitives/mixnet/src/runtime_api.rs index 28ab40e63378..f3260782b0b9 100644 --- a/substrate/primitives/mixnet/src/runtime_api.rs +++ b/substrate/primitives/mixnet/src/runtime_api.rs @@ -18,7 +18,7 @@ //! Runtime API for querying mixnet configuration and registering mixnodes. use super::types::{Mixnode, MixnodesErr, SessionIndex, SessionStatus}; -use sp_std::vec::Vec; +use alloc::vec::Vec; sp_api::decl_runtime_apis! { /// API to query the mixnet session status and mixnode sets, and to register mixnodes. diff --git a/substrate/primitives/mixnet/src/types.rs b/substrate/primitives/mixnet/src/types.rs index fc214f94d1cb..3b069e1fb3ad 100644 --- a/substrate/primitives/mixnet/src/types.rs +++ b/substrate/primitives/mixnet/src/types.rs @@ -17,9 +17,9 @@ //! Mixnet types used by both host and runtime. +use alloc::vec::Vec; use codec::{Decode, Encode}; use scale_info::TypeInfo; -use sp_std::vec::Vec; mod app { use sp_application_crypto::{app_crypto, key_types::MIXNET, sr25519}; @@ -90,8 +90,8 @@ pub enum MixnodesErr { }, } -impl sp_std::fmt::Display for MixnodesErr { - fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { +impl core::fmt::Display for MixnodesErr { + fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { match self { MixnodesErr::InsufficientRegistrations { num, min } => write!(fmt, "{num} mixnode(s) registered; {min} is the minimum"), diff --git a/substrate/primitives/npos-elections/Cargo.toml b/substrate/primitives/npos-elections/Cargo.toml index 7373aa849cb8..b0b9890c0619 100644 --- a/substrate/primitives/npos-elections/Cargo.toml +++ b/substrate/primitives/npos-elections/Cargo.toml @@ -22,7 +22,6 @@ serde = { features = ["alloc", "derive"], optional = true, workspace = true } sp-arithmetic = { path = "../arithmetic", default-features = false } sp-core = { path = "../core", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } [dev-dependencies] rand = "0.8.5" @@ -38,7 +37,6 @@ std = [ "sp-arithmetic/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] # Serde support without relying on std features. diff --git a/substrate/primitives/npos-elections/src/assignments.rs b/substrate/primitives/npos-elections/src/assignments.rs index 2ac2b9bebd77..0686fdda643b 100644 --- a/substrate/primitives/npos-elections/src/assignments.rs +++ b/substrate/primitives/npos-elections/src/assignments.rs @@ -18,6 +18,7 @@ //! Structs and helpers for distributing a voter's stake among various winners. use crate::{ExtendedBalance, IdentifierT, PerThing128}; +use alloc::vec::Vec; #[cfg(feature = "serde")] use codec::{Decode, Encode}; use sp_arithmetic::{ @@ -25,7 +26,6 @@ use sp_arithmetic::{ Normalizable, PerThing, }; use sp_core::RuntimeDebug; -use sp_std::vec::Vec; /// A voter's stake assignment among a set of targets, represented as ratios. #[derive(RuntimeDebug, Clone, Default)] diff --git a/substrate/primitives/npos-elections/src/balancing.rs b/substrate/primitives/npos-elections/src/balancing.rs index 90dbe7eb7147..fb14c8686581 100644 --- a/substrate/primitives/npos-elections/src/balancing.rs +++ b/substrate/primitives/npos-elections/src/balancing.rs @@ -27,8 +27,8 @@ //! See [`balance`] for more information. use crate::{BalancingConfig, Edge, ExtendedBalance, IdentifierT, Voter}; +use alloc::vec::Vec; use sp_arithmetic::traits::Zero; -use sp_std::prelude::*; /// Balance the weight distribution of a given `voters` at most `iterations` times, or up until the /// point where the biggest difference created per iteration of all stakes is `tolerance`. If this diff --git a/substrate/primitives/npos-elections/src/helpers.rs b/substrate/primitives/npos-elections/src/helpers.rs index 082491ea0428..7df6ec9d9dba 100644 --- a/substrate/primitives/npos-elections/src/helpers.rs +++ b/substrate/primitives/npos-elections/src/helpers.rs @@ -18,8 +18,8 @@ //! Helper methods for npos-elections. use crate::{Assignment, Error, IdentifierT, PerThing128, StakedAssignment, VoteWeight}; +use alloc::vec::Vec; use sp_arithmetic::PerThing; -use sp_std::prelude::*; /// Converts a vector of ratio assignments into ones with absolute budget value. /// diff --git a/substrate/primitives/npos-elections/src/lib.rs b/substrate/primitives/npos-elections/src/lib.rs index 8d741f4130d9..82ac40fe2737 100644 --- a/substrate/primitives/npos-elections/src/lib.rs +++ b/substrate/primitives/npos-elections/src/lib.rs @@ -74,15 +74,16 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{collections::btree_map::BTreeMap, rc::Rc, vec, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; +use core::{cell::RefCell, cmp::Ordering}; use scale_info::TypeInfo; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use sp_arithmetic::{traits::Zero, Normalizable, PerThing, Rational128, ThresholdOrd}; use sp_core::{bounded::BoundedVec, RuntimeDebug}; -use sp_std::{ - cell::RefCell, cmp::Ordering, collections::btree_map::BTreeMap, prelude::*, rc::Rc, vec, -}; #[cfg(test)] mod mock; @@ -198,7 +199,7 @@ impl ElectionScore { } } -impl sp_std::cmp::Ord for ElectionScore { +impl core::cmp::Ord for ElectionScore { fn cmp(&self, other: &Self) -> Ordering { // we delegate this to the lexicographic cmp of slices`, and to incorporate that we want the // third element to be minimized, we swap them. @@ -210,7 +211,7 @@ impl sp_std::cmp::Ord for ElectionScore { } } -impl sp_std::cmp::PartialOrd for ElectionScore { +impl core::cmp::PartialOrd for ElectionScore { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } @@ -278,8 +279,8 @@ impl Edge { } #[cfg(feature = "std")] -impl sp_std::fmt::Debug for Edge { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for Edge { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "Edge({:?}, weight = {:?})", self.who, self.weight) } } @@ -299,7 +300,7 @@ pub struct Voter { #[cfg(feature = "std")] impl std::fmt::Debug for Voter { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "Voter({:?}, budget = {}, edges = {:?})", self.who, self.budget, self.edges) } } diff --git a/substrate/primitives/npos-elections/src/mock.rs b/substrate/primitives/npos-elections/src/mock.rs index 2fc49fd72cd0..91757404145f 100644 --- a/substrate/primitives/npos-elections/src/mock.rs +++ b/substrate/primitives/npos-elections/src/mock.rs @@ -19,12 +19,12 @@ #![cfg(test)] +use alloc::collections::btree_map::BTreeMap; use sp_arithmetic::{ traits::{One, SaturatedConversion, Zero}, PerThing, }; use sp_runtime::assert_eq_error_rate; -use sp_std::collections::btree_map::BTreeMap; use crate::{seq_phragmen, Assignment, ElectionResult, ExtendedBalance, PerThing128, VoteWeight}; @@ -131,7 +131,7 @@ where if let Some(winner) = candidates .iter_mut() .filter(|c| !c.elected) - .min_by(|x, y| x.score.partial_cmp(&y.score).unwrap_or(sp_std::cmp::Ordering::Equal)) + .min_by(|x, y| x.score.partial_cmp(&y.score).unwrap_or(core::cmp::Ordering::Equal)) { winner.elected = true; for n in &mut voters { @@ -226,10 +226,10 @@ where if backing_backed_stake.len() > 0 { let max_stake = backing_backed_stake .iter() - .max_by(|x, y| x.partial_cmp(&y).unwrap_or(sp_std::cmp::Ordering::Equal)) + .max_by(|x, y| x.partial_cmp(&y).unwrap_or(core::cmp::Ordering::Equal)) .expect("vector with positive length will have a max; qed"); let min_stake = backed_stakes_iter - .min_by(|x, y| x.partial_cmp(&y).unwrap_or(sp_std::cmp::Ordering::Equal)) + .min_by(|x, y| x.partial_cmp(&y).unwrap_or(core::cmp::Ordering::Equal)) .expect("iterator with positive length will have a min; qed"); difference = max_stake - min_stake; @@ -254,7 +254,7 @@ where support_map .get(&x.0) .and_then(|x| support_map.get(&y.0).and_then(|y| x.total.partial_cmp(&y.total))) - .unwrap_or(sp_std::cmp::Ordering::Equal) + .unwrap_or(core::cmp::Ordering::Equal) }); let mut cumulative_stake = 0.0; diff --git a/substrate/primitives/npos-elections/src/node.rs b/substrate/primitives/npos-elections/src/node.rs index caca9561d839..6fe50ad1d0ac 100644 --- a/substrate/primitives/npos-elections/src/node.rs +++ b/substrate/primitives/npos-elections/src/node.rs @@ -17,7 +17,8 @@ //! (very) Basic implementation of a graph node used in the reduce algorithm. -use sp_std::{cell::RefCell, fmt, prelude::*, rc::Rc}; +use alloc::{rc::Rc, vec::Vec}; +use core::{cell::RefCell, fmt}; /// The role that a node can accept. #[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Debug)] @@ -49,8 +50,8 @@ impl NodeId { } #[cfg(feature = "std")] -impl sp_std::fmt::Debug for NodeId { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl fmt::Debug for NodeId { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "Node({:?}, {:?})", diff --git a/substrate/primitives/npos-elections/src/phragmen.rs b/substrate/primitives/npos-elections/src/phragmen.rs index c3578065f364..f331152e722a 100644 --- a/substrate/primitives/npos-elections/src/phragmen.rs +++ b/substrate/primitives/npos-elections/src/phragmen.rs @@ -24,12 +24,12 @@ use crate::{ balancing, setup_inputs, BalancingConfig, CandidatePtr, ElectionResult, ExtendedBalance, IdentifierT, PerThing128, VoteWeight, Voter, }; +use alloc::vec::Vec; use sp_arithmetic::{ helpers_128bit::multiply_by_rational_with_rounding, traits::{Bounded, Zero}, Rational128, Rounding, }; -use sp_std::prelude::*; /// The denominator used for loads. Since votes are collected as u64, the smallest ratio that we /// might collect is `1/approval_stake` where approval stake is the sum of votes. Hence, some number diff --git a/substrate/primitives/npos-elections/src/phragmms.rs b/substrate/primitives/npos-elections/src/phragmms.rs index df6becf47472..9a17f0dfa7ce 100644 --- a/substrate/primitives/npos-elections/src/phragmms.rs +++ b/substrate/primitives/npos-elections/src/phragmms.rs @@ -25,8 +25,8 @@ use crate::{ balance, setup_inputs, BalancingConfig, CandidatePtr, ElectionResult, ExtendedBalance, IdentifierT, PerThing128, VoteWeight, Voter, }; +use alloc::{rc::Rc, vec, vec::Vec}; use sp_arithmetic::{traits::Bounded, PerThing, Rational128}; -use sp_std::{prelude::*, rc::Rc}; /// Execute the phragmms method. /// @@ -232,8 +232,8 @@ pub(crate) fn apply_elected( mod tests { use super::*; use crate::{Assignment, ElectionResult}; + use alloc::rc::Rc; use sp_runtime::{Perbill, Percent}; - use sp_std::rc::Rc; #[test] fn basic_election_manual_works() { diff --git a/substrate/primitives/npos-elections/src/pjr.rs b/substrate/primitives/npos-elections/src/pjr.rs index f0e59a25d440..08e40a014eab 100644 --- a/substrate/primitives/npos-elections/src/pjr.rs +++ b/substrate/primitives/npos-elections/src/pjr.rs @@ -26,8 +26,8 @@ use crate::{ Candidate, CandidatePtr, Edge, ExtendedBalance, IdentifierT, Support, SupportMap, Supports, VoteWeight, Voter, }; +use alloc::{collections::btree_map::BTreeMap, rc::Rc, vec::Vec}; use sp_arithmetic::{traits::Zero, Perbill}; -use sp_std::{collections::btree_map::BTreeMap, rc::Rc, vec::Vec}; /// The type used as the threshold. /// /// Just some reading sugar; Must always be same as [`ExtendedBalance`]; diff --git a/substrate/primitives/npos-elections/src/reduce.rs b/substrate/primitives/npos-elections/src/reduce.rs index 6a5a0159e4ef..c9ed493daf30 100644 --- a/substrate/primitives/npos-elections/src/reduce.rs +++ b/substrate/primitives/npos-elections/src/reduce.rs @@ -51,11 +51,12 @@ use crate::{ node::{Node, NodeId, NodeRef, NodeRole}, ExtendedBalance, IdentifierT, StakedAssignment, }; -use sp_arithmetic::traits::{Bounded, Zero}; -use sp_std::{ +use alloc::{ collections::btree_map::{BTreeMap, Entry::*}, - prelude::*, + vec, + vec::Vec, }; +use sp_arithmetic::traits::{Bounded, Zero}; /// Map type used for reduce_4. Can be easily swapped with HashMap. type Map = BTreeMap<(A, A), A>; diff --git a/substrate/primitives/npos-elections/src/traits.rs b/substrate/primitives/npos-elections/src/traits.rs index d49970873b70..afa6ac70880a 100644 --- a/substrate/primitives/npos-elections/src/traits.rs +++ b/substrate/primitives/npos-elections/src/traits.rs @@ -18,8 +18,8 @@ //! Traits for the npos-election operations. use crate::ExtendedBalance; +use core::{fmt::Debug, ops::Mul}; use sp_arithmetic::PerThing; -use sp_std::{fmt::Debug, ops::Mul, prelude::*}; /// an aggregator trait for a generic type of a voter/target identifier. This usually maps to /// substrate's account id. diff --git a/substrate/primitives/session/Cargo.toml b/substrate/primitives/session/Cargo.toml index 99764c0a17f9..784228c42e9b 100644 --- a/substrate/primitives/session/Cargo.toml +++ b/substrate/primitives/session/Cargo.toml @@ -22,7 +22,6 @@ sp-api = { path = "../api", default-features = false } sp-core = { path = "../core", default-features = false } sp-runtime = { path = "../runtime", optional = true } sp-staking = { path = "../staking", default-features = false } -sp-std = { path = "../std", default-features = false } sp-keystore = { path = "../keystore", optional = true } [features] @@ -35,5 +34,4 @@ std = [ "sp-keystore/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", ] diff --git a/substrate/primitives/session/src/lib.rs b/substrate/primitives/session/src/lib.rs index 9933495fd601..fe7a38047338 100644 --- a/substrate/primitives/session/src/lib.rs +++ b/substrate/primitives/session/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use codec::{Decode, Encode}; #[cfg(feature = "std")] @@ -26,9 +28,9 @@ use sp_api::ProvideRuntimeApi; #[cfg(feature = "std")] use sp_runtime::traits::Block as BlockT; +use alloc::vec::Vec; use sp_core::RuntimeDebug; use sp_staking::SessionIndex; -use sp_std::vec::Vec; pub mod runtime_api; pub use runtime_api::*; diff --git a/substrate/primitives/session/src/runtime_api.rs b/substrate/primitives/session/src/runtime_api.rs index 5e508cd3dbd3..3acc882aabcf 100644 --- a/substrate/primitives/session/src/runtime_api.rs +++ b/substrate/primitives/session/src/runtime_api.rs @@ -15,8 +15,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use alloc::vec::Vec; pub use sp_core::crypto::KeyTypeId; -use sp_std::prelude::*; sp_api::decl_runtime_apis! { /// Session keys runtime api. diff --git a/substrate/primitives/staking/Cargo.toml b/substrate/primitives/staking/Cargo.toml index 21346fbaca53..6304551b8e60 100644 --- a/substrate/primitives/staking/Cargo.toml +++ b/substrate/primitives/staking/Cargo.toml @@ -23,7 +23,6 @@ impl-trait-for-tuples = "0.2.2" sp-core = { path = "../core", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } [features] default = ["std"] @@ -33,6 +32,5 @@ std = [ "serde/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = ["sp-runtime/runtime-benchmarks"] diff --git a/substrate/primitives/staking/src/lib.rs b/substrate/primitives/staking/src/lib.rs index f5b4a1ed63fb..11b7ef41b9a7 100644 --- a/substrate/primitives/staking/src/lib.rs +++ b/substrate/primitives/staking/src/lib.rs @@ -20,14 +20,17 @@ //! A crate which contains primitives that are useful for implementation that uses staking //! approaches in general. Definitions related to sessions, slashing, etc go here. +extern crate alloc; + use crate::currency_to_vote::CurrencyToVote; +use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec}; use codec::{Decode, Encode, FullCodec, HasCompact, MaxEncodedLen}; +use core::ops::Sub; use scale_info::TypeInfo; use sp_runtime::{ traits::{AtLeast32BitUnsigned, Zero}, DispatchError, DispatchResult, RuntimeDebug, Saturating, }; -use sp_std::{collections::btree_map::BTreeMap, ops::Sub, vec, vec::Vec}; pub mod offence; @@ -172,7 +175,7 @@ pub trait StakingInterface { + Saturating; /// AccountId type used by the staking system. - type AccountId: Clone + sp_std::fmt::Debug; + type AccountId: Clone + core::fmt::Debug; /// Means of converting Currency to VoteWeight. type CurrencyToVote: CurrencyToVote; diff --git a/substrate/primitives/staking/src/offence.rs b/substrate/primitives/staking/src/offence.rs index 8013166374e0..64aa4692eb59 100644 --- a/substrate/primitives/staking/src/offence.rs +++ b/substrate/primitives/staking/src/offence.rs @@ -18,10 +18,10 @@ //! Common traits and types that are useful for describing offences for usage in environments //! that use staking. +use alloc::vec::Vec; use codec::{Decode, Encode}; use sp_core::Get; use sp_runtime::{transaction_validity::TransactionValidityError, DispatchError, Perbill}; -use sp_std::vec::Vec; use crate::SessionIndex; diff --git a/substrate/primitives/state-machine/Cargo.toml b/substrate/primitives/state-machine/Cargo.toml index 09994f1ae91e..aaedb500b59c 100644 --- a/substrate/primitives/state-machine/Cargo.toml +++ b/substrate/primitives/state-machine/Cargo.toml @@ -28,7 +28,6 @@ tracing = { version = "0.1.29", optional = true } sp-core = { path = "../core", default-features = false } sp-externalities = { path = "../externalities", default-features = false } sp-panic-handler = { path = "../panic-handler", optional = true } -sp-std = { path = "../std", default-features = false } sp-trie = { path = "../trie", default-features = false } trie-db = { version = "0.28.0", default-features = false } @@ -51,7 +50,6 @@ std = [ "sp-externalities/std", "sp-panic-handler", "sp-runtime/std", - "sp-std/std", "sp-trie/std", "thiserror", "tracing", diff --git a/substrate/primitives/state-machine/src/backend.rs b/substrate/primitives/state-machine/src/backend.rs index ea9cd442d70b..90be55d58a4e 100644 --- a/substrate/primitives/state-machine/src/backend.rs +++ b/substrate/primitives/state-machine/src/backend.rs @@ -23,13 +23,13 @@ use crate::{ trie_backend_essence::TrieBackendStorage, ChildStorageCollection, StorageCollection, StorageKey, StorageValue, UsageInfo, }; +use alloc::vec::Vec; use codec::Encode; use core::marker::PhantomData; use hash_db::Hasher; use sp_core::storage::{ChildInfo, StateVersion, TrackedStorageKey}; #[cfg(feature = "std")] use sp_core::traits::RuntimeCode; -use sp_std::vec::Vec; use sp_trie::{MerkleValue, PrefixedMemoryDB}; /// A struct containing arguments for iterating over the storage. @@ -179,7 +179,7 @@ pub type BackendTransaction = PrefixedMemoryDB; /// to it. /// /// The clone operation (if implemented) should be cheap. -pub trait Backend: sp_std::fmt::Debug { +pub trait Backend: core::fmt::Debug { /// An error type when fetching data is not possible. type Error: super::Error; diff --git a/substrate/primitives/state-machine/src/ext.rs b/substrate/primitives/state-machine/src/ext.rs index 11df46f2a4a3..73110f55cba2 100644 --- a/substrate/primitives/state-machine/src/ext.rs +++ b/substrate/primitives/state-machine/src/ext.rs @@ -32,12 +32,10 @@ use sp_core::storage::{ use sp_externalities::{Extension, ExtensionStore, Externalities, MultiRemovalResults}; use crate::{log_error, trace, warn}; -use sp_std::{ +use alloc::{boxed::Box, vec, vec::Vec}; +use core::{ any::{Any, TypeId}, - boxed::Box, cmp::Ordering, - vec, - vec::Vec, }; #[cfg(feature = "std")] use std::error; @@ -739,7 +737,7 @@ impl<'a> StorageAppend<'a> { pub fn append(&mut self, value: Vec) { let value = vec![EncodeOpaqueValue(value)]; - let item = sp_std::mem::take(self.0); + let item = core::mem::take(self.0); *self.0 = match Vec::::append_or_new(item, &value) { Ok(item) => item, diff --git a/substrate/primitives/state-machine/src/lib.rs b/substrate/primitives/state-machine/src/lib.rs index 5909a30a814c..200cebe68de5 100644 --- a/substrate/primitives/state-machine/src/lib.rs +++ b/substrate/primitives/state-machine/src/lib.rs @@ -20,6 +20,8 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub mod backend; #[cfg(feature = "std")] mod basic; @@ -118,8 +120,8 @@ pub type DefaultError = String; pub struct DefaultError; #[cfg(not(feature = "std"))] -impl sp_std::fmt::Display for DefaultError { - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { +impl core::fmt::Display for DefaultError { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "DefaultError") } } diff --git a/substrate/primitives/state-machine/src/overlayed_changes/changeset.rs b/substrate/primitives/state-machine/src/overlayed_changes/changeset.rs index 59589dbbb37e..a25a5b810522 100644 --- a/substrate/primitives/state-machine/src/overlayed_changes/changeset.rs +++ b/substrate/primitives/state-machine/src/overlayed_changes/changeset.rs @@ -20,16 +20,14 @@ use super::{Extrinsics, StorageKey, StorageValue}; #[cfg(not(feature = "std"))] -use sp_std::collections::btree_set::BTreeSet as Set; +use alloc::collections::btree_set::BTreeSet as Set; #[cfg(feature = "std")] use std::collections::HashSet as Set; use crate::warn; +use alloc::collections::{btree_map::BTreeMap, btree_set::BTreeSet}; +use core::hash::Hash; use smallvec::SmallVec; -use sp_std::{ - collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - hash::Hash, -}; const PROOF_OVERLAY_NON_EMPTY: &str = "\ An OverlayValue is always created with at least one transaction and dropped as soon @@ -225,7 +223,7 @@ impl OverlayedMap { /// This changeset might be created when there are already open transactions. /// We need to catch up here so that the child is at the same transaction depth. pub fn spawn_child(&self) -> Self { - use sp_std::iter::repeat; + use core::iter::repeat; Self { changes: Default::default(), dirty_keys: repeat(Set::new()).take(self.transaction_depth()).collect(), @@ -242,7 +240,7 @@ impl OverlayedMap { /// Get an optional reference to the value stored for the specified key. pub fn get(&self, key: &Q) -> Option<&OverlayedEntry> where - K: sp_std::borrow::Borrow, + K: core::borrow::Borrow, Q: Ord + ?Sized, { self.changes.get(key) @@ -448,7 +446,7 @@ impl OverlayedChangeSet { /// Get the iterator over all changes that follow the supplied `key`. pub fn changes_after(&self, key: &[u8]) -> impl Iterator { - use sp_std::ops::Bound; + use core::ops::Bound; let range = (Bound::Excluded(key), Bound::Unbounded); self.changes.range::<[u8], _>(range).map(|(k, v)| (k.as_slice(), v)) } diff --git a/substrate/primitives/state-machine/src/overlayed_changes/mod.rs b/substrate/primitives/state-machine/src/overlayed_changes/mod.rs index 626cf6c3cafe..039631e4a630 100644 --- a/substrate/primitives/state-machine/src/overlayed_changes/mod.rs +++ b/substrate/primitives/state-machine/src/overlayed_changes/mod.rs @@ -22,6 +22,7 @@ mod offchain; use self::changeset::OverlayedChangeSet; use crate::{backend::Backend, stats::StateMachineStats, BackendTransaction, DefaultError}; +use alloc::{collections::btree_set::BTreeSet, vec::Vec}; use codec::{Decode, Encode}; use hash_db::Hasher; pub use offchain::OffchainOverlayedChanges; @@ -31,12 +32,13 @@ use sp_core::{ }; #[cfg(feature = "std")] use sp_externalities::{Extension, Extensions}; -#[cfg(not(feature = "std"))] -use sp_std::collections::btree_map::BTreeMap as Map; -use sp_std::{collections::btree_set::BTreeSet, vec::Vec}; use sp_trie::{empty_child_trie_root, LayoutV1}; + +#[cfg(not(feature = "std"))] +use alloc::collections::btree_map::BTreeMap as Map; #[cfg(feature = "std")] use std::collections::{hash_map::Entry as MapEntry, HashMap as Map}; + #[cfg(feature = "std")] use std::{ any::{Any, TypeId}, @@ -136,7 +138,7 @@ impl Clone for OverlayedChanges { } } -impl sp_std::fmt::Debug for OverlayedChanges { +impl core::fmt::Debug for OverlayedChanges { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("OverlayedChanges") .field("top", &self.top) @@ -259,7 +261,7 @@ impl Clone for StorageTransactionCache { } } -impl sp_std::fmt::Debug for StorageTransactionCache { +impl core::fmt::Debug for StorageTransactionCache { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut debug = f.debug_struct("StorageTransactionCache"); @@ -572,7 +574,7 @@ impl OverlayedChanges { }, }; - use sp_std::mem::take; + use core::mem::take; let main_storage_changes = take(&mut self.top).drain_commited(); let child_storage_changes = take(&mut self.children) .into_iter() @@ -777,7 +779,7 @@ where K: Ord, F: FnMut(&K, &mut V) -> bool, { - let old = sp_std::mem::replace(map, Map::default()); + let old = core::mem::replace(map, Map::default()); for (k, mut v) in old.into_iter() { if f(&k, &mut v) { map.insert(k, v); diff --git a/substrate/primitives/state-machine/src/overlayed_changes/offchain.rs b/substrate/primitives/state-machine/src/overlayed_changes/offchain.rs index 66e7ab5864c0..1e6965e87475 100644 --- a/substrate/primitives/state-machine/src/overlayed_changes/offchain.rs +++ b/substrate/primitives/state-machine/src/overlayed_changes/offchain.rs @@ -18,8 +18,8 @@ //! Overlayed changes for offchain indexing. use super::changeset::OverlayedMap; +use alloc::vec::Vec; use sp_core::offchain::OffchainOverlayedChange; -use sp_std::prelude::Vec; /// In-memory storage for offchain workers recoding changes for the actual offchain storage /// implementation. @@ -48,7 +48,7 @@ impl OffchainOverlayedChanges { /// Drain all elements of changeset. pub fn drain(&mut self) -> impl Iterator { - sp_std::mem::take(self).into_iter() + core::mem::take(self).into_iter() } /// Remove a key and its associated value from the offchain database. diff --git a/substrate/primitives/state-machine/src/trie_backend.rs b/substrate/primitives/state-machine/src/trie_backend.rs index 7496463e6421..f91ce5d2e52f 100644 --- a/substrate/primitives/state-machine/src/trie_backend.rs +++ b/substrate/primitives/state-machine/src/trie_backend.rs @@ -297,7 +297,7 @@ struct CachedIter where H: Hasher, { - last_key: sp_std::vec::Vec, + last_key: alloc::vec::Vec, iter: RawIter, } @@ -390,9 +390,9 @@ where } impl, H: Hasher, C: TrieCacheProvider, R: TrieRecorderProvider> - sp_std::fmt::Debug for TrieBackend + core::fmt::Debug for TrieBackend { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "TrieBackend") } } diff --git a/substrate/primitives/state-machine/src/trie_backend_essence.rs b/substrate/primitives/state-machine/src/trie_backend_essence.rs index 3f789111deef..1824a77c3704 100644 --- a/substrate/primitives/state-machine/src/trie_backend_essence.rs +++ b/substrate/primitives/state-machine/src/trie_backend_essence.rs @@ -23,14 +23,15 @@ use crate::{ trie_backend::TrieCacheProvider, warn, StorageKey, StorageValue, }; +#[cfg(feature = "std")] +use alloc::sync::Arc; +use alloc::{boxed::Box, vec::Vec}; use codec::Codec; +use core::marker::PhantomData; use hash_db::{self, AsHashDB, HashDB, HashDBRef, Hasher, Prefix}; #[cfg(feature = "std")] use parking_lot::RwLock; use sp_core::storage::{ChildInfo, ChildType, StateVersion}; -#[cfg(feature = "std")] -use sp_std::sync::Arc; -use sp_std::{boxed::Box, marker::PhantomData, vec::Vec}; use sp_trie::{ child_delta_trie_root, delta_trie_root, empty_child_trie_root, read_child_trie_first_descedant_value, read_child_trie_hash, read_child_trie_value, @@ -55,7 +56,7 @@ macro_rules! format { }; } -type Result = sp_std::result::Result; +type Result = core::result::Result; /// Patricia trie-based storage trait. pub trait Storage: Send + Sync { diff --git a/substrate/primitives/statement-store/Cargo.toml b/substrate/primitives/statement-store/Cargo.toml index 652ab3ef13aa..000fcd987040 100644 --- a/substrate/primitives/statement-store/Cargo.toml +++ b/substrate/primitives/statement-store/Cargo.toml @@ -21,7 +21,6 @@ scale-info = { version = "2.10.0", default-features = false, features = ["derive sp-core = { path = "../core", default-features = false } sp-crypto-hashing = { path = "../crypto/hashing", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } sp-api = { path = "../api", default-features = false } sp-application-crypto = { path = "../application-crypto", default-features = false } sp-runtime-interface = { path = "../runtime-interface", default-features = false } @@ -57,7 +56,6 @@ std = [ "sp-externalities/std", "sp-runtime-interface/std", "sp-runtime/std", - "sp-std/std", "thiserror", "x25519-dalek", ] diff --git a/substrate/primitives/statement-store/src/lib.rs b/substrate/primitives/statement-store/src/lib.rs index 04175f6d6160..bfcd0d1a52a2 100644 --- a/substrate/primitives/statement-store/src/lib.rs +++ b/substrate/primitives/statement-store/src/lib.rs @@ -20,13 +20,15 @@ //! A crate which contains statement-store primitives. +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_application_crypto::RuntimeAppPublic; #[cfg(feature = "std")] use sp_core::Pair; use sp_runtime_interface::pass_by::PassByCodec; -use sp_std::vec::Vec; /// Statement topic. pub type Topic = [u8; 32]; diff --git a/substrate/primitives/statement-store/src/runtime_api.rs b/substrate/primitives/statement-store/src/runtime_api.rs index 13f88bc977e9..4d25576c801f 100644 --- a/substrate/primitives/statement-store/src/runtime_api.rs +++ b/substrate/primitives/statement-store/src/runtime_api.rs @@ -18,11 +18,11 @@ //! Runtime support for the statement store. use crate::{Hash, Statement, Topic}; +use alloc::vec::Vec; use codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; use sp_runtime_interface::{pass_by::PassByEnum, runtime_interface}; -use sp_std::vec::Vec; #[cfg(feature = "std")] use sp_externalities::ExternalitiesExt; diff --git a/substrate/primitives/storage/Cargo.toml b/substrate/primitives/storage/Cargo.toml index d3ade87ea47f..acedc8d00049 100644 --- a/substrate/primitives/storage/Cargo.toml +++ b/substrate/primitives/storage/Cargo.toml @@ -22,7 +22,6 @@ impl-serde = { version = "0.4.0", optional = true, default-features = false } ref-cast = "1.0.0" serde = { features = ["alloc", "derive"], optional = true, workspace = true } sp-debug-derive = { path = "../debug-derive", default-features = false } -sp-std = { path = "../std", default-features = false } [features] default = ["std"] @@ -31,7 +30,6 @@ std = [ "impl-serde/std", "serde/std", "sp-debug-derive/std", - "sp-std/std", ] # Serde support without relying on std features. diff --git a/substrate/primitives/storage/src/lib.rs b/substrate/primitives/storage/src/lib.rs index 79c090cabf8d..b55cc8f21740 100644 --- a/substrate/primitives/storage/src/lib.rs +++ b/substrate/primitives/storage/src/lib.rs @@ -19,18 +19,19 @@ #![cfg_attr(not(feature = "std"), no_std)] -use core::fmt::Display; +extern crate alloc; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use sp_debug_derive::RuntimeDebug; +use alloc::vec::Vec; use codec::{Decode, Encode}; -use ref_cast::RefCast; -use sp_std::{ +use core::{ + fmt::Display, ops::{Deref, DerefMut}, - vec::Vec, }; +use ref_cast::RefCast; /// Storage key. #[derive(PartialEq, Eq, RuntimeDebug)] @@ -49,9 +50,7 @@ impl AsRef<[u8]> for StorageKey { } /// Storage key with read/write tracking information. -#[derive( - PartialEq, Eq, Ord, PartialOrd, sp_std::hash::Hash, RuntimeDebug, Clone, Encode, Decode, -)] +#[derive(PartialEq, Eq, Ord, PartialOrd, core::hash::Hash, RuntimeDebug, Clone, Encode, Decode)] pub struct TrackedStorageKey { pub key: Vec, pub reads: u32, @@ -441,7 +440,7 @@ impl From for u8 { impl TryFrom for StateVersion { type Error = (); - fn try_from(val: u8) -> sp_std::result::Result { + fn try_from(val: u8) -> core::result::Result { match val { 0 => Ok(StateVersion::V0), 1 => Ok(StateVersion::V1), diff --git a/substrate/primitives/test-primitives/Cargo.toml b/substrate/primitives/test-primitives/Cargo.toml index f310216dd58d..1b51c5f59190 100644 --- a/substrate/primitives/test-primitives/Cargo.toml +++ b/substrate/primitives/test-primitives/Cargo.toml @@ -21,7 +21,6 @@ serde = { features = ["derive"], optional = true, workspace = true } sp-application-crypto = { path = "../application-crypto", default-features = false } sp-core = { path = "../core", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } [features] default = ["std"] @@ -32,7 +31,6 @@ std = [ "sp-application-crypto/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] # Serde support without relying on std features. diff --git a/substrate/primitives/test-primitives/src/lib.rs b/substrate/primitives/test-primitives/src/lib.rs index 82bdb6967b84..1e3b912eaf48 100644 --- a/substrate/primitives/test-primitives/src/lib.rs +++ b/substrate/primitives/test-primitives/src/lib.rs @@ -19,14 +19,16 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use codec::{Decode, Encode}; pub use sp_application_crypto; use sp_application_crypto::sr25519; +use alloc::vec::Vec; pub use sp_core::{hash::H256, RuntimeDebug}; use sp_runtime::traits::{BlakeTwo256, Extrinsic as ExtrinsicT, Verify}; -use sp_std::vec::Vec; /// Extrinsic for test-runtime. #[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] diff --git a/substrate/primitives/timestamp/Cargo.toml b/substrate/primitives/timestamp/Cargo.toml index 9e2b802bfb15..11afb1755908 100644 --- a/substrate/primitives/timestamp/Cargo.toml +++ b/substrate/primitives/timestamp/Cargo.toml @@ -21,7 +21,6 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = thiserror = { optional = true, workspace = true } sp-inherents = { path = "../inherents", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } [features] default = ["std"] @@ -30,6 +29,5 @@ std = [ "codec/std", "sp-inherents/std", "sp-runtime/std", - "sp-std/std", "thiserror", ] diff --git a/substrate/primitives/tracing/Cargo.toml b/substrate/primitives/tracing/Cargo.toml index 58b1e48c4622..368f8c096dd4 100644 --- a/substrate/primitives/tracing/Cargo.toml +++ b/substrate/primitives/tracing/Cargo.toml @@ -21,7 +21,6 @@ features = ["with-tracing"] targets = ["wasm32-unknown-unknown", "x86_64-unknown-linux-gnu"] [dependencies] -sp-std = { path = "../std", default-features = false } codec = { version = "3.6.1", package = "parity-scale-codec", default-features = false, features = [ "derive", ] } @@ -36,7 +35,6 @@ default = ["std"] with-tracing = ["codec/derive", "codec/full"] std = [ "codec/std", - "sp-std/std", "tracing-core/std", "tracing-subscriber", "tracing/std", diff --git a/substrate/primitives/tracing/src/lib.rs b/substrate/primitives/tracing/src/lib.rs index cc6518368466..b8b99230db57 100644 --- a/substrate/primitives/tracing/src/lib.rs +++ b/substrate/primitives/tracing/src/lib.rs @@ -37,6 +37,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "std")] use tracing; pub use tracing::{ diff --git a/substrate/primitives/tracing/src/types.rs b/substrate/primitives/tracing/src/types.rs index 003787f310d8..3692a81e03c8 100644 --- a/substrate/primitives/tracing/src/types.rs +++ b/substrate/primitives/tracing/src/types.rs @@ -15,11 +15,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; /// Types for wasm based tracing. Loosly inspired by `tracing-core` but /// optimised for the specific use case. use core::{fmt::Debug, format_args}; -use sp_std::{vec, vec::Vec, Writer}; /// The Tracing Level – the user can filter by this #[derive(Clone, Encode, Decode, Debug)] @@ -132,9 +132,9 @@ impl From for WasmValue { impl From> for WasmValue { fn from(inp: core::fmt::Arguments<'_>) -> WasmValue { - let mut buf = Writer::default(); + let mut buf = alloc::string::String::default(); core::fmt::write(&mut buf, inp).expect("Writing of arguments doesn't fail"); - WasmValue::Formatted(buf.into_inner()) + WasmValue::Formatted(buf.into_bytes()) } } diff --git a/substrate/primitives/transaction-pool/src/lib.rs b/substrate/primitives/transaction-pool/src/lib.rs index 431f429e29f9..2ce735491b2c 100644 --- a/substrate/primitives/transaction-pool/src/lib.rs +++ b/substrate/primitives/transaction-pool/src/lib.rs @@ -20,4 +20,6 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub mod runtime_api; diff --git a/substrate/primitives/transaction-storage-proof/Cargo.toml b/substrate/primitives/transaction-storage-proof/Cargo.toml index e2fb54dafdf1..fbd0a4752fca 100644 --- a/substrate/primitives/transaction-storage-proof/Cargo.toml +++ b/substrate/primitives/transaction-storage-proof/Cargo.toml @@ -22,7 +22,6 @@ scale-info = { version = "2.10.0", default-features = false, features = ["derive sp-core = { path = "../core", optional = true } sp-inherents = { path = "../inherents", default-features = false } sp-runtime = { path = "../runtime", default-features = false } -sp-std = { path = "../std", default-features = false } sp-trie = { path = "../trie", optional = true } [features] @@ -34,6 +33,5 @@ std = [ "sp-core/std", "sp-inherents/std", "sp-runtime/std", - "sp-std/std", "sp-trie/std", ] diff --git a/substrate/primitives/transaction-storage-proof/src/lib.rs b/substrate/primitives/transaction-storage-proof/src/lib.rs index 9d540ae68d16..352f2aec26ee 100644 --- a/substrate/primitives/transaction-storage-proof/src/lib.rs +++ b/substrate/primitives/transaction-storage-proof/src/lib.rs @@ -20,8 +20,11 @@ #![cfg_attr(not(feature = "std"), no_std)] -use sp_std::{prelude::*, result::Result}; +extern crate alloc; +use core::result::Result; + +use alloc::vec::Vec; use codec::{Decode, Encode}; use sp_inherents::{InherentData, InherentIdentifier, IsFatalError}; use sp_runtime::traits::{Block as BlockT, NumberFor}; diff --git a/substrate/primitives/trie/Cargo.toml b/substrate/primitives/trie/Cargo.toml index 16d3ca19a179..dd7ab080e5f4 100644 --- a/substrate/primitives/trie/Cargo.toml +++ b/substrate/primitives/trie/Cargo.toml @@ -35,7 +35,6 @@ tracing = { version = "0.1.29", optional = true } trie-db = { version = "0.28.0", default-features = false } trie-root = { version = "0.18.0", default-features = false } sp-core = { path = "../core", default-features = false } -sp-std = { path = "../std", default-features = false } sp-externalities = { path = "../externalities", default-features = false } schnellru = { version = "0.2.1", optional = true } @@ -62,7 +61,6 @@ std = [ "sp-core/std", "sp-externalities/std", "sp-runtime/std", - "sp-std/std", "thiserror", "tracing", "trie-db/std", diff --git a/substrate/primitives/trie/src/error.rs b/substrate/primitives/trie/src/error.rs index 17be556d3489..e3986e50b08e 100644 --- a/substrate/primitives/trie/src/error.rs +++ b/substrate/primitives/trie/src/error.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use sp_std::{boxed::Box, vec::Vec}; +use alloc::{boxed::Box, vec::Vec}; /// Error type used for trie related errors. #[derive(Debug, PartialEq, Eq, Clone)] diff --git a/substrate/primitives/trie/src/lib.rs b/substrate/primitives/trie/src/lib.rs index fd1320b3fbcb..81b37a0c9a6c 100644 --- a/substrate/primitives/trie/src/lib.rs +++ b/substrate/primitives/trie/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "std")] pub mod cache; mod error; @@ -33,6 +35,8 @@ mod trie_stream; #[cfg(feature = "std")] pub mod proof_size_extension; +use alloc::{borrow::Borrow, boxed::Box, vec, vec::Vec}; +use core::marker::PhantomData; /// Our `NodeCodec`-specific error. pub use error::Error; /// Various re-exports from the `hash-db` crate. @@ -42,7 +46,6 @@ use hash_db::{Hasher, Prefix}; pub use memory_db::{prefixed_key, HashKey, KeyFunction, PrefixedKey}; /// The Substrate format implementation of `NodeCodec`. pub use node_codec::NodeCodec; -use sp_std::{borrow::Borrow, boxed::Box, marker::PhantomData, vec::Vec}; pub use storage_proof::{CompactProof, StorageProof}; /// Trie codec reexport, mainly child trie support /// for trie compact proof. @@ -500,7 +503,7 @@ pub struct KeySpacedDBMut<'a, DB: ?Sized, H>(&'a mut DB, &'a [u8], PhantomData (Vec, Option) { - let mut result = sp_std::vec![0; ks.len() + prefix.0.len()]; + let mut result = vec![0; ks.len() + prefix.0.len()]; result[..ks.len()].copy_from_slice(ks); result[ks.len()..].copy_from_slice(prefix.0); (result, prefix.1) diff --git a/substrate/primitives/trie/src/node_codec.rs b/substrate/primitives/trie/src/node_codec.rs index 46acde77c054..78896988ec4c 100644 --- a/substrate/primitives/trie/src/node_codec.rs +++ b/substrate/primitives/trie/src/node_codec.rs @@ -19,9 +19,10 @@ use super::node_header::{NodeHeader, NodeKind}; use crate::{error::Error, trie_constants}; +use alloc::{borrow::Borrow, vec::Vec}; use codec::{Compact, Decode, Encode, Input}; +use core::{marker::PhantomData, ops::Range}; use hash_db::Hasher; -use sp_std::{borrow::Borrow, marker::PhantomData, ops::Range, vec::Vec}; use trie_db::{ nibble_ops, node::{NibbleSlicePlan, NodeHandlePlan, NodePlan, Value, ValuePlan}, @@ -30,7 +31,7 @@ use trie_db::{ /// Helper struct for trie node decoder. This implements `codec::Input` on a byte slice, while /// tracking the absolute position. This is similar to `std::io::Cursor` but does not implement -/// `Read` and `io` is not in `sp-std`. +/// `Read` and `io` are not in `core` or `alloc`. struct ByteSliceInput<'a> { data: &'a [u8], offset: usize, diff --git a/substrate/primitives/trie/src/storage_proof.rs b/substrate/primitives/trie/src/storage_proof.rs index 6c871d73b043..e46c49be19cb 100644 --- a/substrate/primitives/trie/src/storage_proof.rs +++ b/substrate/primitives/trie/src/storage_proof.rs @@ -15,14 +15,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +use alloc::{collections::btree_set::BTreeSet, vec::Vec}; use codec::{Decode, Encode}; +use core::iter::{DoubleEndedIterator, IntoIterator}; use hash_db::{HashDB, Hasher}; use scale_info::TypeInfo; -use sp_std::{ - collections::btree_set::BTreeSet, - iter::{DoubleEndedIterator, IntoIterator}, - vec::Vec, -}; + // Note that `LayoutV1` usage here (proof compaction) is compatible // with `LayoutV0`. use crate::LayoutV1 as Layout; diff --git a/substrate/primitives/trie/src/trie_codec.rs b/substrate/primitives/trie/src/trie_codec.rs index f29e009c4761..65b4f5053599 100644 --- a/substrate/primitives/trie/src/trie_codec.rs +++ b/substrate/primitives/trie/src/trie_codec.rs @@ -21,7 +21,7 @@ //! it to substrate specific layout and child trie system. use crate::{CompactProof, HashDBT, TrieConfiguration, TrieHash, EMPTY_PREFIX}; -use sp_std::{boxed::Box, vec::Vec}; +use alloc::{boxed::Box, vec::Vec}; use trie_db::{CError, Trie}; /// Error for trie node decoding. diff --git a/substrate/primitives/trie/src/trie_stream.rs b/substrate/primitives/trie/src/trie_stream.rs index f57b80f978ff..459b5895f207 100644 --- a/substrate/primitives/trie/src/trie_stream.rs +++ b/substrate/primitives/trie/src/trie_stream.rs @@ -21,9 +21,9 @@ use crate::{ node_header::{size_and_prefix_iterator, NodeKind}, trie_constants, }; +use alloc::vec::Vec; use codec::{Compact, Encode}; use hash_db::Hasher; -use sp_std::vec::Vec; use trie_root; /// Codec-flavored TrieStream. diff --git a/substrate/primitives/wasm-interface/Cargo.toml b/substrate/primitives/wasm-interface/Cargo.toml index f7d1038903ea..6c051b71c8e0 100644 --- a/substrate/primitives/wasm-interface/Cargo.toml +++ b/substrate/primitives/wasm-interface/Cargo.toml @@ -22,9 +22,8 @@ impl-trait-for-tuples = "0.2.2" log = { optional = true, workspace = true, default-features = true } wasmtime = { version = "8.0.1", default-features = false, optional = true } anyhow = { version = "1.0.68", optional = true } -sp-std = { path = "../std", default-features = false } [features] default = ["std"] -std = ["codec/std", "log/std", "sp-std/std", "wasmtime"] +std = ["codec/std", "log/std", "wasmtime"] wasmtime = ["anyhow", "dep:wasmtime"] diff --git a/substrate/primitives/wasm-interface/src/lib.rs b/substrate/primitives/wasm-interface/src/lib.rs index 9d5d2bb358d5..4fc78ca15535 100644 --- a/substrate/primitives/wasm-interface/src/lib.rs +++ b/substrate/primitives/wasm-interface/src/lib.rs @@ -19,7 +19,10 @@ #![cfg_attr(not(feature = "std"), no_std)] -use sp_std::{borrow::Cow, iter::Iterator, marker::PhantomData, mem, result, vec, vec::Vec}; +extern crate alloc; + +use alloc::{borrow::Cow, vec, vec::Vec}; +use core::{iter::Iterator, marker::PhantomData, mem, result}; #[cfg(not(all(feature = "std", feature = "wasmtime")))] #[macro_export] @@ -76,7 +79,7 @@ impl From for u8 { impl TryFrom for ValueType { type Error = (); - fn try_from(val: u8) -> sp_std::result::Result { + fn try_from(val: u8) -> core::result::Result { match val { 0 => Ok(Self::I32), 1 => Ok(Self::I64), diff --git a/substrate/primitives/weights/Cargo.toml b/substrate/primitives/weights/Cargo.toml index a7d61de001b5..d3118defb58d 100644 --- a/substrate/primitives/weights/Cargo.toml +++ b/substrate/primitives/weights/Cargo.toml @@ -23,7 +23,6 @@ serde = { optional = true, features = ["alloc", "derive"], workspace = true } smallvec = "1.11.0" sp-arithmetic = { path = "../arithmetic", default-features = false } sp-debug-derive = { path = "../debug-derive", default-features = false } -sp-std = { path = "../std", default-features = false } schemars = { version = "0.8.3", default-features = false, optional = true } [features] @@ -35,7 +34,6 @@ std = [ "serde/std", "sp-arithmetic/std", "sp-debug-derive/std", - "sp-std/std", ] # By default some types have documentation, `full-metadata-docs` allows to add documentation to # more types in the metadata. diff --git a/substrate/test-utils/runtime/Cargo.toml b/substrate/test-utils/runtime/Cargo.toml index b6e6346e8017..f49503da8ca5 100644 --- a/substrate/test-utils/runtime/Cargo.toml +++ b/substrate/test-utils/runtime/Cargo.toml @@ -28,7 +28,6 @@ sp-keyring = { path = "../../primitives/keyring", default-features = false } sp-offchain = { path = "../../primitives/offchain", default-features = false } sp-core = { path = "../../primitives/core", default-features = false, features = ["serde"] } sp-crypto-hashing = { path = "../../primitives/crypto/hashing", default-features = false } -sp-std = { path = "../../primitives/std", default-features = false } sp-io = { path = "../../primitives/io", default-features = false } frame-support = { path = "../../frame/support", default-features = false } sp-version = { path = "../../primitives/version", default-features = false } @@ -104,7 +103,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-state-machine/std", - "sp-std/std", "sp-tracing/std", "sp-transaction-pool/std", "sp-trie/std", diff --git a/substrate/test-utils/runtime/src/extrinsic.rs b/substrate/test-utils/runtime/src/extrinsic.rs index 05ffb7db5d5b..e355e5d099ad 100644 --- a/substrate/test-utils/runtime/src/extrinsic.rs +++ b/substrate/test-utils/runtime/src/extrinsic.rs @@ -26,7 +26,6 @@ use frame_system::{CheckNonce, CheckWeight}; use sp_core::crypto::Pair as TraitPair; use sp_keyring::AccountKeyring; use sp_runtime::{transaction_validity::TransactionPriority, Perbill}; -use sp_std::prelude::*; /// Transfer used in test substrate pallet. Extrinsic is created and signed using this data. #[derive(Clone)] diff --git a/substrate/test-utils/runtime/src/lib.rs b/substrate/test-utils/runtime/src/lib.rs index 9270978cd126..7148d2b2fc0f 100644 --- a/substrate/test-utils/runtime/src/lib.rs +++ b/substrate/test-utils/runtime/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "std")] pub mod extrinsic; #[cfg(feature = "std")] @@ -42,9 +44,10 @@ use frame_system::{ CheckNonce, CheckWeight, }; use scale_info::TypeInfo; -use sp_std::prelude::*; + +use alloc::boxed::Box; #[cfg(not(feature = "std"))] -use sp_std::vec; +use alloc::{vec, vec::Vec}; use sp_application_crypto::{ecdsa, ed25519, sr25519, RuntimeAppPublic}; use sp_core::{OpaqueMetadata, RuntimeDebug}; @@ -265,7 +268,7 @@ impl sp_runtime::traits::SignedExtension for CheckSubstrateCall { fn additional_signed( &self, - ) -> sp_std::result::Result { + ) -> core::result::Result { Ok(()) } @@ -440,7 +443,7 @@ fn code_using_trie() -> u64 { .to_vec(); let mut mdb = PrefixedMemoryDB::default(); - let mut root = sp_std::default::Default::default(); + let mut root = core::default::Default::default(); { let mut t = TrieDBMutBuilderV1::::new(&mut mdb, &mut root).build(); for (key, value) in &pairs { @@ -494,7 +497,7 @@ impl_runtime_apis! { fn metadata_at_version(_version: u32) -> Option { unimplemented!() } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { unimplemented!() } } diff --git a/substrate/test-utils/runtime/src/substrate_test_pallet.rs b/substrate/test-utils/runtime/src/substrate_test_pallet.rs index ed1ad990472b..8375a68c8ff2 100644 --- a/substrate/test-utils/runtime/src/substrate_test_pallet.rs +++ b/substrate/test-utils/runtime/src/substrate_test_pallet.rs @@ -21,6 +21,7 @@ //! functioning runtime. Some calls are allowed to be submitted as unsigned extrinsics, however most //! of them requires signing. Refer to `pallet::Call` for further details. +use alloc::{vec, vec::Vec}; use frame_support::{pallet_prelude::*, storage}; use sp_core::sr25519::Public; use sp_runtime::{ @@ -29,7 +30,6 @@ use sp_runtime::{ InvalidTransaction, TransactionSource, TransactionValidity, ValidTransaction, }, }; -use sp_std::prelude::*; pub use self::pallet::*; @@ -59,7 +59,7 @@ pub mod pallet { pub struct GenesisConfig { pub authorities: Vec, #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] From 816c072abd99947e466e611cd96fa0db918f1854 Mon Sep 17 00:00:00 2001 From: K Gunjan Date: Mon, 18 Mar 2024 15:57:48 +0530 Subject: [PATCH 6/9] Pallet AURA: remove pallet::getter macro and write the corresponding code (#3350) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed the `pallet::getter` macro call from storage type definitions and added the corresponding implementations directly. fixes #3330 polkadot address: 14JzTPPUd8x8phKi8qLxHgNTnTMg6DUukCLXoWprejkaHXPz --------- Co-authored-by: Bastian Köcher --- cumulus/pallets/aura-ext/src/lib.rs | 6 ++-- .../assets/asset-hub-rococo/src/lib.rs | 2 +- .../assets/asset-hub-westend/src/lib.rs | 2 +- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 2 +- .../bridge-hubs/bridge-hub-westend/src/lib.rs | 2 +- .../collectives-westend/src/lib.rs | 2 +- .../contracts/contracts-rococo/src/lib.rs | 2 +- .../coretime/coretime-rococo/src/lib.rs | 2 +- .../coretime/coretime-westend/src/lib.rs | 2 +- .../glutton/glutton-westend/src/lib.rs | 2 +- .../runtimes/people/people-rococo/src/lib.rs | 2 +- .../runtimes/people/people-westend/src/lib.rs | 2 +- .../runtimes/starters/seedling/src/lib.rs | 2 +- .../runtimes/starters/shell/src/lib.rs | 2 +- .../runtimes/testing/penpal/src/lib.rs | 2 +- .../testing/rococo-parachain/src/lib.rs | 2 +- prdoc/pr_3350.prdoc | 31 +++++++++++++++++++ substrate/frame/aura/src/lib.rs | 12 +++---- substrate/frame/aura/src/tests.rs | 7 +++-- templates/parachain/runtime/src/lib.rs | 4 ++- templates/solochain/runtime/src/lib.rs | 2 +- 21 files changed, 62 insertions(+), 30 deletions(-) create mode 100644 prdoc/pr_3350.prdoc diff --git a/cumulus/pallets/aura-ext/src/lib.rs b/cumulus/pallets/aura-ext/src/lib.rs index 31b571816a0c..b71ae628954c 100644 --- a/cumulus/pallets/aura-ext/src/lib.rs +++ b/cumulus/pallets/aura-ext/src/lib.rs @@ -63,14 +63,14 @@ pub mod pallet { impl Hooks> for Pallet { fn on_finalize(_: BlockNumberFor) { // Update to the latest AuRa authorities. - Authorities::::put(Aura::::authorities()); + Authorities::::put(pallet_aura::Authorities::::get()); } fn on_initialize(_: BlockNumberFor) -> Weight { // Fetch the authorities once to get them into the storage proof of the PoV. Authorities::::get(); - let new_slot = Aura::::current_slot(); + let new_slot = pallet_aura::CurrentSlot::::get(); let (new_slot, authored) = match SlotInfo::::get() { Some((slot, authored)) if slot == new_slot => (slot, authored + 1), @@ -116,7 +116,7 @@ pub mod pallet { #[pallet::genesis_build] impl BuildGenesisConfig for GenesisConfig { fn build(&self) { - let authorities = Aura::::authorities(); + let authorities = pallet_aura::Authorities::::get(); Authorities::::put(authorities); } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index e6b5e55bcd3a..d3d8a495ea3f 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -1067,7 +1067,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 1ba108234c8e..711fadff92a0 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1098,7 +1098,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 31069778e386..bbafcd3c7ddd 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -790,7 +790,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index d96c762fe19d..11ab9aecc617 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -540,7 +540,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index 5bf3519ac3d2..55269283e081 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs @@ -777,7 +777,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index f148ceadccba..17bb45f6b1b8 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -440,7 +440,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index 6efbdde58997..26add2ee9424 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -495,7 +495,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index 2bb179b5b056..76732c3fccc7 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -486,7 +486,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs index e7fdb53b2531..fe18f48fbb3c 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs @@ -353,7 +353,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index 98f76984dd45..2bb5641b4af0 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -469,7 +469,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index 5adbdc1f38cc..b81f7a9c9695 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -469,7 +469,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/starters/seedling/src/lib.rs b/cumulus/parachains/runtimes/starters/seedling/src/lib.rs index bf4768d8457a..2f4f762408fe 100644 --- a/cumulus/parachains/runtimes/starters/seedling/src/lib.rs +++ b/cumulus/parachains/runtimes/starters/seedling/src/lib.rs @@ -283,7 +283,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/starters/shell/src/lib.rs b/cumulus/parachains/runtimes/starters/shell/src/lib.rs index 51fdfac5b1c1..0f4957fd802b 100644 --- a/cumulus/parachains/runtimes/starters/shell/src/lib.rs +++ b/cumulus/parachains/runtimes/starters/shell/src/lib.rs @@ -340,7 +340,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs index 3063601e030f..1e6d485d148d 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs @@ -688,7 +688,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 753d2d120652..a066cab1b6dc 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -758,7 +758,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } diff --git a/prdoc/pr_3350.prdoc b/prdoc/pr_3350.prdoc new file mode 100644 index 000000000000..1171614d67f6 --- /dev/null +++ b/prdoc/pr_3350.prdoc @@ -0,0 +1,31 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: removed `pallet::getter` from Pallet AURA + +doc: + - audience: Runtime Dev + description: | + This PR removes all the declarations of macro `pallet::getter` in the Pallet AURA and replaces the use of storage getter functions authorities() & current_slot() with `StorageItem::get()` API across the crates as listed bellow. + The purpose is to discourage developers to use this macro, that is currently being removed and soon will be deprecated. + +crates: + - name: pallet-aura + - name: solochain-template-runtime + - name: cumulus-pallet-aura-ext + - name: parachain-template-runtime + - name: people-westend-runtime + - name: people-rococo-runtime + - name: bridge-hub-rococo-runtime + - name: bridge-hub-westend-runtime + - name: rococo-parachain-runtime + - name: penpal-runtime + - name: glutton-westend-runtime + - name: shell-runtime + - name: seedling-runtime + - name: collectives-westend-runtime + - name: asset-hub-rococo-runtime + - name: asset-hub-westend-runtime + - name: contracts-rococo-runtime + - name: coretime-westend-runtime + - name: coretime-rococo-runtime diff --git a/substrate/frame/aura/src/lib.rs b/substrate/frame/aura/src/lib.rs index 55653de97a8b..997f51ba428f 100644 --- a/substrate/frame/aura/src/lib.rs +++ b/substrate/frame/aura/src/lib.rs @@ -161,16 +161,14 @@ pub mod pallet { /// The current authority set. #[pallet::storage] - #[pallet::getter(fn authorities)] - pub(super) type Authorities = + pub type Authorities = StorageValue<_, BoundedVec, ValueQuery>; /// The current slot of this block. /// /// This will be set in `on_initialize`. #[pallet::storage] - #[pallet::getter(fn current_slot)] - pub(super) type CurrentSlot = StorageValue<_, Slot, ValueQuery>; + pub type CurrentSlot = StorageValue<_, Slot, ValueQuery>; #[pallet::genesis_config] #[derive(frame_support::DefaultNoBound)] @@ -318,7 +316,7 @@ impl OneSessionHandler for Pallet { // instant changes if changed { let next_authorities = validators.map(|(_, k)| k).collect::>(); - let last_authorities = Self::authorities(); + let last_authorities = Authorities::::get(); if last_authorities != next_authorities { if next_authorities.len() as u32 > T::MaxAuthorities::get() { log::warn!( @@ -374,7 +372,7 @@ impl> FindAuthor { let i = Inner::find_author(digests)?; - let validators = >::authorities(); + let validators = Authorities::::get(); validators.get(i as usize).cloned() } } @@ -384,7 +382,7 @@ pub type AuraAuthorId = FindAccountFromAuthorIndex>; impl IsMember for Pallet { fn is_member(authority_id: &T::AuthorityId) -> bool { - Self::authorities().iter().any(|id| id == authority_id) + Authorities::::get().iter().any(|id| id == authority_id) } } diff --git a/substrate/frame/aura/src/tests.rs b/substrate/frame/aura/src/tests.rs index b3a5e144fad8..5374105a2f3b 100644 --- a/substrate/frame/aura/src/tests.rs +++ b/substrate/frame/aura/src/tests.rs @@ -19,7 +19,8 @@ #![cfg(test)] -use crate::mock::{build_ext_and_execute_test, Aura, MockDisabledValidators, System}; +use super::pallet; +use crate::mock::{build_ext_and_execute_test, Aura, MockDisabledValidators, System, Test}; use codec::Encode; use frame_support::traits::OnInitialize; use sp_consensus_aura::{Slot, AURA_ENGINE_ID}; @@ -28,8 +29,8 @@ use sp_runtime::{Digest, DigestItem}; #[test] fn initial_values() { build_ext_and_execute_test(vec![0, 1, 2, 3], || { - assert_eq!(Aura::current_slot(), 0u64); - assert_eq!(Aura::authorities().len(), Aura::authorities_len()); + assert_eq!(pallet::CurrentSlot::::get(), 0u64); + assert_eq!(pallet::Authorities::::get().len(), Aura::authorities_len()); assert_eq!(Aura::authorities_len(), 4); }); } diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index acaabc0dbc36..ad21b79a5b1b 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -57,6 +57,8 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; +use pallet_aura::Authorities; + // XCM Imports use xcm::latest::prelude::BodyId; @@ -547,7 +549,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + Authorities::::get().into_inner() } } diff --git a/templates/solochain/runtime/src/lib.rs b/templates/solochain/runtime/src/lib.rs index 9b52ee60a635..5a97bd2f3912 100644 --- a/templates/solochain/runtime/src/lib.rs +++ b/templates/solochain/runtime/src/lib.rs @@ -415,7 +415,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } From 8d0cd4ffc875726f868b122c8b4b9bee4920c71d Mon Sep 17 00:00:00 2001 From: Alexandru Gheorghe <49718502+alexggh@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:45:39 +0200 Subject: [PATCH 7/9] Fix kusama validators getting 0 backing rewards the first session they enter the active set (#3722) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a problem in the way we update `authorithy-discovery` next keys and because of that nodes that enter the active set would be noticed at the start of the session they become active, instead of the start of the previous session as it was intended. This is problematic because: 1. The node itself advertises its addresses on the DHT only when it notices it should become active on around ~10m loop, so in this case it would notice after it becomes active. 2. The other nodes won't be able to detect the new nodes addresses at the beginning of the session, so it won't added them to the reserved set. With 1 + 2, we end-up in a situation where the the new node won't be able to properly connect to its peers because it won't be in its peers reserved set. Now, the nodes accept by default`MIN_GOSSIP_PEERS: usize = 25` connections to nodes that are not in the reserved set, but given Kusama size(> 1000 nodes) you could easily have more than`25` new nodes entering the active set or simply the nodes don't have slots anymore because, they already have connections to peers not in the active set. In the end what the node would notice is 0 backing rewards because it wasn't directly connected to the peers in its backing group. ## Root-cause The flow is like this: 1. At BAD_SESSION - 1, in `rotate_session` new nodes are added to QueuedKeys https://github.com/paritytech/polkadot-sdk/blob/02e1a7f476d7d7c67153e975ab9a1bdc02ffea12/substrate/frame/session/src/lib.rs#L609 ``` >::put(queued_amalgamated.clone()); >::put(next_changed); ``` 2. AuthorityDiscovery::on_new_session is called with `changed` being the value of `>:` at BAD_SESSION - **2** because it was saved before being updated https://github.com/paritytech/polkadot-sdk/blob/02e1a7f476d7d7c67153e975ab9a1bdc02ffea12/substrate/frame/session/src/lib.rs#L613 3. At BAD_SESSION - 1, `AuthorityDiscovery::on_new_session` doesn't updated its next_keys because `changed` was false. 4. For the entire durations of `BAD_SESSION - 1` everyone calling runtime api `authorities`(should return past, present and future authorities) won't discover the nodes that should become active . 5. At the beginning of BAD_SESSION, all nodes discover the new nodes are authorities, but it is already too late because reserved_nodes are updated only at the beginning of the session by the `gossip-support`. See above why this bad. ## Fix Update next keys with the queued_validators at every session, not matter the value of `changed` this is the same way babe pallet correctly does it. https://github.com/paritytech/polkadot-sdk/blob/02e1a7f476d7d7c67153e975ab9a1bdc02ffea12/substrate/frame/babe/src/lib.rs#L655 ## Notes - The issue doesn't reproduce with proof-authorities changes like `versi` because `changed` would always be true and `AuthorityDiscovery` correctly updates its next_keys every time. - Confirmed at session `37651` on kusama that this is exactly what it happens by looking at blocks with polkadot.js. ## TODO - [ ] Move versi on proof of stake and properly test before and after fix to confirm there is no other issue. --------- Signed-off-by: Alexandru Gheorghe Co-authored-by: Bastian Köcher --- prdoc/pr_3722.prdoc | 13 ++++ .../frame/authority-discovery/src/lib.rs | 66 ++++++++++++------- substrate/frame/session/src/lib.rs | 6 +- 3 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 prdoc/pr_3722.prdoc diff --git a/prdoc/pr_3722.prdoc b/prdoc/pr_3722.prdoc new file mode 100644 index 000000000000..7e2d7d38795b --- /dev/null +++ b/prdoc/pr_3722.prdoc @@ -0,0 +1,13 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: Fix kusama 0 backing rewards when entering active set + +doc: + - audience: Runtime Dev + description: | + This PR fixes getting 0 backing rewards the first session when + a node enters the active set. + +crates: + - name: pallet-authority-discovery diff --git a/substrate/frame/authority-discovery/src/lib.rs b/substrate/frame/authority-discovery/src/lib.rs index aa57378934af..ed9240d99e8d 100644 --- a/substrate/frame/authority-discovery/src/lib.rs +++ b/substrate/frame/authority-discovery/src/lib.rs @@ -144,19 +144,21 @@ impl OneSessionHandler for Pallet { ); Keys::::put(bounded_keys); + } - let next_keys = queued_validators.map(|x| x.1).collect::>(); + // `changed` represents if queued_validators changed in the previous session not in the + // current one. + let next_keys = queued_validators.map(|x| x.1).collect::>(); - let next_bounded_keys = WeakBoundedVec::<_, T::MaxAuthorities>::force_from( - next_keys, - Some( - "Warning: The session has more queued validators than expected. \ - A runtime configuration adjustment may be needed.", - ), - ); + let next_bounded_keys = WeakBoundedVec::<_, T::MaxAuthorities>::force_from( + next_keys, + Some( + "Warning: The session has more queued validators than expected. \ + A runtime configuration adjustment may be needed.", + ), + ); - NextKeys::::put(next_bounded_keys); - } + NextKeys::::put(next_bounded_keys); } fn on_disabled(_i: u32) { @@ -270,7 +272,7 @@ mod tests { .map(|id| (&account_id, id)) .collect::>(); - let mut third_authorities: Vec = vec![4, 5] + let third_authorities: Vec = vec![4, 5] .into_iter() .map(|i| AuthorityPair::from_seed_slice(vec![i; 32].as_ref()).unwrap().public()) .map(AuthorityId::from) @@ -282,6 +284,18 @@ mod tests { .map(|id| (&account_id, id)) .collect::>(); + let mut fourth_authorities: Vec = vec![6, 7] + .into_iter() + .map(|i| AuthorityPair::from_seed_slice(vec![i; 32].as_ref()).unwrap().public()) + .map(AuthorityId::from) + .collect(); + // Needed for `pallet_session::OneSessionHandler::on_new_session`. + let fourth_authorities_and_account_ids = fourth_authorities + .clone() + .into_iter() + .map(|id| (&account_id, id)) + .collect::>(); + // Build genesis. let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); @@ -310,25 +324,33 @@ mod tests { third_authorities_and_account_ids.clone().into_iter(), ); let authorities_returned = AuthorityDiscovery::authorities(); + let mut first_and_third_authorities = first_authorities + .iter() + .chain(third_authorities.iter()) + .cloned() + .collect::>(); + first_and_third_authorities.sort(); + assert_eq!( - first_authorities, authorities_returned, + first_and_third_authorities, authorities_returned, "Expected authority set not to change as `changed` was set to false.", ); // When `changed` set to true, the authority set should be updated. AuthorityDiscovery::on_new_session( true, - second_authorities_and_account_ids.into_iter(), - third_authorities_and_account_ids.clone().into_iter(), + third_authorities_and_account_ids.into_iter(), + fourth_authorities_and_account_ids.clone().into_iter(), ); - let mut second_and_third_authorities = second_authorities + + let mut third_and_fourth_authorities = third_authorities .iter() - .chain(third_authorities.iter()) + .chain(fourth_authorities.iter()) .cloned() .collect::>(); - second_and_third_authorities.sort(); + third_and_fourth_authorities.sort(); assert_eq!( - second_and_third_authorities, + third_and_fourth_authorities, AuthorityDiscovery::authorities(), "Expected authority set to contain both the authorities of the new as well as the \ next session." @@ -337,12 +359,12 @@ mod tests { // With overlapping authority sets, `authorities()` should return a deduplicated set. AuthorityDiscovery::on_new_session( true, - third_authorities_and_account_ids.clone().into_iter(), - third_authorities_and_account_ids.clone().into_iter(), + fourth_authorities_and_account_ids.clone().into_iter(), + fourth_authorities_and_account_ids.clone().into_iter(), ); - third_authorities.sort(); + fourth_authorities.sort(); assert_eq!( - third_authorities, + fourth_authorities, AuthorityDiscovery::authorities(), "Expected authority set to be deduplicated." ); diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 7d8128dbc1fe..17b6aa7a4640 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -285,7 +285,11 @@ pub trait SessionHandler { /// before initialization of your pallet. /// /// `changed` is true whenever any of the session keys or underlying economic - /// identities or weightings behind those keys has changed. + /// identities or weightings behind `validators` keys has changed. `queued_validators` + /// could change without `validators` changing. Example of possible sequent calls: + /// Session N: on_new_session(false, unchanged_validators, unchanged_queued_validators) + /// Session N + 1: on_new_session(false, unchanged_validators, new_queued_validators) + /// Session N + 2: on_new_session(true, new_queued_validators, new_queued_validators) fn on_new_session( changed: bool, validators: &[(ValidatorId, Ks)], From 1d60f9ca9ae82621380530a19162652c13106a4f Mon Sep 17 00:00:00 2001 From: jokess123 <163112061+jokess123@users.noreply.github.com> Date: Mon, 18 Mar 2024 20:18:40 +0800 Subject: [PATCH 8/9] Fix typos (#3725) --- polkadot/node/subsystem-bench/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/polkadot/node/subsystem-bench/README.md b/polkadot/node/subsystem-bench/README.md index 94a449ed0bb8..228fba41c46c 100644 --- a/polkadot/node/subsystem-bench/README.md +++ b/polkadot/node/subsystem-bench/README.md @@ -27,7 +27,7 @@ The output binary will be placed in `target/testnet/subsystem-bench`. ### Test metrics Subsystem, CPU usage and network metrics are exposed via a prometheus endpoint during the test execution. -A small subset of these collected metrics are displayed in the CLI, but for an in depth analysys of the test results, +A small subset of these collected metrics are displayed in the CLI, but for an in depth analysis of the test results, a local Grafana/Prometheus stack is needed. ### Run Prometheus, Pyroscope and Graphana in Docker @@ -122,7 +122,7 @@ target/testnet/subsystem-bench polkadot/node/subsystem-bench/examples/availabili ``` Note: test objectives may be wrapped up into a test sequence. -It is tipically used to run a suite of tests like in this [example](examples/availability_read.yaml). +It is typically used to run a suite of tests like in this [example](examples/availability_read.yaml). ### Understanding the test configuration @@ -137,13 +137,13 @@ usage: From the perspective of the subsystem under test, this means that it will receive an `ActiveLeavesUpdate` signal followed by an arbitrary amount of messages. This process repeats itself for `num_blocks`. The messages are generally -test payloads pre-generated before the test run, or constructed on pre-genereated payloads. For example the +test payloads pre-generated before the test run, or constructed on pre-generated payloads. For example the `AvailabilityRecoveryMessage::RecoverAvailableData` message includes a `CandidateReceipt` which is generated before the test is started. ### Example run -Let's run an availabilty read test which will recover availability for 200 cores with max PoV size on a 1000 +Let's run an availability read test which will recover availability for 200 cores with max PoV size on a 1000 node validator network. From 0c6c837f689a287583508506e342ba07687e8d26 Mon Sep 17 00:00:00 2001 From: Serban Iorga Date: Mon, 18 Mar 2024 13:37:24 +0100 Subject: [PATCH 9/9] Bridge zombienet tests: remove unneeded accounts (#3700) Bridge zombienet tests: remove unneeded accounts --- .../rococo-westend/bridges_rococo_westend.sh | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh b/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh index 479ab833abfc..66c9ddc037b8 100755 --- a/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh +++ b/bridges/testing/environments/rococo-westend/bridges_rococo_westend.sh @@ -24,12 +24,6 @@ source "$FRAMEWORK_PATH/utils/bridges.sh" # &MultiLocation { parents: 2, interior: X1(GlobalConsensus(Rococo)) }).unwrap() # ).to_ss58check_with_version(42_u16.into()) # ); -# println!("GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT=\"{}\"", -# frame_support::sp_runtime::AccountId32::new( -# GlobalConsensusParachainConvertsFor::::convert_location( -# &MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1000)) }).unwrap() -# ).to_ss58check_with_version(42_u16.into()) -# ); # println!("ASSET_HUB_WESTEND_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WESTEND=\"{}\"", # frame_support::sp_runtime::AccountId32::new( # SiblingParachainConvertsVia::::convert_location( @@ -44,12 +38,6 @@ source "$FRAMEWORK_PATH/utils/bridges.sh" # &MultiLocation { parents: 2, interior: X1(GlobalConsensus(Westend)) }).unwrap() # ).to_ss58check_with_version(42_u16.into()) # ); -# println!("GLOBAL_CONSENSUS_WESTEND_ASSET_HUB_WESTEND_1000_SOVEREIGN_ACCOUNT=\"{}\"", -# frame_support::sp_runtime::AccountId32::new( -# GlobalConsensusParachainConvertsFor::::convert_location( -# &MultiLocation { parents: 2, interior: X2(GlobalConsensus(Westend), Parachain(1000)) }).unwrap() -# ).to_ss58check_with_version(42_u16.into()) -# ); # println!("ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO=\"{}\"", # frame_support::sp_runtime::AccountId32::new( # SiblingParachainConvertsVia::::convert_location( @@ -58,10 +46,8 @@ source "$FRAMEWORK_PATH/utils/bridges.sh" # ); # } GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT="5GxRGwT8bU1JeBPTUXc7LEjZMxNrK8MyL2NJnkWFQJTQ4sii" -GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT="5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ" ASSET_HUB_WESTEND_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WESTEND="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV" GLOBAL_CONSENSUS_WESTEND_SOVEREIGN_ACCOUNT="5He2Qdztyxxa4GoagY6q1jaiLMmKy1gXS7PdZkhfj8ZG9hk5" -GLOBAL_CONSENSUS_WESTEND_ASSET_HUB_WESTEND_1000_SOVEREIGN_ACCOUNT="5GUD9X494SnhfBTNReHwhV1599McpyVrAqFY6WnTfVQVYNUM" ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV" # Expected sovereign accounts for rewards on BridgeHubs. @@ -201,12 +187,6 @@ case "$1" in "$GLOBAL_CONSENSUS_WESTEND_SOVEREIGN_ACCOUNT" \ 10000000000 \ true - # drip SA which holds reserves - transfer_balance \ - "ws://127.0.0.1:9910" \ - "//Alice" \ - "$GLOBAL_CONSENSUS_WESTEND_ASSET_HUB_WESTEND_1000_SOVEREIGN_ACCOUNT" \ - $((1000000000000 + 50000000000 * 20)) # HRMP open_hrmp_channels \ "ws://127.0.0.1:9942" \ @@ -266,12 +246,6 @@ case "$1" in "$GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT" \ 10000000000 \ true - # drip SA which holds reserves - transfer_balance \ - "ws://127.0.0.1:9010" \ - "//Alice" \ - "$GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT" \ - $((1000000000000000 + 50000000000 * 20)) # HRMP open_hrmp_channels \ "ws://127.0.0.1:9945" \