Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrates pallet-multisig to Consideration #1782

Closed
wants to merge 11 commits into from
Closed
22 changes: 15 additions & 7 deletions cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
ord_parameter_types, parameter_types,
traits::{
fungible, fungibles, tokens::imbalance::ResolveAssetTo, AsEnsureOriginWithArg, ConstBool,
ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Equals, InstanceFilter,
TransformOrigin,
fungible::{self, HoldConsideration},
fungibles,
tokens::imbalance::ResolveAssetTo,
AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse,
Equals, InstanceFilter, LinearStoragePrice, TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
BoundedVec, PalletId,
Expand Down Expand Up @@ -215,7 +217,8 @@ impl pallet_balances::Config for Runtime {
type FreezeIdentifier = ();
// We allow each account to have holds on it from:
// - `NftFractionalization`: 1
type MaxHolds = ConstU32<1>;
// - `Multisig`: 1
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -409,14 +412,19 @@ parameter_types! {
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MaxSignatories: u32 = 100;
pub const MultisigHoldReason: RuntimeHoldReason = RuntimeHoldReason::Multisig(pallet_multisig::HoldReason::Multisig);
}

impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Consideration = HoldConsideration<
AccountId,
Balances,
MultisigHoldReason,
LinearStoragePrice<DepositBase, DepositFactor, Balance>,
>;
type MaxSignatories = MaxSignatories;
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
}
Expand Down Expand Up @@ -912,7 +920,7 @@ construct_runtime!(

// Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 41,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>, HoldReason} = 41,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,

// Bridge utilities.
Expand Down
19 changes: 13 additions & 6 deletions cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
ord_parameter_types, parameter_types,
traits::{
fungible, fungibles,
fungible::{self, HoldConsideration},
fungibles,
tokens::{imbalance::ResolveAssetTo, nonfungibles_v2::Inspect},
AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, Equals,
InstanceFilter, TransformOrigin,
InstanceFilter, LinearStoragePrice, TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
BoundedVec, PalletId,
Expand Down Expand Up @@ -200,7 +201,8 @@ impl pallet_balances::Config for Runtime {
type FreezeIdentifier = ();
// We allow each account to have holds on it from:
// - `NftFractionalization`: 1
type MaxHolds = ConstU32<1>;
// - `Multisig`: 1
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -389,14 +391,19 @@ parameter_types! {
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MaxSignatories: u32 = 100;
pub const MultisigHoldReason: RuntimeHoldReason = RuntimeHoldReason::Multisig(pallet_multisig::HoldReason::Multisig);
}

impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Consideration = HoldConsideration<
AccountId,
Balances,
MultisigHoldReason,
LinearStoragePrice<DepositBase, DepositFactor, Balance>,
>;
type MaxSignatories = MaxSignatories;
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
}
Expand Down Expand Up @@ -891,7 +898,7 @@ construct_runtime!(

// Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 41,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>, HoldReason} = 41,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,

// The main stage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ use frame_support::{
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, TransformOrigin},
traits::{
fungible::HoldConsideration, ConstBool, ConstU32, ConstU64, ConstU8, LinearStoragePrice,
TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
PalletId,
};
Expand Down Expand Up @@ -312,7 +315,9 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
// We allow each account to have holds on it from:
// - `Multisig`: 1
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -476,14 +481,19 @@ parameter_types! {
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MultisigHoldReason: RuntimeHoldReason = RuntimeHoldReason::Multisig(pallet_multisig::HoldReason::Multisig);
}

impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Consideration = HoldConsideration<
AccountId,
Balances,
MultisigHoldReason,
LinearStoragePrice<DepositBase, DepositFactor, Balance>,
>;
type MaxSignatories = ConstU32<100>;
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
}
Expand Down Expand Up @@ -670,7 +680,7 @@ construct_runtime!(

// Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 36,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>, HoldReason} = 36,

// Bridge relayers pallet, used by several bridges here.
BridgeRelayers: pallet_bridge_relayers::{Pallet, Call, Storage, Event<T>} = 47,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ use frame_support::{
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, TransformOrigin},
traits::{
fungible::HoldConsideration, ConstBool, ConstU32, ConstU64, ConstU8, LinearStoragePrice,
TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
PalletId,
};
Expand Down Expand Up @@ -278,7 +281,9 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
// We allow each account to have holds on it from:
// - `Multisig`: 1
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -434,14 +439,19 @@ parameter_types! {
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MultisigHoldReason: RuntimeHoldReason = RuntimeHoldReason::Multisig(pallet_multisig::HoldReason::Multisig);
}

impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Consideration = HoldConsideration<
AccountId,
Balances,
MultisigHoldReason,
LinearStoragePrice<DepositBase, DepositFactor, Balance>,
>;
type MaxSignatories = ConstU32<100>;
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
}
Expand Down Expand Up @@ -483,7 +493,7 @@ construct_runtime!(

// Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 36,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>, HoldReason} = 36,

// Bridging stuff.
BridgeRelayers: pallet_bridge_relayers::{Pallet, Call, Storage, Event<T>} = 41,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
// We allow each account to have holds on it from:
// - `Preimage`: 1
// - `Multisig`: 1
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}

Expand All @@ -235,14 +238,19 @@ parameter_types! {
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MultisigHoldReason: RuntimeHoldReason = RuntimeHoldReason::Multisig(pallet_multisig::HoldReason::Multisig);
}

impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Consideration = HoldConsideration<
AccountId,
Balances,
MultisigHoldReason,
LinearStoragePrice<DepositBase, DepositFactor, Balance>,
>;
type MaxSignatories = ConstU32<100>;
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
}
Expand Down Expand Up @@ -661,7 +669,7 @@ construct_runtime!(

// Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 41,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>, HoldReason} = 41,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 43,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 44,
Expand Down
21 changes: 16 additions & 5 deletions cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ use frame_support::{
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8},
traits::{
fungible::HoldConsideration, ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8,
LinearStoragePrice,
},
weights::{ConstantMultiplier, Weight},
PalletId,
};
Expand Down Expand Up @@ -217,7 +220,10 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
// We allow each account to have holds on it from:
// - `Contracts`: 1
// - `Multisig`: 1
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}

