diff --git a/operator/Cargo.lock b/operator/Cargo.lock index 15c6b897..7a943046 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -1608,6 +1608,7 @@ dependencies = [ "pallet-evm-chain-id", "pallet-grandpa", "pallet-mmr", + "pallet-multisig", "pallet-session", "pallet-sudo", "pallet-timestamp", @@ -5939,6 +5940,21 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "pallet-multisig" +version = "38.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2409#43d7b1e329f50a37cbd67e15aae70c60556cbb59" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", +] + [[package]] name = "pallet-session" version = "38.0.0" diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 4a94e0bb..204e5f2d 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -85,6 +85,7 @@ frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch pallet-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } +pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } diff --git a/operator/runtime/Cargo.toml b/operator/runtime/Cargo.toml index 04578d40..85333e58 100644 --- a/operator/runtime/Cargo.toml +++ b/operator/runtime/Cargo.toml @@ -26,6 +26,7 @@ hex-literal.workspace = true pallet-babe.workspace = true pallet-balances.workspace = true pallet-grandpa.workspace = true +pallet-multisig.workspace = true pallet-session.workspace = true pallet-sudo.workspace = true pallet-timestamp.workspace = true @@ -92,6 +93,7 @@ std = [ "pallet-beefy-mmr/std", "pallet-balances/std", "pallet-grandpa/std", + "pallet-multisig/std", "pallet-mmr/std", "pallet-session/std", "pallet-session/std", @@ -141,6 +143,7 @@ runtime-benchmarks = [ "datahaven-runtime-common/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", "pallet-sudo/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-utility/runtime-benchmarks", @@ -162,6 +165,7 @@ try-runtime = [ "pallet-babe/try-runtime", "pallet-balances/try-runtime", "pallet-grandpa/try-runtime", + "pallet-multisig/try-runtime", "pallet-session/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", diff --git a/operator/runtime/src/benchmarks.rs b/operator/runtime/src/benchmarks.rs index 6ec7d094..1c7c5afc 100644 --- a/operator/runtime/src/benchmarks.rs +++ b/operator/runtime/src/benchmarks.rs @@ -27,6 +27,7 @@ frame_benchmarking::define_benchmarks!( [frame_benchmarking, BaselineBench::] [frame_system, SystemBench::] [pallet_balances, Balances] + [pallet_multisig, Multisig] [pallet_timestamp, Timestamp] [pallet_utility, Utility] [pallet_sudo, Sudo] diff --git a/operator/runtime/src/configs/mod.rs b/operator/runtime/src/configs/mod.rs index b1baf1df..4ee76ed4 100644 --- a/operator/runtime/src/configs/mod.rs +++ b/operator/runtime/src/configs/mod.rs @@ -30,9 +30,9 @@ use crate::{Historical, SessionKeys, ValidatorSet}; // Local module imports use super::{ - AccountId, Babe, Balance, Balances, BeefyMmrLeaf, Block, BlockNumber, Hash, Nonce, PalletInfo, - Runtime, RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, - RuntimeTask, Session, System, EXISTENTIAL_DEPOSIT, SLOT_DURATION, VERSION, + deposit, AccountId, Babe, Balance, Balances, BeefyMmrLeaf, Block, BlockNumber, Hash, Nonce, + PalletInfo, Runtime, RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, + RuntimeOrigin, RuntimeTask, Session, System, EXISTENTIAL_DEPOSIT, SLOT_DURATION, VERSION, }; // Substrate and Polkadot dependencies use codec::{Decode, Encode}; @@ -236,6 +236,24 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeHoldReason; } +parameter_types! { + // One storage item; key size is 32 + 20; value is size 4+4+16+20 bytes = 44 bytes. + pub const DepositBase: Balance = deposit(1, 96); + // Additional storage item size of 20 bytes. + pub const DepositFactor: Balance = deposit(0, 20); + pub const MaxSignatories: u32 = 100; +} + +impl pallet_multisig::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type WeightInfo = (); +} + impl pallet_validator_set::Config for Runtime { type RuntimeEvent = RuntimeEvent; type AddRemoveOrigin = EnsureRoot; diff --git a/operator/runtime/src/lib.rs b/operator/runtime/src/lib.rs index bbe8c922..354f573d 100644 --- a/operator/runtime/src/lib.rs +++ b/operator/runtime/src/lib.rs @@ -96,14 +96,23 @@ pub const DAYS: BlockNumber = HOURS * 24; pub const BLOCK_HASH_COUNT: BlockNumber = 2400; +// Provide a common factor between runtimes based on a supply of 10_000_000 tokens. +pub const SUPPLY_FACTOR: Balance = 1; + // Unit = the base number of indivisible units for balances pub const UNIT: Balance = 1_000_000_000_000; pub const MILLI_UNIT: Balance = 1_000_000_000; pub const MICRO_UNIT: Balance = 1_000_000; +pub const STORAGE_BYTE_FEE: Balance = 100 * MICRO_UNIT * SUPPLY_FACTOR; + /// Existential deposit. pub const EXISTENTIAL_DEPOSIT: Balance = MILLI_UNIT; +pub const fn deposit(items: u32, bytes: u32) -> Balance { + items as Balance * 1 * UNIT * SUPPLY_FACTOR + (bytes as Balance) * STORAGE_BYTE_FEE +} + /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { @@ -249,6 +258,9 @@ mod runtime { #[runtime::pallet_index(20)] pub type Utility = pallet_utility; + #[runtime::pallet_index(24)] + pub type Multisig = pallet_multisig; + #[runtime::pallet_index(31)] pub type Ethereum = pallet_ethereum;