diff --git a/bin/node-template/pallets/template/src/mock.rs b/bin/node-template/pallets/template/src/mock.rs index 1ebe3bee6090c..8719bcb4df2d5 100644 --- a/bin/node-template/pallets/template/src/mock.rs +++ b/bin/node-template/pallets/template/src/mock.rs @@ -49,6 +49,7 @@ impl system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = SS58Prefix; + type OnSetCode = (); } impl pallet_template::Config for Test { diff --git a/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 1675b3d2a1cdc..1453b54309e63 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/bin/node-template/runtime/src/lib.rs @@ -195,6 +195,8 @@ impl frame_system::Config for Runtime { type SystemWeightInfo = (); /// This is used as an identifier of the chain. 42 is the generic substrate prefix. type SS58Prefix = SS58Prefix; + /// The set code logic, just the default since we're not a parachain. + type OnSetCode = (); } impl pallet_aura::Config for Runtime { diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index f790cf41a401b..8f8f82648822c 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -213,6 +213,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = frame_system::weights::SubstrateWeight; type SS58Prefix = SS58Prefix; + type OnSetCode = (); } impl pallet_utility::Config for Runtime { diff --git a/frame/assets/src/mock.rs b/frame/assets/src/mock.rs index 26ff938512a2f..0b7aa339835ec 100644 --- a/frame/assets/src/mock.rs +++ b/frame/assets/src/mock.rs @@ -65,6 +65,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/atomic-swap/src/tests.rs b/frame/atomic-swap/src/tests.rs index baa9a08957d4a..cc2849f5bd2c0 100644 --- a/frame/atomic-swap/src/tests.rs +++ b/frame/atomic-swap/src/tests.rs @@ -53,6 +53,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/aura/src/mock.rs b/frame/aura/src/mock.rs index 481edbaff487f..26d5a2754974f 100644 --- a/frame/aura/src/mock.rs +++ b/frame/aura/src/mock.rs @@ -70,6 +70,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet_timestamp::Config for Test { diff --git a/frame/authority-discovery/src/lib.rs b/frame/authority-discovery/src/lib.rs index ca8f3eeff3d68..93466d4f3509b 100644 --- a/frame/authority-discovery/src/lib.rs +++ b/frame/authority-discovery/src/lib.rs @@ -200,6 +200,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } pub struct TestSessionHandler; diff --git a/frame/authorship/src/lib.rs b/frame/authorship/src/lib.rs index 286abc721cbba..5e9955f59f9df 100644 --- a/frame/authorship/src/lib.rs +++ b/frame/authorship/src/lib.rs @@ -447,6 +447,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index 137f32b5e502c..39831eceb75ba 100644 --- a/frame/babe/src/mock.rs +++ b/frame/babe/src/mock.rs @@ -92,6 +92,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl frame_system::offchain::SendTransactionTypes for Test diff --git a/frame/balances/src/tests_composite.rs b/frame/balances/src/tests_composite.rs index 90bcaf1a480ad..b4bdb13fbb838 100644 --- a/frame/balances/src/tests_composite.rs +++ b/frame/balances/src/tests_composite.rs @@ -75,6 +75,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const TransactionByteFee: u64 = 1; diff --git a/frame/balances/src/tests_local.rs b/frame/balances/src/tests_local.rs index 10ea74d8887bc..f6f0bf8389a1f 100644 --- a/frame/balances/src/tests_local.rs +++ b/frame/balances/src/tests_local.rs @@ -77,6 +77,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const TransactionByteFee: u64 = 1; diff --git a/frame/balances/src/tests_reentrancy.rs b/frame/balances/src/tests_reentrancy.rs index 547c7dd7cfb72..4016cdb463c69 100644 --- a/frame/balances/src/tests_reentrancy.rs +++ b/frame/balances/src/tests_reentrancy.rs @@ -90,6 +90,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const TransactionByteFee: u64 = 1; diff --git a/frame/benchmarking/src/tests.rs b/frame/benchmarking/src/tests.rs index ac0a208543058..0869ae68c7e09 100644 --- a/frame/benchmarking/src/tests.rs +++ b/frame/benchmarking/src/tests.rs @@ -104,6 +104,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types!{ diff --git a/frame/bounties/src/tests.rs b/frame/bounties/src/tests.rs index 617f186975269..d676c940f5afe 100644 --- a/frame/bounties/src/tests.rs +++ b/frame/bounties/src/tests.rs @@ -80,6 +80,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index 28c2ff77b81fe..d5768e4f5cb84 100644 --- a/frame/collective/src/lib.rs +++ b/frame/collective/src/lib.rs @@ -1004,6 +1004,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl Config for Test { type Origin = Origin; diff --git a/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 5fb637f3e9f18..802118bfb069f 100644 --- a/frame/contracts/src/tests.rs +++ b/frame/contracts/src/tests.rs @@ -222,6 +222,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet_balances::Config for Test { type MaxLocks = (); diff --git a/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index 57e845ace9f24..4dd96d219b9e1 100644 --- a/frame/democracy/src/tests.rs +++ b/frame/democracy/src/tests.rs @@ -103,6 +103,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; diff --git a/frame/election-provider-multi-phase/src/mock.rs b/frame/election-provider-multi-phase/src/mock.rs index cebd5cf06e692..5a0a83354b266 100644 --- a/frame/election-provider-multi-phase/src/mock.rs +++ b/frame/election-provider-multi-phase/src/mock.rs @@ -161,6 +161,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type OnSetCode = (); } const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index 7f0a6afb2b106..4c84c72b0b305 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -1085,6 +1085,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/elections/src/mock.rs b/frame/elections/src/mock.rs index 287eaa27b196a..3a9cca41ff0e9 100644 --- a/frame/elections/src/mock.rs +++ b/frame/elections/src/mock.rs @@ -58,6 +58,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/example-offchain-worker/src/tests.rs b/frame/example-offchain-worker/src/tests.rs index e91b374adbe1d..ee47aa5629fd9 100644 --- a/frame/example-offchain-worker/src/tests.rs +++ b/frame/example-offchain-worker/src/tests.rs @@ -82,6 +82,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } type Extrinsic = TestXt; diff --git a/frame/example-parallel/src/tests.rs b/frame/example-parallel/src/tests.rs index e82d75e632068..56cb73ebb08bb 100644 --- a/frame/example-parallel/src/tests.rs +++ b/frame/example-parallel/src/tests.rs @@ -66,6 +66,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/example/src/tests.rs b/frame/example/src/tests.rs index ed866344a4b18..496cd5701fe58 100644 --- a/frame/example/src/tests.rs +++ b/frame/example/src/tests.rs @@ -76,6 +76,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index 277b20cf20bfa..fc4f5be5dc950 100644 --- a/frame/executive/src/lib.rs +++ b/frame/executive/src/lib.rs @@ -670,6 +670,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } type Balance = u64; diff --git a/frame/gilt/src/mock.rs b/frame/gilt/src/mock.rs index 1abb92ed3dfac..f5c0d3a5aabef 100644 --- a/frame/gilt/src/mock.rs +++ b/frame/gilt/src/mock.rs @@ -70,6 +70,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = SS58Prefix; + type OnSetCode = (); } parameter_types! { diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index 3f450e18bc783..d59d0d19d0e87 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -97,6 +97,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl frame_system::offchain::SendTransactionTypes for Test diff --git a/frame/identity/src/tests.rs b/frame/identity/src/tests.rs index a996c989a9185..937fa8f130d80 100644 --- a/frame/identity/src/tests.rs +++ b/frame/identity/src/tests.rs @@ -71,6 +71,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/im-online/src/mock.rs b/frame/im-online/src/mock.rs index 35028dd89df4e..4f21012abc510 100644 --- a/frame/im-online/src/mock.rs +++ b/frame/im-online/src/mock.rs @@ -140,6 +140,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/indices/src/mock.rs b/frame/indices/src/mock.rs index 01db4b50f5085..efaaa0212467b 100644 --- a/frame/indices/src/mock.rs +++ b/frame/indices/src/mock.rs @@ -68,6 +68,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/lottery/src/mock.rs b/frame/lottery/src/mock.rs index a776896921a7f..9015de5b0853a 100644 --- a/frame/lottery/src/mock.rs +++ b/frame/lottery/src/mock.rs @@ -78,6 +78,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index e26af3ce9b71a..96fc15b0509b6 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -328,6 +328,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } ord_parameter_types! { pub const One: u64 = 1; diff --git a/frame/merkle-mountain-range/src/mock.rs b/frame/merkle-mountain-range/src/mock.rs index 072724a58afe5..3c8a5d284566f 100644 --- a/frame/merkle-mountain-range/src/mock.rs +++ b/frame/merkle-mountain-range/src/mock.rs @@ -71,6 +71,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl Config for Test { diff --git a/frame/multisig/src/tests.rs b/frame/multisig/src/tests.rs index a3a3edc34f1a9..118cfebdbdce6 100644 --- a/frame/multisig/src/tests.rs +++ b/frame/multisig/src/tests.rs @@ -71,6 +71,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index 67e62a09da64a..1afe55756777a 100644 --- a/frame/nicks/src/lib.rs +++ b/frame/nicks/src/lib.rs @@ -292,6 +292,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/node-authorization/src/mock.rs b/frame/node-authorization/src/mock.rs index 5118f07c7694e..3f4f894cdf7e3 100644 --- a/frame/node-authorization/src/mock.rs +++ b/frame/node-authorization/src/mock.rs @@ -70,6 +70,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } ord_parameter_types! { diff --git a/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index 223d6d4d477a6..a0a09e0fbb897 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/frame/offences/benchmarking/src/mock.rs @@ -65,6 +65,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: Balance = 10; diff --git a/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index ab45bb0837b56..52dd55207af07 100644 --- a/frame/offences/src/mock.rs +++ b/frame/offences/src/mock.rs @@ -124,6 +124,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs index 797a5ee3d4694..6f3b1f35e2ada 100644 --- a/frame/proxy/src/tests.rs +++ b/frame/proxy/src/tests.rs @@ -73,6 +73,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/randomness-collective-flip/src/lib.rs b/frame/randomness-collective-flip/src/lib.rs index 5ef76a33c21f4..724605c6238b6 100644 --- a/frame/randomness-collective-flip/src/lib.rs +++ b/frame/randomness-collective-flip/src/lib.rs @@ -193,6 +193,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } fn new_test_ext() -> sp_io::TestExternalities { diff --git a/frame/recovery/src/mock.rs b/frame/recovery/src/mock.rs index 301dd8dba8ddd..72dbc29fd7160 100644 --- a/frame/recovery/src/mock.rs +++ b/frame/recovery/src/mock.rs @@ -70,6 +70,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 9848c9853d0bf..5332aedf7f136 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -76,8 +76,8 @@ pub trait Config: system::Config { type Event: From> + Into<::Event>; /// The aggregated origin which the dispatch will take. - type Origin: OriginTrait + From + IsType<::Origin>; + type Origin: OriginTrait + + From + IsType<::Origin>; /// The caller origin, overarching type of all pallets origins. type PalletsOrigin: From> + Codec + Clone + Eq; @@ -835,6 +835,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl logger::Config for Test { type Event = Event; diff --git a/frame/scored-pool/src/mock.rs b/frame/scored-pool/src/mock.rs index 76f9dd848d6c0..1da665f43eaef 100644 --- a/frame/scored-pool/src/mock.rs +++ b/frame/scored-pool/src/mock.rs @@ -79,6 +79,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet_balances::Config for Test { diff --git a/frame/session/benchmarking/src/mock.rs b/frame/session/benchmarking/src/mock.rs index 53afeb620c260..cf2fa8a07cfe0 100644 --- a/frame/session/benchmarking/src/mock.rs +++ b/frame/session/benchmarking/src/mock.rs @@ -67,6 +67,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: Balance = 10; diff --git a/frame/session/src/mock.rs b/frame/session/src/mock.rs index b64359fccee32..3459ab73d6afe 100644 --- a/frame/session/src/mock.rs +++ b/frame/session/src/mock.rs @@ -250,6 +250,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet_timestamp::Config for Test { diff --git a/frame/society/src/mock.rs b/frame/society/src/mock.rs index ff80b50b6d358..f2d16423f3cc5 100644 --- a/frame/society/src/mock.rs +++ b/frame/society/src/mock.rs @@ -91,6 +91,7 @@ impl frame_system::Config for Test { type AccountData = pallet_balances::AccountData; type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet_balances::Config for Test { diff --git a/frame/staking/fuzzer/src/mock.rs b/frame/staking/fuzzer/src/mock.rs index 8fe7975cef068..11d810a26e175 100644 --- a/frame/staking/fuzzer/src/mock.rs +++ b/frame/staking/fuzzer/src/mock.rs @@ -64,6 +64,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: Balance = 10; diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index 1942e5eed0c6f..188eda801095e 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -150,6 +150,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet_balances::Config for Test { type MaxLocks = MaxLocks; diff --git a/frame/sudo/src/mock.rs b/frame/sudo/src/mock.rs index 9aac0a129907f..568799e1fe632 100644 --- a/frame/sudo/src/mock.rs +++ b/frame/sudo/src/mock.rs @@ -151,6 +151,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } // Implement the logger module's `Config` on the Test runtime. diff --git a/frame/support/test/tests/pallet.rs b/frame/support/test/tests/pallet.rs index 5387312819c87..d78688c88c3e3 100644 --- a/frame/support/test/tests/pallet.rs +++ b/frame/support/test/tests/pallet.rs @@ -395,6 +395,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet::Config for Runtime { type Event = Event; diff --git a/frame/support/test/tests/pallet_compatibility.rs b/frame/support/test/tests/pallet_compatibility.rs index 95e1c027eb3fa..a953b19607d90 100644 --- a/frame/support/test/tests/pallet_compatibility.rs +++ b/frame/support/test/tests/pallet_compatibility.rs @@ -225,6 +225,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet::Config for Runtime { type Event = Event; diff --git a/frame/support/test/tests/pallet_compatibility_instance.rs b/frame/support/test/tests/pallet_compatibility_instance.rs index 603c583ae217f..5ce20012c736d 100644 --- a/frame/support/test/tests/pallet_compatibility_instance.rs +++ b/frame/support/test/tests/pallet_compatibility_instance.rs @@ -217,6 +217,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet::Config for Runtime { type Event = Event; diff --git a/frame/support/test/tests/pallet_instance.rs b/frame/support/test/tests/pallet_instance.rs index 1bf4c1af09280..d71242e49e0f2 100644 --- a/frame/support/test/tests/pallet_instance.rs +++ b/frame/support/test/tests/pallet_instance.rs @@ -260,6 +260,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet::Config for Runtime { type Event = Event; diff --git a/frame/support/test/tests/pallet_version.rs b/frame/support/test/tests/pallet_version.rs index b3436b7baed9a..5c33d45aea644 100644 --- a/frame/support/test/tests/pallet_version.rs +++ b/frame/support/test/tests/pallet_version.rs @@ -166,6 +166,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } frame_support::construct_runtime!( diff --git a/frame/support/test/tests/pallet_with_name_trait_is_valid.rs b/frame/support/test/tests/pallet_with_name_trait_is_valid.rs index 05cedbdb91a07..9fc7055ce1bc5 100644 --- a/frame/support/test/tests/pallet_with_name_trait_is_valid.rs +++ b/frame/support/test/tests/pallet_with_name_trait_is_valid.rs @@ -141,6 +141,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet_test::Trait for Runtime { diff --git a/frame/system/benches/bench.rs b/frame/system/benches/bench.rs index 3ebee534a64e1..47980a88164e5 100644 --- a/frame/system/benches/bench.rs +++ b/frame/system/benches/bench.rs @@ -89,6 +89,7 @@ impl system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl module::Config for Runtime { diff --git a/frame/system/benchmarking/src/mock.rs b/frame/system/benchmarking/src/mock.rs index 23da1fee5617a..253945a598bdc 100644 --- a/frame/system/benchmarking/src/mock.rs +++ b/frame/system/benchmarking/src/mock.rs @@ -61,6 +61,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl crate::Config for Test {} diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 9d3ecd6f41f5d..cfe79128863ff 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -140,6 +140,18 @@ pub type ConsumedWeight = PerDispatchClass; pub use pallet::*; +/// Do something when we should be setting the code. +pub trait SetCode { + /// Set the code to the given blob. + fn set_code(code: Vec); +} + +impl SetCode for () { + fn set_code(code: Vec) { + storage::unhashed::put_raw(well_known_keys::CODE, &code); + } +} + #[frame_support::pallet] pub mod pallet { use crate::{*, pallet_prelude::*, self as frame_system}; @@ -253,6 +265,10 @@ pub mod pallet { /// an identifier of the chain. #[pallet::constant] type SS58Prefix: Get; + + /// What to do if the user wants the code set to something. Just use `()` unless you are in + /// cumulus. + type OnSetCode: SetCode; } #[pallet::pallet] @@ -329,7 +345,7 @@ pub mod pallet { ensure_root(origin)?; Self::can_set_code(&code)?; - storage::unhashed::put_raw(well_known_keys::CODE, &code); + T::OnSetCode::set_code(code); Self::deposit_event(Event::CodeUpdated); Ok(().into()) } @@ -348,7 +364,7 @@ pub mod pallet { code: Vec, ) -> DispatchResultWithPostInfo { ensure_root(origin)?; - storage::unhashed::put_raw(well_known_keys::CODE, &code); + T::OnSetCode::set_code(code); Self::deposit_event(Event::CodeUpdated); Ok(().into()) } diff --git a/frame/system/src/mock.rs b/frame/system/src/mock.rs index 43c7d8d252774..0f53532eb8f6b 100644 --- a/frame/system/src/mock.rs +++ b/frame/system/src/mock.rs @@ -107,6 +107,7 @@ impl Config for Test { type OnKilledAccount = RecordKilled; type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } pub type SysEvent = frame_system::Event; diff --git a/frame/timestamp/src/lib.rs b/frame/timestamp/src/lib.rs index d467551196850..dabf5a93c13d1 100644 --- a/frame/timestamp/src/lib.rs +++ b/frame/timestamp/src/lib.rs @@ -352,6 +352,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const MinimumPeriod: u64 = 5; diff --git a/frame/tips/src/tests.rs b/frame/tips/src/tests.rs index ef30962fc846f..c57c427810d05 100644 --- a/frame/tips/src/tests.rs +++ b/frame/tips/src/tests.rs @@ -76,6 +76,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index b2dc2c9859e0b..278cabc400921 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/frame/transaction-payment/src/lib.rs @@ -687,6 +687,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/frame/treasury/src/tests.rs b/frame/treasury/src/tests.rs index 45fc3e629fb0b..25bfc6af81dea 100644 --- a/frame/treasury/src/tests.rs +++ b/frame/treasury/src/tests.rs @@ -77,6 +77,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index 3a8089519fac5..f13e1b6ef7789 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -111,6 +111,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/frame/vesting/src/lib.rs b/frame/vesting/src/lib.rs index c02e9dc78c13e..e5e6cb5069b82 100644 --- a/frame/vesting/src/lib.rs +++ b/frame/vesting/src/lib.rs @@ -464,6 +464,7 @@ mod tests { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { pub const MaxLocks: u32 = 10; diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index 460494bfbd93a..837b3715c8192 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -515,6 +515,7 @@ impl frame_system::Config for Runtime { type OnKilledAccount = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl pallet_timestamp::Config for Runtime {