Expand All @@ -241,14 +247,19 @@ parameter_types! {
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MultisigHoldReason: RuntimeHoldReason = RuntimeHoldReason::Multisig(pallet_multisig::HoldReason::Multisig);
}

impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Consideration = HoldConsideration<
AccountId,
Balances,
MultisigHoldReason,
LinearStoragePrice<DepositBase, DepositFactor, Balance>,
>;
type MaxSignatories = ConstU32<100>;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
}
Expand Down Expand Up @@ -406,7 +417,7 @@ construct_runtime!(

// Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 50,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 51,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>, HoldReason} = 51,

// Sudo
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Event<T>, Storage} = 100,
Expand Down
18 changes: 14 additions & 4 deletions cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ use frame_support::{
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, TransformOrigin},
traits::{
fungible::HoldConsideration, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse,
LinearStoragePrice, TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
PalletId,
};
Expand Down Expand Up @@ -228,7 +231,9 @@ impl pallet_balances::Config for Runtime {
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
// We allow each account to have holds on it from:
// - `Multisig`: 1
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -399,14 +404,19 @@ parameter_types! {
pub const DepositBase: Balance = deposit(1, 88);
/// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MultisigHoldReason: RuntimeHoldReason = RuntimeHoldReason::Multisig(pallet_multisig::HoldReason::Multisig);
}

impl pallet_multisig::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Consideration = HoldConsideration<
AccountId,
Balances,
MultisigHoldReason,
LinearStoragePrice<DepositBase, DepositFactor, Balance>,
>;
type MaxSignatories = ConstU32<100>;
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
}
Expand Down
Loading