mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 19:31:02 +00:00
Introduce OnSetCode type into system config trait. (#8496)
* Introduce OnSetCode type into system config trait. * Docs. * Fixes * Fixes
This commit is contained in:
@@ -49,6 +49,7 @@ impl system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = SS58Prefix;
|
type SS58Prefix = SS58Prefix;
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_template::Config for Test {
|
impl pallet_template::Config for Test {
|
||||||
|
|||||||
@@ -195,6 +195,8 @@ impl frame_system::Config for Runtime {
|
|||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
|
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
|
||||||
type SS58Prefix = SS58Prefix;
|
type SS58Prefix = SS58Prefix;
|
||||||
|
/// The set code logic, just the default since we're not a parachain.
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_aura::Config for Runtime {
|
impl pallet_aura::Config for Runtime {
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = frame_system::weights::SubstrateWeight<Runtime>;
|
type SystemWeightInfo = frame_system::weights::SubstrateWeight<Runtime>;
|
||||||
type SS58Prefix = SS58Prefix;
|
type SS58Prefix = SS58Prefix;
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_utility::Config for Runtime {
|
impl pallet_utility::Config for Runtime {
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Config for Test {
|
impl pallet_timestamp::Config for Test {
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TestSessionHandler;
|
pub struct TestSessionHandler;
|
||||||
|
|||||||
@@ -447,6 +447,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
|
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TransactionByteFee: u64 = 1;
|
pub const TransactionByteFee: u64 = 1;
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TransactionByteFee: u64 = 1;
|
pub const TransactionByteFee: u64 = 1;
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TransactionByteFee: u64 = 1;
|
pub const TransactionByteFee: u64 = 1;
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types!{
|
parameter_types!{
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -1004,6 +1004,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
impl Config<Instance1> for Test {
|
impl Config<Instance1> for Test {
|
||||||
type Origin = Origin;
|
type Origin = Origin;
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
impl pallet_balances::Config for Test {
|
impl pallet_balances::Config for Test {
|
||||||
type MaxLocks = ();
|
type MaxLocks = ();
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
|
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
|
|||||||
@@ -1085,6 +1085,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
type Extrinsic = TestXt<Call, ()>;
|
type Extrinsic = TestXt<Call, ()>;
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -670,6 +670,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
type Balance = u64;
|
type Balance = u64;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = SS58Prefix;
|
type SS58Prefix = SS58Prefix;
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
|
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
ord_parameter_types! {
|
ord_parameter_types! {
|
||||||
pub const One: u64 = 1;
|
pub const One: u64 = 1;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config for Test {
|
impl Config for Test {
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ord_parameter_types! {
|
ord_parameter_types! {
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: Balance = 10;
|
pub const ExistentialDeposit: Balance = 10;
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_test_ext() -> sp_io::TestExternalities {
|
fn new_test_ext() -> sp_io::TestExternalities {
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ pub trait Config: system::Config {
|
|||||||
type Event: From<Event<Self>> + Into<<Self as system::Config>::Event>;
|
type Event: From<Event<Self>> + Into<<Self as system::Config>::Event>;
|
||||||
|
|
||||||
/// The aggregated origin which the dispatch will take.
|
/// The aggregated origin which the dispatch will take.
|
||||||
type Origin: OriginTrait<PalletsOrigin =
|
type Origin: OriginTrait<PalletsOrigin = Self::PalletsOrigin>
|
||||||
Self::PalletsOrigin> + From<Self::PalletsOrigin> + IsType<<Self as system::Config>::Origin>;
|
+ From<Self::PalletsOrigin> + IsType<<Self as system::Config>::Origin>;
|
||||||
|
|
||||||
/// The caller origin, overarching type of all pallets origins.
|
/// The caller origin, overarching type of all pallets origins.
|
||||||
type PalletsOrigin: From<system::RawOrigin<Self::AccountId>> + Codec + Clone + Eq;
|
type PalletsOrigin: From<system::RawOrigin<Self::AccountId>> + Codec + Clone + Eq;
|
||||||
@@ -835,6 +835,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
impl logger::Config for Test {
|
impl logger::Config for Test {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_balances::Config for Test {
|
impl pallet_balances::Config for Test {
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: Balance = 10;
|
pub const ExistentialDeposit: Balance = 10;
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Config for Test {
|
impl pallet_timestamp::Config for Test {
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ impl frame_system::Config for Test {
|
|||||||
type AccountData = pallet_balances::AccountData<u64>;
|
type AccountData = pallet_balances::AccountData<u64>;
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_balances::Config for Test {
|
impl pallet_balances::Config for Test {
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: Balance = 10;
|
pub const ExistentialDeposit: Balance = 10;
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
impl pallet_balances::Config for Test {
|
impl pallet_balances::Config for Test {
|
||||||
type MaxLocks = MaxLocks;
|
type MaxLocks = MaxLocks;
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement the logger module's `Config` on the Test runtime.
|
// Implement the logger module's `Config` on the Test runtime.
|
||||||
|
|||||||
@@ -395,6 +395,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
impl pallet::Config for Runtime {
|
impl pallet::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
impl pallet::Config for Runtime {
|
impl pallet::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
impl pallet::Config for Runtime {
|
impl pallet::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
impl pallet::Config for Runtime {
|
impl pallet::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_support::construct_runtime!(
|
frame_support::construct_runtime!(
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_test::Trait for Runtime {
|
impl pallet_test::Trait for Runtime {
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ impl system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl module::Config for Runtime {
|
impl module::Config for Runtime {
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crate::Config for Test {}
|
impl crate::Config for Test {}
|
||||||
|
|||||||
@@ -140,6 +140,18 @@ pub type ConsumedWeight = PerDispatchClass<Weight>;
|
|||||||
|
|
||||||
pub use pallet::*;
|
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<u8>);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SetCode for () {
|
||||||
|
fn set_code(code: Vec<u8>) {
|
||||||
|
storage::unhashed::put_raw(well_known_keys::CODE, &code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet]
|
||||||
pub mod pallet {
|
pub mod pallet {
|
||||||
use crate::{*, pallet_prelude::*, self as frame_system};
|
use crate::{*, pallet_prelude::*, self as frame_system};
|
||||||
@@ -253,6 +265,10 @@ pub mod pallet {
|
|||||||
/// an identifier of the chain.
|
/// an identifier of the chain.
|
||||||
#[pallet::constant]
|
#[pallet::constant]
|
||||||
type SS58Prefix: Get<u8>;
|
type SS58Prefix: Get<u8>;
|
||||||
|
|
||||||
|
/// What to do if the user wants the code set to something. Just use `()` unless you are in
|
||||||
|
/// cumulus.
|
||||||
|
type OnSetCode: SetCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
@@ -329,7 +345,7 @@ pub mod pallet {
|
|||||||
ensure_root(origin)?;
|
ensure_root(origin)?;
|
||||||
Self::can_set_code(&code)?;
|
Self::can_set_code(&code)?;
|
||||||
|
|
||||||
storage::unhashed::put_raw(well_known_keys::CODE, &code);
|
T::OnSetCode::set_code(code);
|
||||||
Self::deposit_event(Event::CodeUpdated);
|
Self::deposit_event(Event::CodeUpdated);
|
||||||
Ok(().into())
|
Ok(().into())
|
||||||
}
|
}
|
||||||
@@ -348,7 +364,7 @@ pub mod pallet {
|
|||||||
code: Vec<u8>,
|
code: Vec<u8>,
|
||||||
) -> DispatchResultWithPostInfo {
|
) -> DispatchResultWithPostInfo {
|
||||||
ensure_root(origin)?;
|
ensure_root(origin)?;
|
||||||
storage::unhashed::put_raw(well_known_keys::CODE, &code);
|
T::OnSetCode::set_code(code);
|
||||||
Self::deposit_event(Event::CodeUpdated);
|
Self::deposit_event(Event::CodeUpdated);
|
||||||
Ok(().into())
|
Ok(().into())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ impl Config for Test {
|
|||||||
type OnKilledAccount = RecordKilled;
|
type OnKilledAccount = RecordKilled;
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type SysEvent = frame_system::Event<Test>;
|
pub type SysEvent = frame_system::Event<Test>;
|
||||||
|
|||||||
@@ -352,6 +352,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const MinimumPeriod: u64 = 5;
|
pub const MinimumPeriod: u64 = 5;
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -687,6 +687,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -464,6 +464,7 @@ mod tests {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const MaxLocks: u32 = 10;
|
pub const MaxLocks: u32 = 10;
|
||||||
|
|||||||
@@ -515,6 +515,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = ();
|
type SS58Prefix = ();
|
||||||
|
type OnSetCode = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Config for Runtime {
|
impl pallet_timestamp::Config for Runtime {
|
||||||
|
|||||||
Reference in New Issue
Block a user