diff --git a/Cargo.lock b/Cargo.lock index ef4772041cd4..d110e1e9e726 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8241,23 +8241,37 @@ dependencies = [ "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", + "pallet-bounties", + "pallet-child-bounties", "pallet-collective", + "pallet-democracy", + "pallet-elections-phragmen", + "pallet-gilt", "pallet-grandpa", + "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-membership", "pallet-mmr", "pallet-multisig", "pallet-offences", + "pallet-preimage", "pallet-proxy", + "pallet-recovery", + "pallet-scheduler", "pallet-session", + "pallet-society", "pallet-staking", "pallet-sudo", "pallet-timestamp", + "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", "pallet-utility", + "pallet-vesting", "pallet-xcm", + "pallet-xcm-benchmarks", "parity-scale-codec", "polkadot-parachain", "polkadot-primitives", @@ -8265,8 +8279,10 @@ dependencies = [ "polkadot-runtime-parachains", "rococo-runtime-constants", "scale-info", + "separator", "serde", "serde_derive", + "serde_json", "smallvec", "sp-api", "sp-authority-discovery", @@ -8275,6 +8291,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-keyring", "sp-mmr-primitives", "sp-offchain", "sp-runtime", @@ -8282,8 +8299,11 @@ dependencies = [ "sp-staking", "sp-std", "sp-transaction-pool", + "sp-trie", "sp-version", + "static_assertions", "substrate-wasm-builder", + "tiny-keccak", "xcm", "xcm-builder", "xcm-executor", diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index ce63e62cac01..9f16feeff8ea 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -1048,26 +1048,35 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: }) .collect::>(), }, + phragmen_election: Default::default(), babe: rococo_runtime::BabeConfig { authorities: Default::default(), epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), }, grandpa: Default::default(), im_online: Default::default(), - collective: Default::default(), - membership: Default::default(), + democracy: rococo_runtime::DemocracyConfig::default(), + council: rococo::CouncilConfig { members: vec![], phantom: Default::default() }, + technical_committee: rococo::TechnicalCommitteeConfig { + members: vec![], + phantom: Default::default(), + }, + technical_membership: Default::default(), + treasury: Default::default(), authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, + claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] }, + vesting: rococo::VestingConfig { vesting: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(endowed_accounts[0].clone()) }, paras: rococo_runtime::ParasConfig { paras: vec![] }, hrmp: Default::default(), configuration: rococo_runtime::ConfigurationConfig { config: default_parachains_host_configuration(), }, + gilt: Default::default(), registrar: rococo_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID, }, xcm_pallet: Default::default(), - transaction_payment: Default::default(), } } @@ -1599,8 +1608,17 @@ pub fn rococo_testnet_genesis( }, grandpa: Default::default(), im_online: Default::default(), - collective: Default::default(), - membership: Default::default(), + phragmen_election: Default::default(), + democracy: rococo::DemocracyConfig::default(), + council: rococo::CouncilConfig { members: vec![], phantom: Default::default() }, + technical_committee: rococo::TechnicalCommitteeConfig { + members: vec![], + phantom: Default::default(), + }, + technical_membership: Default::default(), + treasury: Default::default(), + claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] }, + vesting: rococo::VestingConfig { vesting: vec![] }, authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(root_key.clone()) }, hrmp: Default::default(), @@ -1610,12 +1628,12 @@ pub fn rococo_testnet_genesis( ..default_parachains_host_configuration() }, }, + gilt: Default::default(), paras: rococo_runtime::ParasConfig { paras: vec![] }, registrar: rococo_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID, }, xcm_pallet: Default::default(), - transaction_payment: Default::default(), } } diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 83dae867af85..5461bee0ee2f 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -20,7 +20,6 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -use pallet_transaction_payment::CurrencyAdapter; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use primitives::v2::{ AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash, @@ -63,7 +62,7 @@ use frame_system::EnsureRoot; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical as session_historical; -use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; +use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo}; use sp_core::OpaqueMetadata; use sp_mmr_primitives as mmr; use sp_runtime::{ @@ -86,7 +85,6 @@ pub use pallet_balances::Call as BalancesCall; pub use pallet_election_provider_multi_phase::Call as EPMCall; #[cfg(feature = "std")] pub use pallet_staking::StakerStatus; -pub use pallet_timestamp::Call as TimestampCall; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -361,11 +359,6 @@ impl pallet_authorship::Config for Runtime { type EventHandler = (Staking, ImOnline); } -parameter_types! { - pub const Period: BlockNumber = 10 * MINUTES; - pub const Offset: BlockNumber = 0; -} - impl_opaque_keys! { pub struct SessionKeys { pub grandpa: Grandpa, @@ -425,6 +418,8 @@ parameter_types! { /// ... and all of the validators as electable targets. Whilst this is the case, we cannot and /// shall not increase the size of the validator intentions. pub const MaxElectableTargets: u16 = u16::MAX; + pub NposSolutionPriority: TransactionPriority = + Perbill::from_percent(90) * TransactionPriority::max_value(); } generate_solution_type!( @@ -733,8 +728,6 @@ impl pallet_authority_discovery::Config for Runtime { } parameter_types! { - pub NposSolutionPriority: TransactionPriority = - Perbill::from_percent(90) * TransactionPriority::max_value(); pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); } @@ -1159,7 +1152,7 @@ impl parachains_hrmp::Config for Runtime { type Event = Event; type Origin = Origin; type Currency = Balances; - type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo; + type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo; } impl parachains_paras_inherent::Config for Runtime { @@ -1343,7 +1336,6 @@ construct_runtime! { TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, - // Claims. Usable initially. Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 19, diff --git a/runtime/kusama/src/xcm_config.rs b/runtime/kusama/src/xcm_config.rs index 99f1044198f1..14fe36b059bf 100644 --- a/runtime/kusama/src/xcm_config.rs +++ b/runtime/kusama/src/xcm_config.rs @@ -102,8 +102,9 @@ pub type XcmRouter = ( parameter_types! { pub const Kusama: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(KsmLocation::get()) }); pub const Statemine: MultiLocation = Parachain(1000).into(); + pub const Encointer: MultiLocation = Parachain(1001).into(); pub const KusamaForStatemine: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Statemine::get()); - pub const KusamaForEncointer: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Parachain(1001).into()); + pub const KusamaForEncointer: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Encointer::get()); } pub type TrustedTeleporters = (xcm_builder::Case, xcm_builder::Case); diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index 0ca78c98d2af..680160b06bc2 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -8,73 +8,93 @@ build = "build.rs" [dependencies] parity-scale-codec = { version = "3.1.5", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +log = { version = "0.4.17", default-features = false } serde = { version = "1.0.137", default-features = false } serde_derive = { version = "1.0.117", optional = true } +static_assertions = "1.1.0" smallvec = "1.8.0" -log = { version = "0.4.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +beefy-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +beefy-merkle-tree = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +rococo-runtime-constants = { package = "rococo-runtime-constants", path = "./constants", default-features = false } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } - tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -beefy-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -beefy-merkle-tree = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-child-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-gilt = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-society = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-system = {git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false } +pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -rococo-runtime-constants = { package = "rococo-runtime-constants", path = "./constants", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +hex-literal = { version = "0.3.4", optional = true } runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false } +runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false } primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false } polkadot-parachain = { path = "../../parachain", default-features = false } -runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false } xcm = { package = "xcm", path = "../../xcm", default-features = false } xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false } xcm-builder = { package = "xcm-builder", path = "../../xcm/xcm-builder", default-features = false } -pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false } -# Benchmarking Dependencies -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -hex-literal = { version = "0.3.4", optional = true } -frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +[dev-dependencies] +hex-literal = "0.3.4" +tiny-keccak = { version = "2.0.2", features = ["keccak"] } +keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" } +sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } +separator = "0.4.1" +serde_json = "1.0.81" [build-dependencies] substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -84,114 +104,154 @@ default = ["std"] no_std = [] std = [ "authority-discovery-primitives/std", - "babe-primitives/std", + "primitives/std", "parity-scale-codec/std", "scale-info/std", + "inherents/std", + "sp-core/std", + "sp-api/std", + "tx-pool-api/std", + "block-builder-api/std", + "offchain-primitives/std", + "sp-std/std", + "sp-io/std", + "frame-support/std", "frame-executive/std", "pallet-authority-discovery/std", "pallet-authorship/std", - "pallet-babe/std", - "beefy-primitives/std", "pallet-balances/std", - "pallet-collective/std", "pallet-beefy/std", "pallet-beefy-mmr/std", + "pallet-bounties/std", + "pallet-child-bounties/std", + "pallet-transaction-payment/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-collective/std", + "pallet-elections-phragmen/std", + "pallet-democracy/std", + "pallet-gilt/std", "pallet-grandpa/std", - "pallet-sudo/std", + "pallet-identity/std", + "pallet-im-online/std", + "pallet-indices/std", "pallet-membership/std", "pallet-mmr/std", - "pallet-indices/std", - "pallet-im-online/std", - "pallet-session/std", - "pallet-staking/std", + "pallet-multisig/std", "pallet-offences/std", + "pallet-preimage/std", "pallet-proxy/std", + "pallet-recovery/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-society/std", + "pallet-sudo/std", + "pallet-staking/std", "pallet-timestamp/std", - "pallet-transaction-payment/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "inherents/std", - "frame-support/std", + "pallet-tips/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vesting/std", + "pallet-babe/std", + "pallet-xcm/std", "polkadot-parachain/std", - "primitives/std", - "runtime-common/std", - "runtime-parachains/std", - "sp-api/std", - "sp-core/std", - "sp-io/std", "sp-mmr-primitives/std", "sp-runtime/std", - "sp-session/std", "sp-staking/std", - "sp-std/std", "frame-system/std", "frame-system-rpc-runtime-api/std", - "offchain-primitives/std", - "block-builder-api/std", - "tx-pool-api/std", "sp-version/std", "serde_derive", "serde/std", + "log/std", + "babe-primitives/std", + "sp-session/std", + "runtime-common/std", + "runtime-parachains/std", + "beefy-primitives/std", + "rococo-runtime-constants/std", "xcm/std", "xcm-executor/std", "xcm-builder/std", - "pallet-xcm/std", - "pallet-utility/std", - "log/std", - "pallet-multisig/std", ] -# When enabled, the runtime API will not be build. -# -# This is required by Cumulus to access certain types of the -# runtime without clashing with the runtime API exported functions -# in WASM. -disable-runtime-api = [] runtime-benchmarks = [ "runtime-common/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "pallet-babe/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-child-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-gilt/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-membership/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-society/runtime-benchmarks", + "pallet-recovery/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "hex-literal", "frame-system-benchmarking", + "hex-literal", + "xcm-builder/runtime-benchmarks", "runtime-parachains/runtime-benchmarks", + "pallet-xcm-benchmarks", ] try-runtime = [ "frame-executive/try-runtime", - "frame-support/try-runtime", "frame-system/try-runtime", "pallet-authority-discovery/try-runtime", "pallet-authorship/try-runtime", - "pallet-babe/try-runtime", "pallet-balances/try-runtime", + "pallet-bounties/try-runtime", + "pallet-child-bounties/try-runtime", + "pallet-transaction-payment/try-runtime", "pallet-collective/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-democracy/try-runtime", "pallet-grandpa/try-runtime", - "pallet-sudo/try-runtime", - "pallet-indices/try-runtime", + "pallet-identity/try-runtime", "pallet-im-online/try-runtime", + "pallet-indices/try-runtime", "pallet-membership/try-runtime", - "pallet-session/try-runtime", + "pallet-multisig/try-runtime", + "pallet-offences/try-runtime", + "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", + "pallet-recovery/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-society/try-runtime", + "pallet-sudo/try-runtime", "pallet-staking/try-runtime", - "pallet-offences/try-runtime", "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", + "pallet-tips/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", + "pallet-babe/try-runtime", "runtime-common/try-runtime", - "pallet-multisig/try-runtime", ] +# When enabled, the runtime API will not be build. +# +# This is required by Cumulus to access certain types of the +# runtime without clashing with the runtime API exported functions +# in WASM. +disable-runtime-api = [] # Set timing constants (e.g. session period) to faster versions to speed up testing. fast-runtime = [] diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index 02f64e5d8121..7893cada961d 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -22,13 +22,16 @@ pub mod weights; pub mod currency { use primitives::v2::Balance; + /// The existential deposit. + pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; + pub const UNITS: Balance = 1_000_000_000_000; - pub const DOLLARS: Balance = UNITS; - pub const CENTS: Balance = DOLLARS / 100; + pub const CENTS: Balance = UNITS / 30_000; + pub const GRAND: Balance = CENTS * 100_000; pub const MILLICENTS: Balance = CENTS / 1_000; pub const fn deposit(items: u32, bytes: u32) -> Balance { - items as Balance * 1 * DOLLARS + (bytes as Balance) * 5 * MILLICENTS + items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS } } @@ -36,7 +39,6 @@ pub mod currency { pub mod time { use primitives::v2::{BlockNumber, Moment}; use runtime_common::prod_or_fast; - pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; pub const DEFAULT_EPOCH_DURATION: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); @@ -48,6 +50,7 @@ pub mod time { pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); pub const HOURS: BlockNumber = MINUTES * 60; pub const DAYS: BlockNumber = HOURS * 24; + pub const WEEKS: BlockNumber = DAYS * 7; // 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. // The choice of is done in accordance to the slot duration and expected target @@ -83,7 +86,7 @@ pub mod fee { impl WeightToFeePolynomial for WeightToFee { type Balance = Balance; fn polynomial() -> WeightToFeeCoefficients { - // in Westend, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: + // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: let p = super::currency::CENTS; let q = 10 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); smallvec![WeightToFeeCoefficient { @@ -99,7 +102,7 @@ pub mod fee { #[cfg(test)] mod tests { use super::{ - currency::{CENTS, DOLLARS, MILLICENTS}, + currency::{CENTS, MILLICENTS}, fee::WeightToFee, }; use crate::weights::ExtrinsicBaseWeight; @@ -109,10 +112,10 @@ mod tests { #[test] // Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds. fn full_block_fee_is_correct() { - // A full block should cost between 10 and 100 DOLLARS. + // A full block should cost between 1,000 and 10,000 CENTS. let full_block = WeightToFee::weight_to_fee(&MAXIMUM_BLOCK_WEIGHT); - assert!(full_block >= 10 * DOLLARS); - assert!(full_block <= 100 * DOLLARS); + assert!(full_block >= 1_000 * CENTS); + assert!(full_block <= 10_000 * CENTS); } #[test] diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 942ed8667f9b..8c7d02196cf8 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -20,59 +20,66 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; +use primitives::v2::{ + AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash, + CommittedCandidateReceipt, CoreState, DisputeState, GroupRotationInfo, Hash, Id as ParaId, + InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, + PersistedValidationData, ScrapedOnChainVotes, SessionInfo, Signature, ValidationCode, + ValidationCodeHash, ValidatorId, ValidatorIndex, +}; +use runtime_common::{ + assigned_slots, auctions, claims, crowdloan, impl_runtime_weights, impls::ToAuthor, + paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BlockHashCount, BlockLength, + SlowAdjustingFeeUpdate, +}; +use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*}; + +use runtime_parachains::{ + configuration as parachains_configuration, disputes as parachains_disputes, + dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion, + initializer as parachains_initializer, origin as parachains_origin, paras as parachains_paras, + paras_inherent as parachains_paras_inherent, + runtime_api_impl::v2 as parachains_runtime_api_impl, scheduler as parachains_scheduler, + session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump, +}; + use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use beefy_primitives::{ crypto::AuthorityId as BeefyId, mmr::{BeefyDataProvider, MmrLeafVersion}, }; + use frame_support::{ construct_runtime, parameter_types, - traits::{Contains, InstanceFilter, KeyOwnerProofSystem}, - PalletId, + traits::{ + Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, + PrivilegeCmp, + }, + weights::ConstantMultiplier, + PalletId, RuntimeDebug, }; use frame_system::EnsureRoot; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical as session_historical; use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo}; -use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; -use primitives::v2::{ - AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash, - CommittedCandidateReceipt, CoreState, DisputeState, GroupRotationInfo, Hash, Id as ParaId, - InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, - PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionInfo, Signature, - ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature, -}; -use runtime_common::{ - assigned_slots, auctions, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar, - paras_sudo_wrapper, slots, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, -}; -use runtime_parachains::{self, runtime_api_impl::v2 as runtime_api_impl}; -use scale_info::TypeInfo; -use sp_core::{OpaqueMetadata, RuntimeDebug, H256}; +use sp_core::{OpaqueMetadata, H256}; use sp_mmr_primitives as mmr; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{ - AccountIdLookup, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT, Keccak256, - OpaqueKeys, SaturatedConversion, Verify, + AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, Extrinsic as ExtrinsicT, + Keccak256, OpaqueKeys, SaturatedConversion, Verify, }, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, KeyTypeId, + ApplyExtrinsicResult, KeyTypeId, Perbill, Percent, Permill, }; use sp_staking::SessionIndex; -use sp_std::{collections::btree_map::BTreeMap, prelude::*}; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; - -use runtime_parachains::{ - configuration as parachains_configuration, disputes as parachains_disputes, - dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion, - initializer as parachains_initializer, origin as parachains_origin, paras as parachains_paras, - paras_inherent as parachains_paras_inherent, scheduler as parachains_scheduler, - session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump, -}; +use static_assertions::const_assert; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; @@ -80,10 +87,14 @@ pub use pallet_balances::Call as BalancesCall; /// Constant values used within the runtime. use rococo_runtime_constants::{currency::*, fee::*, time::*}; -mod validator_manager; +// Weights used in the runtime. mod weights; + +// XCM configurations. pub mod xcm_config; +mod validator_manager; + impl_runtime_weights!(rococo_runtime_constants); // Make the WASM binary available. @@ -102,7 +113,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { apis: RUNTIME_API_VERSIONS, #[cfg(feature = "disable-runtime-api")] apis: sp_version::create_apis_vec![[]], - transaction_version: 1, + transaction_version: 12, state_version: 0, }; @@ -119,128 +130,7 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -/// The address format for describing accounts. -pub type Address = sp_runtime::MultiAddress; -/// Block header type as expected by this runtime. -pub type Header = generic::Header; -/// Block type as expected by this runtime. -pub type Block = generic::Block; -/// A Block signed with a Justification -pub type SignedBlock = generic::SignedBlock; -/// `BlockId` type as expected by this runtime. -pub type BlockId = generic::BlockId; -/// The `SignedExtension` to the basic transaction logic. -pub type SignedExtra = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckMortality, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, -); - -/// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Executive: handles dispatch to the various modules. -pub type Executive = frame_executive::Executive< - Runtime, - Block, - frame_system::ChainContext, - Runtime, - AllPalletsWithSystem, ->; -/// The payload being signed in transactions. -pub type SignedPayload = generic::SignedPayload; - -impl_opaque_keys! { - pub struct SessionKeys { - pub grandpa: Grandpa, - pub babe: Babe, - pub im_online: ImOnline, - pub para_validator: Initializer, - pub para_assignment: ParaSessionInfo, - pub authority_discovery: AuthorityDiscovery, - pub beefy: Beefy, - } -} - -construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = primitives::v2::Block, - UncheckedExtrinsic = UncheckedExtrinsic - { - System: frame_system, - - // Babe must be before session. - Babe: pallet_babe, - - Timestamp: pallet_timestamp, - Indices: pallet_indices, - Balances: pallet_balances, - TransactionPayment: pallet_transaction_payment, - - // Consensus support. - // Authorship must be before session in order to note author in the correct session for - // im-online. - Authorship: pallet_authorship, - Offences: pallet_offences, - Historical: session_historical, - Session: pallet_session, - Grandpa: pallet_grandpa, - ImOnline: pallet_im_online, - AuthorityDiscovery: pallet_authority_discovery, - - // Parachains modules. - ParachainsOrigin: parachains_origin, - Configuration: parachains_configuration, - ParasShared: parachains_shared, - ParaInclusion: parachains_inclusion, - ParaInherent: parachains_paras_inherent, - ParaScheduler: parachains_scheduler, - Paras: parachains_paras, - Initializer: parachains_initializer, - Dmp: parachains_dmp, - Ump: parachains_ump, - Hrmp: parachains_hrmp, - ParaSessionInfo: parachains_session_info, - ParasDisputes: parachains_disputes, - - // Parachain Onboarding Pallets - Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config}, - Auctions: auctions::{Pallet, Call, Storage, Event}, - Crowdloan: crowdloan::{Pallet, Call, Storage, Event}, - Slots: slots::{Pallet, Call, Storage, Event}, - ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call}, - AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event}, - - // Sudo - Sudo: pallet_sudo, - - // Bridges support. - Mmr: pallet_mmr, - Beefy: pallet_beefy, - MmrLeaf: pallet_beefy_mmr, - - // Validator Manager pallet. - ValidatorManager: validator_manager, - - // A "council" - Collective: pallet_collective = 80, - Membership: pallet_membership = 81, - - Utility: pallet_utility = 90, - Proxy: pallet_proxy = 91, - Multisig: pallet_multisig, - - // Pallet for sending XCM. - XcmPallet: pallet_xcm = 99, - - } -} - +/// We currently allow all calls. pub struct BaseFilter; impl Contains for BaseFilter { fn contains(_call: &Call) -> bool { @@ -281,110 +171,118 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const ValidationUpgradeFrequency: BlockNumber = 2 * DAYS; - pub const ValidationUpgradeDelay: BlockNumber = 8 * HOURS; - pub const SlashPeriod: BlockNumber = 7 * DAYS; + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * + BlockWeights::get().max_block; + pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); } -/// Submits a transaction with the node's public and signature type. Adheres to the signed extension -/// format of the chain. -impl frame_system::offchain::CreateSignedTransaction for Runtime -where - Call: From, -{ - fn create_transaction>( - call: Call, - public: ::Signer, - account: AccountId, - nonce: ::Index, - ) -> Option<(Call, ::SignaturePayload)> { - use sp_runtime::traits::StaticLookup; - // take the biggest period possible. - let period = - BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; +type ScheduleOrigin = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, +>; - let current_block = System::block_number() - .saturated_into::() - // The `System::block_number` is initialized with `n+1`, - // so the actual block number is `n`. - .saturating_sub(1); - let tip = 0; - let extra: SignedExtra = ( - frame_system::CheckNonZeroSender::::new(), - frame_system::CheckSpecVersion::::new(), - frame_system::CheckTxVersion::::new(), - frame_system::CheckGenesis::::new(), - frame_system::CheckMortality::::from(generic::Era::mortal( - period, - current_block, - )), - frame_system::CheckNonce::::from(nonce), - frame_system::CheckWeight::::new(), - pallet_transaction_payment::ChargeTransactionPayment::::from(tip), - ); - let raw_payload = SignedPayload::new(call, extra) - .map_err(|e| { - log::warn!("Unable to create signed payload: {:?}", e); - }) - .ok()?; - let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?; - let (call, extra, _) = raw_payload.deconstruct(); - let address = ::Lookup::unlookup(account); - Some((call, (address, signature, extra))) - } -} +/// Used the compare the privilege of an origin inside the scheduler. +pub struct OriginPrivilegeCmp; -impl frame_system::offchain::SigningTypes for Runtime { - type Public = ::Signer; - type Signature = Signature; -} +impl PrivilegeCmp for OriginPrivilegeCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(Ordering::Equal) + } -/// Special `FullIdentificationOf` implementation that is returning for every input `Some(Default::default())`. -pub struct FullIdentificationOf; -impl sp_runtime::traits::Convert> for FullIdentificationOf { - fn convert(_: AccountId) -> Option<()> { - Some(Default::default()) + match (left, right) { + // Root is greater than anything. + (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), + // Check which one has more yes votes. + ( + OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), + OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), + // For every other origin we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } } } -impl pallet_session::historical::Config for Runtime { - type FullIdentification = (); - type FullIdentificationOf = FullIdentificationOf; +impl pallet_scheduler::Config for Runtime { + type Event = Event; + type Origin = Origin; + type PalletsOrigin = OriginCaller; + type Call = Call; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = ScheduleOrigin; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type WeightInfo = weights::pallet_scheduler::WeightInfo; + type OriginPrivilegeCmp = OriginPrivilegeCmp; + type PreimageProvider = Preimage; + type NoPreimagePostponement = NoPreimagePostponement; } -impl parachains_disputes::Config for Runtime { +parameter_types! { + pub const PreimageMaxSize: u32 = 4096 * 1024; + pub const PreimageBaseDeposit: Balance = deposit(2, 64); + pub const PreimageByteDeposit: Balance = deposit(0, 1); +} + +impl pallet_preimage::Config for Runtime { + type WeightInfo = weights::pallet_preimage::WeightInfo; type Event = Event; - type RewardValidators = (); - type PunishValidators = (); - type WeightInfo = weights::runtime_parachains_disputes::WeightInfo; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type MaxSize = PreimageMaxSize; + type BaseDeposit = PreimageBaseDeposit; + type ByteDeposit = PreimageByteDeposit; } parameter_types! { - pub SessionDuration: BlockNumber = EpochDurationInBlocks::get() as _; + pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; + pub ReportLongevity: u64 = EpochDurationInBlocks::get() as u64 * 10; +} + +impl pallet_babe::Config for Runtime { + type EpochDuration = EpochDurationInBlocks; + type ExpectedBlockTime = ExpectedBlockTime; + + // session module is the trigger + type EpochChangeTrigger = pallet_babe::ExternalTrigger; + + type DisabledValidators = Session; + + type KeyOwnerProof = >::Proof; + + type KeyOwnerIdentification = >::IdentificationTuple; + + type KeyOwnerProofSystem = Historical; + + type HandleEquivocation = + pallet_babe::EquivocationHandler; + + type WeightInfo = (); + + type MaxAuthorities = MaxAuthorities; } parameter_types! { - pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); - pub const MaxKeys: u32 = 10_000; - pub const MaxPeerInHeartbeats: u32 = 10_000; - pub const MaxPeerDataEncodingSize: u32 = 1_000; + pub const IndexDeposit: Balance = 100 * CENTS; } -impl pallet_im_online::Config for Runtime { - type AuthorityId = ImOnlineId; +impl pallet_indices::Config for Runtime { + type AccountIndex = AccountIndex; + type Currency = Balances; + type Deposit = IndexDeposit; type Event = Event; - type ValidatorSet = Historical; - type NextSessionRotation = Babe; - type ReportUnresponsiveness = Offences; - type UnsignedPriority = ImOnlineUnsignedPriority; - type WeightInfo = weights::pallet_im_online::WeightInfo; - type MaxKeys = MaxKeys; - type MaxPeerInHeartbeats = MaxPeerInHeartbeats; - type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; + type WeightInfo = weights::pallet_indices::WeightInfo; } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * CENTS; + pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; } @@ -401,27 +299,20 @@ impl pallet_balances::Config for Runtime { type WeightInfo = weights::pallet_balances::WeightInfo; } -impl frame_system::offchain::SendTransactionTypes for Runtime -where - Call: From, -{ - type OverarchingCall = Call; - type Extrinsic = UncheckedExtrinsic; -} - parameter_types! { - pub const MaxRetries: u32 = 3; - pub const MaxAuthorities: u32 = 100_000; + pub const TransactionByteFee: Balance = 10 * MILLICENTS; + /// This value increases the priority of `Operational` transactions by adding + /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`. + pub const OperationalFeeMultiplier: u8 = 5; } -impl pallet_offences::Config for Runtime { +impl pallet_transaction_payment::Config for Runtime { type Event = Event; - type IdentificationTuple = pallet_session::historical::IdentificationTuple; - type OnOffenceHandler = (); -} - -impl pallet_authority_discovery::Config for Runtime { - type MaxAuthorities = MaxAuthorities; + type OnChargeTransaction = CurrencyAdapter>; + type OperationalFeeMultiplier = OperationalFeeMultiplier; + type WeightToFee = WeightToFee; + type LengthToFee = ConstantMultiplier; + type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } parameter_types! { @@ -435,19 +326,26 @@ impl pallet_timestamp::Config for Runtime { } parameter_types! { - pub const TransactionByteFee: Balance = 10 * MILLICENTS; - /// This value increases the priority of `Operational` transactions by adding - /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`. - pub const OperationalFeeMultiplier: u8 = 5; + pub const UncleGenerations: u32 = 0; } -impl pallet_transaction_payment::Config for Runtime { - type Event = Event; - type OnChargeTransaction = CurrencyAdapter>; - type OperationalFeeMultiplier = OperationalFeeMultiplier; - type WeightToFee = WeightToFee; - type LengthToFee = frame_support::weights::ConstantMultiplier; - type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; +impl pallet_authorship::Config for Runtime { + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type UncleGenerations = UncleGenerations; + type FilterUncle = (); + type EventHandler = ImOnline; +} + +impl_opaque_keys! { + pub struct SessionKeys { + pub grandpa: Grandpa, + pub babe: Babe, + pub im_online: ImOnline, + pub para_validator: Initializer, + pub para_assignment: ParaSessionInfo, + pub authority_discovery: AuthorityDiscovery, + pub beefy: Beefy, + } } /// Special `ValidatorIdOf` implementation that is just returning the input as result. @@ -467,92 +365,654 @@ impl pallet_session::Config for Runtime { type SessionManager = pallet_session::historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type WeightInfo = (); + type WeightInfo = weights::pallet_session::WeightInfo; +} + +pub struct FullIdentificationOf; +impl sp_runtime::traits::Convert> for FullIdentificationOf { + fn convert(_: AccountId) -> Option<()> { + Some(Default::default()) + } +} + +impl pallet_session::historical::Config for Runtime { + type FullIdentification = (); + type FullIdentificationOf = FullIdentificationOf; } parameter_types! { - pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; - pub ReportLongevity: u64 = EpochDurationInBlocks::get() as u64 * 10; + pub const SessionsPerEra: SessionIndex = 6; + pub const BondingDuration: sp_staking::EraIndex = 28; } -impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDurationInBlocks; - type ExpectedBlockTime = ExpectedBlockTime; +parameter_types! { + pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "ROC_LAUNCH_PERIOD"); + pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "ROC_VOTING_PERIOD"); + pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "ROC_FAST_TRACK_VOTING_PERIOD"); + pub const MinimumDeposit: Balance = 100 * CENTS; + pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "ROC_ENACTMENT_PERIOD"); + pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "ROC_COOLOFF_PERIOD"); + pub const InstantAllowed: bool = true; + pub const MaxVotes: u32 = 100; + pub const MaxProposals: u32 = 100; +} - // session module is the trigger - type EpochChangeTrigger = pallet_babe::ExternalTrigger; +impl pallet_democracy::Config for Runtime { + type Proposal = Call; + type Event = Event; + type Currency = Balances; + type EnactmentPeriod = EnactmentPeriod; + type VoteLockingPeriod = EnactmentPeriod; + type LaunchPeriod = LaunchPeriod; + type VotingPeriod = VotingPeriod; + type MinimumDeposit = MinimumDeposit; + /// A straight majority of the council can decide what their next motion is. + type ExternalOrigin = + pallet_collective::EnsureProportionAtLeast; + /// A majority can have the next scheduled referendum be a straight majority-carries vote. + type ExternalMajorityOrigin = + pallet_collective::EnsureProportionAtLeast; + /// A unanimous council can have the next scheduled referendum be a straight default-carries + /// (NTB) vote. + type ExternalDefaultOrigin = + pallet_collective::EnsureProportionAtLeast; + /// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote + /// be tabled immediately and with a shorter voting/enactment period. + type FastTrackOrigin = + pallet_collective::EnsureProportionAtLeast; + type InstantOrigin = + pallet_collective::EnsureProportionAtLeast; + type InstantAllowed = InstantAllowed; + type FastTrackVotingPeriod = FastTrackVotingPeriod; + // To cancel a proposal which has been passed, 2/3 of the council must agree to it. + type CancellationOrigin = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, + >; + type BlacklistOrigin = EnsureRoot; + // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // Root must agree. + type CancelProposalOrigin = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, + >; + // Any single technical committee member may veto a coming council proposal, however they can + // only do it once and it lasts only for the cooloff period. + type VetoOrigin = pallet_collective::EnsureMember; + type CooloffPeriod = CooloffPeriod; + type PreimageByteDeposit = PreimageByteDeposit; + type OperationalPreimageOrigin = pallet_collective::EnsureMember; + type Slash = Treasury; + type Scheduler = Scheduler; + type PalletsOrigin = OriginCaller; + type MaxVotes = MaxVotes; + type WeightInfo = weights::pallet_democracy::WeightInfo; + type MaxProposals = MaxProposals; +} - type DisabledValidators = Session; +parameter_types! { + pub CouncilMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "ROC_MOTION_DURATION"); + pub const CouncilMaxProposals: u32 = 100; + pub const CouncilMaxMembers: u32 = 100; +} - type KeyOwnerProofSystem = Historical; +type CouncilCollective = pallet_collective::Instance1; +impl pallet_collective::Config for Runtime { + type Origin = Origin; + type Proposal = Call; + type Event = Event; + type MotionDuration = CouncilMotionDuration; + type MaxProposals = CouncilMaxProposals; + type MaxMembers = CouncilMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::pallet_collective_council::WeightInfo; +} - type KeyOwnerProof = >::Proof; +parameter_types! { + pub const CandidacyBond: Balance = 100 * CENTS; + // 1 storage item created, key size is 32 bytes, value size is 16+16. + pub const VotingBondBase: Balance = deposit(1, 64); + // additional data per vote is 32 bytes (account id). + pub const VotingBondFactor: Balance = deposit(0, 32); + /// Daily council elections + pub TermDuration: BlockNumber = prod_or_fast!(24 * HOURS, 2 * MINUTES, "ROC_TERM_DURATION"); + pub const DesiredMembers: u32 = 19; + pub const DesiredRunnersUp: u32 = 19; + pub const MaxVoters: u32 = 10 * 1000; + pub const MaxCandidates: u32 = 1000; + pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; +} + +// Make sure that there are no more than MaxMembers members elected via phragmen. +const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); + +impl pallet_elections_phragmen::Config for Runtime { + type Event = Event; + type Currency = Balances; + type ChangeMembers = Council; + type InitializeMembers = Council; + type CurrencyToVote = frame_support::traits::U128CurrencyToVote; + type CandidacyBond = CandidacyBond; + type VotingBondBase = VotingBondBase; + type VotingBondFactor = VotingBondFactor; + type LoserCandidate = Treasury; + type KickedMember = Treasury; + type DesiredMembers = DesiredMembers; + type DesiredRunnersUp = DesiredRunnersUp; + type TermDuration = TermDuration; + type MaxVoters = MaxVoters; + type MaxCandidates = MaxCandidates; + type PalletId = PhragmenElectionPalletId; + type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; +} + +parameter_types! { + pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "ROC_MOTION_DURATION"); + pub const TechnicalMaxProposals: u32 = 100; + pub const TechnicalMaxMembers: u32 = 100; +} + +type TechnicalCollective = pallet_collective::Instance2; +impl pallet_collective::Config for Runtime { + type Origin = Origin; + type Proposal = Call; + type Event = Event; + type MotionDuration = TechnicalMotionDuration; + type MaxProposals = TechnicalMaxProposals; + type MaxMembers = TechnicalMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; +} + +type MoreThanHalfCouncil = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, +>; + +impl pallet_membership::Config for Runtime { + type Event = Event; + type AddOrigin = MoreThanHalfCouncil; + type RemoveOrigin = MoreThanHalfCouncil; + type SwapOrigin = MoreThanHalfCouncil; + type ResetOrigin = MoreThanHalfCouncil; + type PrimeOrigin = MoreThanHalfCouncil; + type MembershipInitialized = TechnicalCommittee; + type MembershipChanged = TechnicalCommittee; + type MaxMembers = TechnicalMaxMembers; + type WeightInfo = weights::pallet_membership::WeightInfo; +} + +parameter_types! { + pub const ProposalBond: Permill = Permill::from_percent(5); + pub const ProposalBondMinimum: Balance = 2000 * CENTS; + pub const ProposalBondMaximum: Balance = 1 * GRAND; + pub const SpendPeriod: BlockNumber = 6 * DAYS; + pub const Burn: Permill = Permill::from_perthousand(2); + pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); + + pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipFindersFee: Percent = Percent::from_percent(20); + pub const TipReportDepositBase: Balance = 100 * CENTS; + pub const DataDepositPerByte: Balance = 1 * CENTS; + pub const MaxApprovals: u32 = 100; + pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; +} + +type ApproveOrigin = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, +>; + +impl pallet_treasury::Config for Runtime { + type PalletId = TreasuryPalletId; + type Currency = Balances; + type ApproveOrigin = ApproveOrigin; + type RejectOrigin = MoreThanHalfCouncil; + type Event = Event; + type OnSlash = Treasury; + type ProposalBond = ProposalBond; + type ProposalBondMinimum = ProposalBondMinimum; + type ProposalBondMaximum = ProposalBondMaximum; + type SpendPeriod = SpendPeriod; + type Burn = Burn; + type BurnDestination = Society; + type MaxApprovals = MaxApprovals; + type WeightInfo = weights::pallet_treasury::WeightInfo; + type SpendFunds = Bounties; + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; +} + +parameter_types! { + pub const BountyDepositBase: Balance = 100 * CENTS; + pub const BountyDepositPayoutDelay: BlockNumber = 4 * DAYS; + pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; + pub const MaximumReasonLength: u32 = 16384; + pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); + pub const CuratorDepositMin: Balance = 10 * CENTS; + pub const CuratorDepositMax: Balance = 500 * CENTS; + pub const BountyValueMinimum: Balance = 200 * CENTS; +} + +impl pallet_bounties::Config for Runtime { + type BountyDepositBase = BountyDepositBase; + type BountyDepositPayoutDelay = BountyDepositPayoutDelay; + type BountyUpdatePeriod = BountyUpdatePeriod; + type CuratorDepositMultiplier = CuratorDepositMultiplier; + type CuratorDepositMin = CuratorDepositMin; + type CuratorDepositMax = CuratorDepositMax; + type BountyValueMinimum = BountyValueMinimum; + type ChildBountyManager = ChildBounties; + type DataDepositPerByte = DataDepositPerByte; + type Event = Event; + type MaximumReasonLength = MaximumReasonLength; + type WeightInfo = weights::pallet_bounties::WeightInfo; +} + +parameter_types! { + pub const MaxActiveChildBountyCount: u32 = 100; + pub const ChildBountyValueMinimum: Balance = BountyValueMinimum::get() / 10; +} + +impl pallet_child_bounties::Config for Runtime { + type Event = Event; + type MaxActiveChildBountyCount = MaxActiveChildBountyCount; + type ChildBountyValueMinimum = ChildBountyValueMinimum; + type WeightInfo = weights::pallet_child_bounties::WeightInfo; +} + +impl pallet_tips::Config for Runtime { + type MaximumReasonLength = MaximumReasonLength; + type DataDepositPerByte = DataDepositPerByte; + type Tippers = PhragmenElection; + type TipCountdown = TipCountdown; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = TipReportDepositBase; + type Event = Event; + type WeightInfo = weights::pallet_tips::WeightInfo; +} + +impl pallet_offences::Config for Runtime { + type Event = Event; + type IdentificationTuple = pallet_session::historical::IdentificationTuple; + type OnOffenceHandler = (); +} + +impl pallet_authority_discovery::Config for Runtime { + type MaxAuthorities = MaxAuthorities; +} + +parameter_types! { + pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); +} + +impl pallet_im_online::Config for Runtime { + type AuthorityId = ImOnlineId; + type Event = Event; + type ValidatorSet = Historical; + type NextSessionRotation = Babe; + type ReportUnresponsiveness = Offences; + type UnsignedPriority = ImOnlineUnsignedPriority; + type WeightInfo = weights::pallet_im_online::WeightInfo; + type MaxKeys = MaxKeys; + type MaxPeerInHeartbeats = MaxPeerInHeartbeats; + type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; +} + +impl pallet_grandpa::Config for Runtime { + type Event = Event; + type Call = Call; + + type KeyOwnerProof = + >::Proof; type KeyOwnerIdentification = >::IdentificationTuple; - type HandleEquivocation = - pallet_babe::EquivocationHandler; + type KeyOwnerProofSystem = Historical; - type WeightInfo = (); + type HandleEquivocation = pallet_grandpa::EquivocationHandler< + Self::KeyOwnerIdentification, + Offences, + ReportLongevity, + >; + type WeightInfo = (); type MaxAuthorities = MaxAuthorities; } +/// Submits a transaction with the node's public and signature type. Adheres to the signed extension +/// format of the chain. +impl frame_system::offchain::CreateSignedTransaction for Runtime +where + Call: From, +{ + fn create_transaction>( + call: Call, + public: ::Signer, + account: AccountId, + nonce: ::Index, + ) -> Option<(Call, ::SignaturePayload)> { + use sp_runtime::traits::StaticLookup; + // take the biggest period possible. + let period = + BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; + + let current_block = System::block_number() + .saturated_into::() + // The `System::block_number` is initialized with `n+1`, + // so the actual block number is `n`. + .saturating_sub(1); + let tip = 0; + let extra: SignedExtra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckMortality::::from(generic::Era::mortal( + period, + current_block, + )), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + ); + let raw_payload = SignedPayload::new(call, extra) + .map_err(|e| { + log::warn!("Unable to create signed payload: {:?}", e); + }) + .ok()?; + let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?; + let (call, extra, _) = raw_payload.deconstruct(); + let address = ::Lookup::unlookup(account); + Some((call, (address, signature, extra))) + } +} + +impl frame_system::offchain::SigningTypes for Runtime { + type Public = ::Signer; + type Signature = Signature; +} + +impl frame_system::offchain::SendTransactionTypes for Runtime +where + Call: From, +{ + type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = Call; +} + parameter_types! { - pub const IndexDeposit: Balance = 1 * DOLLARS; + pub Prefix: &'static [u8] = b"Pay ROCs to the Rococo account:"; } -impl pallet_indices::Config for Runtime { - type AccountIndex = AccountIndex; +impl claims::Config for Runtime { + type Event = Event; + type VestingSchedule = Vesting; + type Prefix = Prefix; + type MoveClaimOrigin = + pallet_collective::EnsureProportionMoreThan; + type WeightInfo = weights::runtime_common_claims::WeightInfo; +} + +parameter_types! { + // Minimum 100 bytes/ROC deposited (1 CENT/byte) + pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain + pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain + pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain + pub const MaxSubAccounts: u32 = 100; + pub const MaxAdditionalFields: u32 = 100; + pub const MaxRegistrars: u32 = 20; +} + +impl pallet_identity::Config for Runtime { + type Event = Event; type Currency = Balances; - type Deposit = IndexDeposit; + type BasicDeposit = BasicDeposit; + type FieldDeposit = FieldDeposit; + type SubAccountDeposit = SubAccountDeposit; + type MaxSubAccounts = MaxSubAccounts; + type MaxAdditionalFields = MaxAdditionalFields; + type MaxRegistrars = MaxRegistrars; + type Slashed = Treasury; + type ForceOrigin = MoreThanHalfCouncil; + type RegistrarOrigin = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_identity::WeightInfo; +} + +impl pallet_utility::Config for Runtime { type Event = Event; - type WeightInfo = weights::pallet_indices::WeightInfo; + type Call = Call; + type PalletsOrigin = OriginCaller; + type WeightInfo = weights::pallet_utility::WeightInfo; } parameter_types! { - pub const AttestationPeriod: BlockNumber = 50; + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + pub const DepositBase: Balance = deposit(1, 88); + // Additional storage item size of 32 bytes. + pub const DepositFactor: Balance = deposit(0, 32); + pub const MaxSignatories: u16 = 100; +} + +impl pallet_multisig::Config for Runtime { + type Event = Event; + type Call = Call; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type WeightInfo = weights::pallet_multisig::WeightInfo; +} + +parameter_types! { + pub const ConfigDepositBase: Balance = 500 * CENTS; + pub const FriendDepositFactor: Balance = 50 * CENTS; + pub const MaxFriends: u16 = 9; + pub const RecoveryDeposit: Balance = 500 * CENTS; +} + +impl pallet_recovery::Config for Runtime { + type Event = Event; + type WeightInfo = (); + type Call = Call; + type Currency = Balances; + type ConfigDepositBase = ConfigDepositBase; + type FriendDepositFactor = FriendDepositFactor; + type MaxFriends = MaxFriends; + type RecoveryDeposit = RecoveryDeposit; +} + +parameter_types! { + pub const CandidateDeposit: Balance = 1000 * CENTS; + pub const WrongSideDeduction: Balance = 200 * CENTS; + pub const MaxStrikes: u32 = 10; + pub const RotationPeriod: BlockNumber = 7 * DAYS; + pub const PeriodSpend: Balance = 50000 * CENTS; + pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS; + pub const ChallengePeriod: BlockNumber = 7 * DAYS; + pub const MaxCandidateIntake: u32 = 1; + pub const SocietyPalletId: PalletId = PalletId(*b"py/socie"); +} + +impl pallet_society::Config for Runtime { + type Event = Event; + type Currency = Balances; + type Randomness = pallet_babe::RandomnessFromOneEpochAgo; + type CandidateDeposit = CandidateDeposit; + type WrongSideDeduction = WrongSideDeduction; + type MaxStrikes = MaxStrikes; + type PeriodSpend = PeriodSpend; + type MembershipChanged = (); + type RotationPeriod = RotationPeriod; + type MaxLockDuration = MaxLockDuration; + type FounderSetOrigin = + pallet_collective::EnsureProportionMoreThan; + type SuspensionJudgementOrigin = pallet_society::EnsureFounder; + type ChallengePeriod = ChallengePeriod; + type MaxCandidateIntake = MaxCandidateIntake; + type PalletId = SocietyPalletId; +} + +parameter_types! { + pub const MinVestedTransfer: Balance = 100 * CENTS; +} + +impl pallet_vesting::Config for Runtime { + type Event = Event; + type Currency = Balances; + type BlockNumberToBalance = ConvertInto; + type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = weights::pallet_vesting::WeightInfo; + const MAX_VESTING_SCHEDULES: u32 = 28; +} + +parameter_types! { + // One storage item; key size 32, value size 8; . + pub const ProxyDepositBase: Balance = deposit(1, 8); + // Additional storage item size of 33 bytes. + pub const ProxyDepositFactor: Balance = deposit(0, 33); + pub const MaxProxies: u16 = 32; + pub const AnnouncementDepositBase: Balance = deposit(1, 8); + pub const AnnouncementDepositFactor: Balance = deposit(0, 66); + pub const MaxPending: u16 = 32; +} + +/// The type used to represent the kinds of proxying allowed. +#[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + Encode, + Decode, + RuntimeDebug, + MaxEncodedLen, + scale_info::TypeInfo, +)] +pub enum ProxyType { + Any, + NonTransfer, + Governance, + IdentityJudgement, + CancelProxy, + Auction, + Society, +} +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} +impl InstanceFilter for ProxyType { + fn filter(&self, c: &Call) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => matches!( + c, + Call::System(..) | + Call::Babe(..) | + Call::Timestamp(..) | + Call::Indices(pallet_indices::Call::claim {..}) | + Call::Indices(pallet_indices::Call::free {..}) | + Call::Indices(pallet_indices::Call::freeze {..}) | + // Specifically omitting Indices `transfer`, `force_transfer` + // Specifically omitting the entire Balances pallet + Call::Authorship(..) | + Call::Session(..) | + Call::Grandpa(..) | + Call::ImOnline(..) | + Call::Democracy(..) | + Call::Council(..) | + Call::TechnicalCommittee(..) | + Call::PhragmenElection(..) | + Call::TechnicalMembership(..) | + Call::Treasury(..) | + Call::Bounties(..) | + Call::ChildBounties(..) | + Call::Tips(..) | + Call::Claims(..) | + Call::Utility(..) | + Call::Identity(..) | + Call::Society(..) | + Call::Recovery(pallet_recovery::Call::as_recovered {..}) | + Call::Recovery(pallet_recovery::Call::vouch_recovery {..}) | + Call::Recovery(pallet_recovery::Call::claim_recovery {..}) | + Call::Recovery(pallet_recovery::Call::close_recovery {..}) | + Call::Recovery(pallet_recovery::Call::remove_recovery {..}) | + Call::Recovery(pallet_recovery::Call::cancel_recovered {..}) | + // Specifically omitting Recovery `create_recovery`, `initiate_recovery` + Call::Vesting(pallet_vesting::Call::vest {..}) | + Call::Vesting(pallet_vesting::Call::vest_other {..}) | + // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` + Call::Scheduler(..) | + Call::Proxy(..) | + Call::Multisig(..) | + Call::Gilt(..) | + Call::Registrar(paras_registrar::Call::register {..}) | + Call::Registrar(paras_registrar::Call::deregister {..}) | + // Specifically omitting Registrar `swap` + Call::Registrar(paras_registrar::Call::reserve {..}) | + Call::Crowdloan(..) | + Call::Slots(..) | + Call::Auctions(..) // Specifically omitting the entire XCM Pallet + ), + ProxyType::Governance => matches!( + c, + Call::Democracy(..) | + Call::Council(..) | Call::TechnicalCommittee(..) | + Call::PhragmenElection(..) | + Call::Treasury(..) | Call::Bounties(..) | + Call::Tips(..) | Call::Utility(..) | + Call::ChildBounties(..) + ), + ProxyType::IdentityJudgement => matches!( + c, + Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) + ), + ProxyType::CancelProxy => { + matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) + }, + ProxyType::Auction => matches!( + c, + Call::Auctions { .. } | + Call::Crowdloan { .. } | + Call::Registrar { .. } | + Call::Multisig(..) | Call::Slots { .. } + ), + ProxyType::Society => matches!(c, Call::Society(..)), + } + } + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, _) => true, + _ => false, + } + } } -impl pallet_grandpa::Config for Runtime { +impl pallet_proxy::Config for Runtime { type Event = Event; type Call = Call; - - type KeyOwnerProofSystem = Historical; - - type KeyOwnerProof = - >::Proof; - - type KeyOwnerIdentification = >::IdentificationTuple; - - type HandleEquivocation = pallet_grandpa::EquivocationHandler< - Self::KeyOwnerIdentification, - Offences, - ReportLongevity, - >; - - type WeightInfo = (); - type MaxAuthorities = MaxAuthorities; -} - -parameter_types! { - pub const UncleGenerations: u32 = 0; -} - -impl pallet_authorship::Config for Runtime { - type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = UncleGenerations; - type FilterUncle = (); - type EventHandler = ImOnline; + type Currency = Balances; + type ProxyType = ProxyType; + type ProxyDepositBase = ProxyDepositBase; + type ProxyDepositFactor = ProxyDepositFactor; + type MaxProxies = MaxProxies; + type WeightInfo = weights::pallet_proxy::WeightInfo; + type MaxPending = MaxPending; + type CallHasher = BlakeTwo256; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; } impl parachains_origin::Config for Runtime {} @@ -563,6 +1023,10 @@ impl parachains_configuration::Config for Runtime { impl parachains_shared::Config for Runtime {} +impl parachains_session_info::Config for Runtime { + type ValidatorSet = Historical; +} + /// Special `RewardValidators` that does nothing ;) pub struct RewardValidators; impl runtime_parachains::inclusion::RewardValidators for RewardValidators { @@ -587,10 +1051,6 @@ impl parachains_paras::Config for Runtime { type NextSessionRotation = Babe; } -impl parachains_session_info::Config for Runtime { - type ValidatorSet = Historical; -} - parameter_types! { pub const FirstMessageFactorPercent: u64 = 100; } @@ -625,30 +1085,15 @@ impl parachains_initializer::Config for Runtime { type WeightInfo = weights::runtime_parachains_initializer::WeightInfo; } -impl paras_sudo_wrapper::Config for Runtime {} - -parameter_types! { - pub const PermanentSlotLeasePeriodLength: u32 = 365; - pub const TemporarySlotLeasePeriodLength: u32 = 3; - pub const MaxPermanentSlots: u32 = 25; - pub const MaxTemporarySlots: u32 = 20; - pub const MaxTemporarySlotPerLeasePeriod: u32 = 5; -} - -impl assigned_slots::Config for Runtime { +impl parachains_disputes::Config for Runtime { type Event = Event; - type AssignSlotOrigin = EnsureRoot; - type Leaser = Slots; - type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength; - type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength; - type MaxPermanentSlots = MaxPermanentSlots; - type MaxTemporarySlots = MaxTemporarySlots; - type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod; + type RewardValidators = (); + type PunishValidators = (); + type WeightInfo = weights::runtime_parachains_disputes::WeightInfo; } parameter_types! { - pub const ParaDeposit: Balance = 5 * DOLLARS; - pub const DataDepositPerByte: Balance = deposit(0, 1); + pub const ParaDeposit: Balance = 40 * UNITS; } impl paras_registrar::Config for Runtime { @@ -661,6 +1106,94 @@ impl paras_registrar::Config for Runtime { type WeightInfo = weights::runtime_common_paras_registrar::WeightInfo; } +parameter_types! { + pub LeasePeriod: BlockNumber = prod_or_fast!(1 * DAYS, 1 * DAYS, "ROC_LEASE_PERIOD"); +} + +impl slots::Config for Runtime { + type Event = Event; + type Currency = Balances; + type Registrar = Registrar; + type LeasePeriod = LeasePeriod; + type LeaseOffset = (); + type ForceOrigin = MoreThanHalfCouncil; + type WeightInfo = weights::runtime_common_slots::WeightInfo; +} + +parameter_types! { + pub const CrowdloanId: PalletId = PalletId(*b"py/cfund"); + pub const SubmissionDeposit: Balance = 3 * GRAND; + pub const MinContribution: Balance = 3_000 * CENTS; + pub const RemoveKeysLimit: u32 = 1000; + // Allow 32 bytes for an additional memo to a crowdloan. + pub const MaxMemoLength: u8 = 32; +} + +impl crowdloan::Config for Runtime { + type Event = Event; + type PalletId = CrowdloanId; + type SubmissionDeposit = SubmissionDeposit; + type MinContribution = MinContribution; + type RemoveKeysLimit = RemoveKeysLimit; + type Registrar = Registrar; + type Auctioneer = Auctions; + type MaxMemoLength = MaxMemoLength; + type WeightInfo = weights::runtime_common_crowdloan::WeightInfo; +} + +parameter_types! { + // The average auction is 7 days long, so this will be 70% for ending period. + // 5 Days = 72000 Blocks @ 6 sec per block + pub const EndingPeriod: BlockNumber = 5 * DAYS; + // ~ 1000 samples per day -> ~ 20 blocks per sample -> 2 minute samples + pub const SampleLength: BlockNumber = 2 * MINUTES; +} + +type AuctionInitiate = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, +>; + +impl auctions::Config for Runtime { + type Event = Event; + type Leaser = Slots; + type Registrar = Registrar; + type EndingPeriod = EndingPeriod; + type SampleLength = SampleLength; + type Randomness = pallet_babe::RandomnessFromOneEpochAgo; + type InitiateOrigin = AuctionInitiate; + type WeightInfo = weights::runtime_common_auctions::WeightInfo; +} + +parameter_types! { + pub IgnoredIssuance: Balance = Treasury::pot(); + pub const QueueCount: u32 = 300; + pub const MaxQueueLen: u32 = 1000; + pub const FifoQueueLen: u32 = 250; + pub const GiltPeriod: BlockNumber = 30 * DAYS; + pub const MinFreeze: Balance = 10_000 * CENTS; + pub const IntakePeriod: BlockNumber = 5 * MINUTES; + pub const MaxIntakeBids: u32 = 100; +} + +impl pallet_gilt::Config for Runtime { + type Event = Event; + type Currency = Balances; + type CurrencyBalance = Balance; + type AdminOrigin = MoreThanHalfCouncil; + type Deficit = (); // Mint + type Surplus = (); // Burn + type IgnoredIssuance = IgnoredIssuance; + type QueueCount = QueueCount; + type MaxQueueLen = MaxQueueLen; + type FifoQueueLen = FifoQueueLen; + type Period = GiltPeriod; + type MinFreeze = MinFreeze; + type IntakePeriod = IntakePeriod; + type MaxIntakeBids = MaxIntakeBids; + type WeightInfo = weights::pallet_gilt::WeightInfo; +} + impl pallet_beefy::Config for Runtime { type BeefyId = BeefyId; type MaxAuthorities = MaxAuthorities; @@ -717,60 +1250,25 @@ impl pallet_beefy_mmr::Config for Runtime { type BeefyDataProvider = ParasProvider; } -parameter_types! { - pub const EndingPeriod: BlockNumber = 1 * HOURS; - pub const SampleLength: BlockNumber = 1; -} - -impl auctions::Config for Runtime { - type Event = Event; - type Leaser = Slots; - type Registrar = Registrar; - type EndingPeriod = EndingPeriod; - type SampleLength = SampleLength; - type Randomness = pallet_babe::RandomnessFromOneEpochAgo; - type InitiateOrigin = EnsureRoot; - type WeightInfo = weights::runtime_common_auctions::WeightInfo; -} - -parameter_types! { - pub const LeasePeriod: BlockNumber = 1 * DAYS; -} - -impl slots::Config for Runtime { - type Event = Event; - type Currency = Balances; - type Registrar = Registrar; - type LeasePeriod = LeasePeriod; - type LeaseOffset = (); - type ForceOrigin = EnsureRoot; - type WeightInfo = weights::runtime_common_slots::WeightInfo; -} +impl paras_sudo_wrapper::Config for Runtime {} parameter_types! { - pub const CrowdloanId: PalletId = PalletId(*b"py/cfund"); - pub const SubmissionDeposit: Balance = 100 * DOLLARS; - pub const MinContribution: Balance = 1 * DOLLARS; - pub const RemoveKeysLimit: u32 = 500; - // Allow 32 bytes for an additional memo to a crowdloan. - pub const MaxMemoLength: u8 = 32; -} - -impl crowdloan::Config for Runtime { - type Event = Event; - type PalletId = CrowdloanId; - type SubmissionDeposit = SubmissionDeposit; - type MinContribution = MinContribution; - type RemoveKeysLimit = RemoveKeysLimit; - type Registrar = Registrar; - type Auctioneer = Auctions; - type MaxMemoLength = MaxMemoLength; - type WeightInfo = weights::runtime_common_crowdloan::WeightInfo; + pub const PermanentSlotLeasePeriodLength: u32 = 365; + pub const TemporarySlotLeasePeriodLength: u32 = 3; + pub const MaxPermanentSlots: u32 = 40; + pub const MaxTemporarySlots: u32 = 40; + pub const MaxTemporarySlotPerLeasePeriod: u32 = 5; } -impl pallet_sudo::Config for Runtime { +impl assigned_slots::Config for Runtime { type Event = Event; - type Call = Call; + type AssignSlotOrigin = EnsureRoot; + type Leaser = Slots; + type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength; + type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength; + type MaxPermanentSlots = MaxPermanentSlots; + type MaxTemporarySlots = MaxTemporarySlots; + type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod; } impl validator_manager::Config for Runtime { @@ -778,135 +1276,164 @@ impl validator_manager::Config for Runtime { type PrivilegedOrigin = EnsureRoot; } -impl pallet_utility::Config for Runtime { +impl pallet_sudo::Config for Runtime { type Event = Event; type Call = Call; - type PalletsOrigin = OriginCaller; - type WeightInfo = weights::pallet_utility::WeightInfo; } -parameter_types! { - // One storage item; key size 32, value size 8; . - pub const ProxyDepositBase: Balance = 10; - // Additional storage item size of 33 bytes. - pub const ProxyDepositFactor: Balance = 10; - pub const MaxProxies: u16 = 32; - pub const AnnouncementDepositBase: Balance = 10; - pub const AnnouncementDepositFactor: Balance = 10; - pub const MaxPending: u16 = 32; -} +construct_runtime! { + pub enum Runtime where + Block = Block, + NodeBlock = primitives::v2::Block, + UncheckedExtrinsic = UncheckedExtrinsic + { + // Basic stuff; balances is uncallable initially. + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, -/// The type used to represent the kinds of proxying allowed. -#[derive( - Copy, - Clone, - Eq, - PartialEq, - Ord, - PartialOrd, - Encode, - Decode, - RuntimeDebug, - MaxEncodedLen, - TypeInfo, -)] -pub enum ProxyType { - Any, - CancelProxy, - Auction, -} -impl Default for ProxyType { - fn default() -> Self { - Self::Any - } -} -impl InstanceFilter for ProxyType { - fn filter(&self, c: &Call) -> bool { - match self { - ProxyType::Any => true, - ProxyType::CancelProxy => { - matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) - }, - ProxyType::Auction => matches!( - c, - Call::Auctions { .. } | - Call::Crowdloan { .. } | - Call::Registrar { .. } | - Call::Multisig(..) | Call::Slots { .. } - ), - } - } - fn is_superset(&self, o: &Self) -> bool { - match (self, o) { - (ProxyType::Any, _) => true, - _ => false, - } - } -} + // Babe must be before session. + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, -impl pallet_proxy::Config for Runtime { - type Event = Event; - type Call = Call; - type Currency = Balances; - type ProxyType = ProxyType; - type ProxyDepositBase = ProxyDepositBase; - type ProxyDepositFactor = ProxyDepositFactor; - type MaxProxies = MaxProxies; - type WeightInfo = weights::pallet_proxy::WeightInfo; - type MaxPending = MaxPending; - type CallHasher = BlakeTwo256; - type AnnouncementDepositBase = AnnouncementDepositBase; - type AnnouncementDepositFactor = AnnouncementDepositFactor; -} + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, + Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 33, -parameter_types! { - pub const MotionDuration: BlockNumber = 5; - pub const MaxProposals: u32 = 100; - pub const MaxMembers: u32 = 100; -} + // Consensus support. + // Authorship must be before session in order to note author in the correct session and era + // for im-online. + Authorship: pallet_authorship::{Pallet, Call, Storage} = 5, + Offences: pallet_offences::{Pallet, Storage, Event} = 7, + Historical: session_historical::{Pallet} = 34, + Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, + ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, + + // Governance stuff; uncallable initially. + Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, + Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, + TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, + PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, + TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, + + // Claims. Usable initially. + Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 19, + + // Utility module. + Utility: pallet_utility::{Pallet, Call, Event} = 24, + + // Less simple identity module. + Identity: pallet_identity::{Pallet, Call, Storage, Event} = 25, + + // Society module. + Society: pallet_society::{Pallet, Call, Storage, Event} = 26, + + // Social recovery module. + Recovery: pallet_recovery::{Pallet, Call, Storage, Event} = 27, + + // Vesting. Usable initially, but removed once all vesting is finished. + Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 28, + + // System scheduler. + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 29, + + // Proxy module. Late addition. + Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 30, + + // Multisig module. Late addition. + Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 31, + + // Preimage registrar. + Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 32, + + // Bounties modules. + Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, + ChildBounties: pallet_child_bounties = 40, + + // Tips module. + Tips: pallet_tips::{Pallet, Call, Storage, Event} = 36, + + // Gilts pallet. + Gilt: pallet_gilt::{Pallet, Call, Storage, Event, Config} = 38, + + // Parachains pallets. Start indices at 50 to leave room. + ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50, + Configuration: parachains_configuration::{Pallet, Call, Storage, Config} = 51, + ParasShared: parachains_shared::{Pallet, Call, Storage} = 52, + ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 53, + ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, + ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config} = 56, + Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, + Dmp: parachains_dmp::{Pallet, Call, Storage} = 58, + Ump: parachains_ump::{Pallet, Call, Storage, Event} = 59, + Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 60, + ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61, + ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event} = 62, + + // Parachain Onboarding Pallets. Start indices at 70 to leave room. + Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config} = 70, + Slots: slots::{Pallet, Call, Storage, Event} = 71, + Auctions: auctions::{Pallet, Call, Storage, Event} = 72, + Crowdloan: crowdloan::{Pallet, Call, Storage, Event} = 73, -impl pallet_collective::Config for Runtime { - type Origin = Origin; - type Proposal = Call; - type Event = Event; - type MotionDuration = MotionDuration; - type MaxProposals = MaxProposals; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type MaxMembers = MaxMembers; - type WeightInfo = weights::pallet_collective::WeightInfo; -} + // Pallet for sending XCM. + XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, -impl pallet_membership::Config for Runtime { - type Event = Event; - type AddOrigin = EnsureRoot; - type RemoveOrigin = EnsureRoot; - type SwapOrigin = EnsureRoot; - type ResetOrigin = EnsureRoot; - type PrimeOrigin = EnsureRoot; - type MembershipInitialized = Collective; - type MembershipChanged = Collective; - type MaxMembers = MaxMembers; - type WeightInfo = weights::pallet_membership::WeightInfo; -} + // Rococo specific pallets (not included in Kusama). Start indices at 240 + // + // BEEFY Bridges support. + Beefy: pallet_beefy::{Pallet, Storage, Config} = 240, + Mmr: pallet_mmr::{Pallet, Storage} = 241, + MmrLeaf: pallet_beefy_mmr::{Pallet, Storage} = 242, -parameter_types! { - // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. - pub const DepositBase: Balance = deposit(1, 88); - // Additional storage item size of 32 bytes. - pub const DepositFactor: Balance = deposit(0, 32); - pub const MaxSignatories: u16 = 100; -} + ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 250, + AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event} = 251, -impl pallet_multisig::Config for Runtime { - type Event = Event; - type Call = Call; - type Currency = Balances; - type DepositBase = DepositBase; - type DepositFactor = DepositFactor; - type MaxSignatories = MaxSignatories; - type WeightInfo = weights::pallet_multisig::WeightInfo; + // Validator Manager pallet. + ValidatorManager: validator_manager::{Pallet, Call, Storage, Event} = 252, + + // Sudo. + Sudo: pallet_sudo::{Pallet, Call, Storage, Event, Config} = 255, + } } +/// The address format for describing accounts. +pub type Address = sp_runtime::MultiAddress; +/// Block header type as expected by this runtime. +pub type Header = generic::Header; +/// Block type as expected by this runtime. +pub type Block = generic::Block; +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; +/// `BlockId` type as expected by this runtime. +pub type BlockId = generic::BlockId; +/// The `SignedExtension` to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckMortality, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, +>; +/// The payload being signed in transactions. +pub type SignedPayload = generic::SignedPayload; + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; @@ -919,27 +1446,44 @@ mod benches { // the that path resolves correctly in the generated file. [runtime_common::auctions, Auctions] [runtime_common::crowdloan, Crowdloan] - [runtime_common::paras_registrar, Registrar] + [runtime_common::claims, Claims] [runtime_common::slots, Slots] + [runtime_common::paras_registrar, Registrar] [runtime_parachains::configuration, Configuration] [runtime_parachains::hrmp, Hrmp] - [runtime_parachains::initializer, Initializer] - [runtime_parachains::paras, Paras] [runtime_parachains::disputes, ParasDisputes] + [runtime_parachains::initializer, Initializer] [runtime_parachains::paras_inherent, ParaInherent] + [runtime_parachains::paras, Paras] [runtime_parachains::ump, Ump] // Substrate - [frame_benchmarking::baseline, Baseline::] [pallet_balances, Balances] - [pallet_collective, Collective] + [frame_benchmarking::baseline, Baseline::] + [pallet_bounties, Bounties] + [pallet_child_bounties, ChildBounties] + [pallet_collective, Council] + [pallet_collective, TechnicalCommittee] + [pallet_democracy, Democracy] + [pallet_elections_phragmen, PhragmenElection] + [pallet_gilt, Gilt] + [pallet_identity, Identity] [pallet_im_online, ImOnline] [pallet_indices, Indices] - [pallet_membership, Membership] + [pallet_membership, TechnicalMembership] [pallet_multisig, Multisig] + [pallet_preimage, Preimage] [pallet_proxy, Proxy] + [pallet_recovery, Recovery] + [pallet_scheduler, Scheduler] [frame_system, SystemBench::] [pallet_timestamp, Timestamp] + [pallet_tips, Tips] + [pallet_treasury, Treasury] [pallet_utility, Utility] + [pallet_vesting, Vesting] + // XCM + [pallet_xcm_benchmarks::fungible, pallet_xcm_benchmarks::fungible::Pallet::] + [pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::] ); } @@ -1006,27 +1550,27 @@ sp_api::impl_runtime_apis! { impl primitives::runtime_api::ParachainHost for Runtime { fn validators() -> Vec { - runtime_api_impl::validators::() + parachains_runtime_api_impl::validators::() } fn validator_groups() -> (Vec>, GroupRotationInfo) { - runtime_api_impl::validator_groups::() + parachains_runtime_api_impl::validator_groups::() } fn availability_cores() -> Vec> { - runtime_api_impl::availability_cores::() + parachains_runtime_api_impl::availability_cores::() } fn persisted_validation_data(para_id: ParaId, assumption: OccupiedCoreAssumption) -> Option> { - runtime_api_impl::persisted_validation_data::(para_id, assumption) + parachains_runtime_api_impl::persisted_validation_data::(para_id, assumption) } fn assumed_validation_data( para_id: ParaId, expected_persisted_validation_data_hash: Hash, ) -> Option<(PersistedValidationData, ValidationCodeHash)> { - runtime_api_impl::assumed_validation_data::( + parachains_runtime_api_impl::assumed_validation_data::( para_id, expected_persisted_validation_data_hash, ) @@ -1036,24 +1580,24 @@ sp_api::impl_runtime_apis! { para_id: ParaId, outputs: primitives::v2::CandidateCommitments, ) -> bool { - runtime_api_impl::check_validation_outputs::(para_id, outputs) + parachains_runtime_api_impl::check_validation_outputs::(para_id, outputs) } fn session_index_for_child() -> SessionIndex { - runtime_api_impl::session_index_for_child::() + parachains_runtime_api_impl::session_index_for_child::() } fn validation_code(para_id: ParaId, assumption: OccupiedCoreAssumption) -> Option { - runtime_api_impl::validation_code::(para_id, assumption) + parachains_runtime_api_impl::validation_code::(para_id, assumption) } fn candidate_pending_availability(para_id: ParaId) -> Option> { - runtime_api_impl::candidate_pending_availability::(para_id) + parachains_runtime_api_impl::candidate_pending_availability::(para_id) } fn candidate_events() -> Vec> { - runtime_api_impl::candidate_events::(|ev| { + parachains_runtime_api_impl::candidate_events::(|ev| { match ev { Event::ParaInclusion(ev) => { Some(ev) @@ -1064,39 +1608,42 @@ sp_api::impl_runtime_apis! { } fn session_info(index: SessionIndex) -> Option { - runtime_api_impl::session_info::(index) + parachains_runtime_api_impl::session_info::(index) } fn dmq_contents(recipient: ParaId) -> Vec> { - runtime_api_impl::dmq_contents::(recipient) + parachains_runtime_api_impl::dmq_contents::(recipient) } fn inbound_hrmp_channels_contents( recipient: ParaId ) -> BTreeMap>> { - runtime_api_impl::inbound_hrmp_channels_contents::(recipient) + parachains_runtime_api_impl::inbound_hrmp_channels_contents::(recipient) } fn validation_code_by_hash(hash: ValidationCodeHash) -> Option { - runtime_api_impl::validation_code_by_hash::(hash) + parachains_runtime_api_impl::validation_code_by_hash::(hash) } fn on_chain_votes() -> Option> { - runtime_api_impl::on_chain_votes::() + parachains_runtime_api_impl::on_chain_votes::() } - fn submit_pvf_check_statement(stmt: PvfCheckStatement, signature: ValidatorSignature) { - runtime_api_impl::submit_pvf_check_statement::(stmt, signature) + fn submit_pvf_check_statement( + stmt: primitives::v2::PvfCheckStatement, + signature: primitives::v2::ValidatorSignature + ) { + parachains_runtime_api_impl::submit_pvf_check_statement::(stmt, signature) } fn pvfs_require_precheck() -> Vec { - runtime_api_impl::pvfs_require_precheck::() + parachains_runtime_api_impl::pvfs_require_precheck::() } fn validation_code_hash(para_id: ParaId, assumption: OccupiedCoreAssumption) -> Option { - runtime_api_impl::validation_code_hash::(para_id, assumption) + parachains_runtime_api_impl::validation_code_hash::(para_id, assumption) } fn staging_get_disputes() -> Vec<(SessionIndex, CandidateHash, DisputeState)> { @@ -1104,6 +1651,75 @@ sp_api::impl_runtime_apis! { } } + impl beefy_primitives::BeefyApi for Runtime { + fn validator_set() -> Option> { + Beefy::validator_set() + } + } + + impl mmr::MmrApi for Runtime { + fn generate_proof(leaf_index: u64) + -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> + { + Mmr::generate_batch_proof(vec![leaf_index]) + .and_then(|(leaves, proof)| Ok(( + mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]), + mmr::BatchProof::into_single_leaf_proof(proof)? + ))) + } + + fn verify_proof(leaf: mmr::EncodableOpaqueLeaf, proof: mmr::Proof) + -> Result<(), mmr::Error> + { + pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; + let leaf: MmrLeaf = leaf + .into_opaque_leaf() + .try_decode() + .ok_or(mmr::Error::Verify)?; + Mmr::verify_leaves(vec![leaf], mmr::Proof::into_batch_proof(proof)) + } + + fn verify_proof_stateless( + root: Hash, + leaf: mmr::EncodableOpaqueLeaf, + proof: mmr::Proof + ) -> Result<(), mmr::Error> { + let node = mmr::DataOrHash::Data(leaf.into_opaque_leaf()); + pallet_mmr::verify_leaves_proof::(root, vec![node], mmr::Proof::into_batch_proof(proof)) + } + + fn mmr_root() -> Result { + Ok(Mmr::mmr_root()) + } + + fn generate_batch_proof(leaf_indices: Vec) + -> Result<(Vec, mmr::BatchProof), mmr::Error> + { + Mmr::generate_batch_proof(leaf_indices) + .map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof)) + } + + fn verify_batch_proof(leaves: Vec, proof: mmr::BatchProof) + -> Result<(), mmr::Error> + { + pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; + let leaves = leaves.into_iter().map(|leaf| + leaf.into_opaque_leaf() + .try_decode() + .ok_or(mmr::Error::Verify)).collect::, mmr::Error>>()?; + Mmr::verify_leaves(leaves, proof) + } + + fn verify_batch_proof_stateless( + root: Hash, + leaves: Vec, + proof: mmr::BatchProof + ) -> Result<(), mmr::Error> { + let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect(); + pallet_mmr::verify_leaves_proof::(root, nodes, proof) + } + } + impl fg_primitives::GrandpaApi for Runtime { fn grandpa_authorities() -> Vec<(GrandpaId, u64)> { Grandpa::grandpa_authorities() @@ -1191,7 +1807,7 @@ sp_api::impl_runtime_apis! { impl authority_discovery_primitives::AuthorityDiscoveryApi for Runtime { fn authorities() -> Vec { - runtime_api_impl::relevant_authority_ids::() + parachains_runtime_api_impl::relevant_authority_ids::() } } @@ -1207,85 +1823,6 @@ sp_api::impl_runtime_apis! { } } - impl beefy_primitives::BeefyApi for Runtime { - fn validator_set() -> Option> { - Beefy::validator_set() - } - } - - impl mmr::MmrApi for Runtime { - fn generate_proof(leaf_index: u64) - -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> - { - Mmr::generate_batch_proof(vec![leaf_index]) - .and_then(|(leaves, proof)| Ok(( - mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]), - mmr::BatchProof::into_single_leaf_proof(proof)? - ))) - } - - fn verify_proof(leaf: mmr::EncodableOpaqueLeaf, proof: mmr::Proof) - -> Result<(), mmr::Error> - { - pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; - let leaf: MmrLeaf = leaf - .into_opaque_leaf() - .try_decode() - .ok_or(mmr::Error::Verify)?; - Mmr::verify_leaves(vec![leaf], mmr::Proof::into_batch_proof(proof)) - } - - fn verify_proof_stateless( - root: Hash, - leaf: mmr::EncodableOpaqueLeaf, - proof: mmr::Proof - ) -> Result<(), mmr::Error> { - let node = mmr::DataOrHash::Data(leaf.into_opaque_leaf()); - pallet_mmr::verify_leaves_proof::(root, vec![node], mmr::Proof::into_batch_proof(proof)) - } - - fn mmr_root() -> Result { - Ok(Mmr::mmr_root()) - } - - fn generate_batch_proof(leaf_indices: Vec) - -> Result<(Vec, mmr::BatchProof), mmr::Error> - { - Mmr::generate_batch_proof(leaf_indices) - .map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof)) - } - - fn verify_batch_proof(leaves: Vec, proof: mmr::BatchProof) - -> Result<(), mmr::Error> - { - pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; - let leaves = leaves.into_iter().map(|leaf| - leaf.into_opaque_leaf() - .try_decode() - .ok_or(mmr::Error::Verify)).collect::, mmr::Error>>()?; - Mmr::verify_leaves(leaves, proof) - } - - fn verify_batch_proof_stateless( - root: Hash, - leaves: Vec, - proof: mmr::BatchProof - ) -> Result<(), mmr::Error> { - let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect(); - pallet_mmr::verify_leaves_proof::(root, nodes, proof) - } - } - - impl beefy_merkle_tree::BeefyMmrApi for RuntimeApi { - fn authority_set_proof() -> beefy_primitives::mmr::BeefyAuthoritySet { - MmrLeaf::authority_set_proof() - } - - fn next_authority_set_proof() -> beefy_primitives::mmr::BeefyNextAuthoritySet { - MmrLeaf::next_authority_set_proof() - } - } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) @@ -1304,14 +1841,13 @@ sp_api::impl_runtime_apis! { } } - impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi - for Runtime - { - fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo { - TransactionPayment::query_call_info(call, len) + impl beefy_merkle_tree::BeefyMmrApi for RuntimeApi { + fn authority_set_proof() -> beefy_primitives::mmr::BeefyAuthoritySet { + MmrLeaf::authority_set_proof() } - fn query_call_fee_details(call: Call, len: u32) -> FeeDetails { - TransactionPayment::query_call_fee_details(call, len) + + fn next_authority_set_proof() -> beefy_primitives::mmr::BeefyNextAuthoritySet { + MmrLeaf::next_authority_set_proof() } } @@ -1340,14 +1876,78 @@ sp_api::impl_runtime_apis! { Vec, sp_runtime::RuntimeString, > { - use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError}; use frame_system_benchmarking::Pallet as SystemBench; use frame_benchmarking::baseline::Pallet as Baseline; + use xcm::latest::prelude::*; + use xcm_config::{CheckAccount, RocLocation, SovereignAccountOf, Statemine, XcmConfig}; impl frame_system_benchmarking::Config for Runtime {} impl frame_benchmarking::baseline::Config for Runtime {} + impl pallet_xcm_benchmarks::Config for Runtime { + type XcmConfig = XcmConfig; + type AccountIdConverter = SovereignAccountOf; + fn valid_destination() -> Result { + Ok(Statemine::get()) + } + fn worst_case_holding() -> MultiAssets { + // Rococo only knows about ROC + vec![MultiAsset{ + id: Concrete(RocLocation::get()), + fun: Fungible(1_000_000 * UNITS), + }].into() + } + } + + parameter_types! { + pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( + Statemine::get(), + MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RocLocation::get()) }, + )); + pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some(( + Statemine::get(), + MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RocLocation::get()) }, + )); + } + + impl pallet_xcm_benchmarks::fungible::Config for Runtime { + type TransactAsset = Balances; + + type CheckedAccount = CheckAccount; + type TrustedTeleporter = TrustedTeleporter; + type TrustedReserve = TrustedReserve; + + fn get_multi_asset() -> MultiAsset { + MultiAsset { + id: Concrete(RocLocation::get()), + fun: Fungible(1 * UNITS), + } + } + } + + impl pallet_xcm_benchmarks::generic::Config for Runtime { + type Call = Call; + + fn worst_case_response() -> (u64, Response) { + (0u64, Response::Version(Default::default())) + } + + fn transact_origin() -> Result { + Ok(Statemine::get()) + } + + fn subscribe_origin() -> Result { + Ok(Statemine::get()) + } + + fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> { + let origin = Statemine::get(); + let assets: MultiAssets = (Concrete(RocLocation::get()), 1_000 * UNITS).into(); + let ticket = MultiLocation { parents: 0, interior: Here }; + Ok((origin, ticket, assets)) + } + } - let mut batches = Vec::::new(); let whitelist: Vec = vec![ // Block Number hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), @@ -1359,8 +1959,13 @@ sp_api::impl_runtime_apis! { hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(), // System Events hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), + // Treasury Account + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(), ]; + + let mut batches = Vec::::new(); let params = (&config, &whitelist); + add_benchmarks!(params, batches); Ok(batches) diff --git a/runtime/rococo/src/weights/frame_benchmarking_baseline.rs b/runtime/rococo/src/weights/frame_benchmarking_baseline.rs new file mode 100644 index 000000000000..93b1cf101dec --- /dev/null +++ b/runtime/rococo/src/weights/frame_benchmarking_baseline.rs @@ -0,0 +1,91 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `frame_benchmarking::baseline` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-06-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=frame_benchmarking::baseline +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/frame_benchmarking_baseline.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `frame_benchmarking::baseline`. +pub struct WeightInfo(PhantomData); +impl frame_benchmarking::baseline::WeightInfo for WeightInfo { + /// The range of component `i` is `[0, 1000000]`. + fn addition(_i: u32, ) -> Weight { + (126_000 as Weight) + } + /// The range of component `i` is `[0, 1000000]`. + fn subtraction(_i: u32, ) -> Weight { + (117_000 as Weight) + } + /// The range of component `i` is `[0, 1000000]`. + fn multiplication(_i: u32, ) -> Weight { + (132_000 as Weight) + } + /// The range of component `i` is `[0, 1000000]`. + fn division(_i: u32, ) -> Weight { + (132_000 as Weight) + } + /// The range of component `i` is `[0, 100]`. + fn hashing(i: u32, ) -> Weight { + (19_331_786_000 as Weight) + // Standard Error: 113_000 + .saturating_add((410_000 as Weight).saturating_mul(i as Weight)) + } + /// The range of component `i` is `[1, 100]`. + fn sr25519_verification(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 15_000 + .saturating_add((47_597_000 as Weight).saturating_mul(i as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[0, 1000]`. + fn storage_read(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 3_000 + .saturating_add((2_126_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[0, 1000]`. + fn storage_write(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((328_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } +} diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index ca5a5673e375..712783bc3e6c 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -17,16 +17,29 @@ pub mod frame_system; pub mod pallet_balances; -pub mod pallet_collective; +pub mod pallet_bounties; +pub mod pallet_child_bounties; +pub mod pallet_collective_council; +pub mod pallet_collective_technical_committee; +pub mod pallet_democracy; +pub mod pallet_elections_phragmen; +pub mod pallet_gilt; +pub mod pallet_identity; pub mod pallet_im_online; pub mod pallet_indices; pub mod pallet_membership; pub mod pallet_multisig; +pub mod pallet_preimage; pub mod pallet_proxy; +pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_tips; +pub mod pallet_treasury; pub mod pallet_utility; +pub mod pallet_vesting; pub mod runtime_common_auctions; +pub mod runtime_common_claims; pub mod runtime_common_crowdloan; pub mod runtime_common_paras_registrar; pub mod runtime_common_slots; @@ -37,3 +50,4 @@ pub mod runtime_parachains_initializer; pub mod runtime_parachains_paras; pub mod runtime_parachains_paras_inherent; pub mod runtime_parachains_ump; +pub mod xcm; diff --git a/runtime/rococo/src/weights/pallet_bounties.rs b/runtime/rococo/src/weights/pallet_bounties.rs new file mode 100644 index 000000000000..b8d21b4291ab --- /dev/null +++ b/runtime/rococo/src/weights/pallet_bounties.rs @@ -0,0 +1,139 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_bounties +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_bounties.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_bounties::WeightInfo for WeightInfo { + // Storage: Bounties BountyCount (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Bounties BountyDescriptions (r:0 w:1) + // Storage: Bounties Bounties (r:0 w:1) + /// The range of component `d` is `[0, 16384]`. + fn propose_bounty(d: u32, ) -> Weight { + Weight::from_ref_time(26_654_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(d as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: Bounties BountyApprovals (r:1 w:1) + fn approve_bounty() -> Weight { + Weight::from_ref_time(9_776_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + fn propose_curator() -> Weight { + Weight::from_ref_time(8_350_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn unassign_curator() -> Weight { + Weight::from_ref_time(34_804_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn accept_curator() -> Weight { + Weight::from_ref_time(23_414_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:0) + fn award_bounty() -> Weight { + Weight::from_ref_time(20_148_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: System Account (r:3 w:3) + // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) + // Storage: Bounties BountyDescriptions (r:0 w:1) + fn claim_bounty() -> Weight { + Weight::from_ref_time(64_115_000 as u64) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: Bounties BountyDescriptions (r:0 w:1) + fn close_bounty_proposed() -> Weight { + Weight::from_ref_time(39_628_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Bounties BountyDescriptions (r:0 w:1) + fn close_bounty_active() -> Weight { + Weight::from_ref_time(47_429_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: Bounties Bounties (r:1 w:1) + fn extend_bounty_expiry() -> Weight { + Weight::from_ref_time(17_322_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Bounties BountyApprovals (r:1 w:1) + // Storage: Bounties Bounties (r:1 w:1) + // Storage: System Account (r:2 w:2) + /// The range of component `b` is `[1, 100]`. + fn spend_funds(b: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 30_000 + .saturating_add(Weight::from_ref_time(30_775_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(b as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(b as u64))) + } +} diff --git a/runtime/rococo/src/weights/pallet_child_bounties.rs b/runtime/rococo/src/weights/pallet_child_bounties.rs new file mode 100644 index 000000000000..dd6dc2b1fd2b --- /dev/null +++ b/runtime/rococo/src/weights/pallet_child_bounties.rs @@ -0,0 +1,123 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_child_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_child_bounties +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_child_bounties.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_child_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_child_bounties::WeightInfo for WeightInfo { + // Storage: ChildBounties ParentChildBounties (r:1 w:1) + // Storage: Bounties Bounties (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: ChildBounties ChildBountyCount (r:1 w:1) + // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) + // Storage: ChildBounties ChildBounties (r:0 w:1) + /// The range of component `d` is `[0, 16384]`. + fn add_child_bounty(d: u32, ) -> Weight { + Weight::from_ref_time(48_890_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(d as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) + fn propose_curator() -> Weight { + Weight::from_ref_time(14_114_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn accept_curator() -> Weight { + Weight::from_ref_time(26_807_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: Bounties Bounties (r:1 w:0) + // Storage: System Account (r:1 w:1) + fn unassign_curator() -> Weight { + Weight::from_ref_time(39_640_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + fn award_child_bounty() -> Weight { + Weight::from_ref_time(21_445_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: System Account (r:3 w:3) + // Storage: ChildBounties ParentChildBounties (r:1 w:1) + // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) + fn claim_child_bounty() -> Weight { + Weight::from_ref_time(65_771_000 as u64) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) + fn close_child_bounty_added() -> Weight { + Weight::from_ref_time(46_230_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: System Account (r:3 w:3) + // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:1) + // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) + fn close_child_bounty_active() -> Weight { + Weight::from_ref_time(56_148_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(7 as u64)) + } +} diff --git a/runtime/rococo/src/weights/pallet_collective_council.rs b/runtime/rococo/src/weights/pallet_collective_council.rs new file mode 100644 index 000000000000..f50dce94e01f --- /dev/null +++ b/runtime/rococo/src/weights/pallet_collective_council.rs @@ -0,0 +1,176 @@ +// Copyright 2017-2021 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-08-27, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 128 + +// Executed Command: +// target/release/polkadot +// benchmark +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_collective +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/ + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: Instance1Collective Members (r:1 w:1) + // Storage: Instance1Collective Proposals (r:1 w:0) + // Storage: Instance1Collective Voting (r:100 w:100) + // Storage: Instance1Collective Prime (r:0 w:1) + fn set_members(m: u32, n: u32, p: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(14_448_000 as u64).saturating_mul(m as u64)) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(85_000 as u64).saturating_mul(n as u64)) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(19_620_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(p as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) + } + // Storage: Instance1Collective Members (r:1 w:0) + fn execute(b: u32, m: u32, ) -> Weight { + Weight::from_ref_time(22_536_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(84_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + } + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective ProposalOf (r:1 w:0) + fn propose_execute(b: u32, m: u32, ) -> Weight { + Weight::from_ref_time(27_600_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(161_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + } + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective ProposalOf (r:1 w:1) + // Storage: Instance1Collective Proposals (r:1 w:1) + // Storage: Instance1Collective ProposalCount (r:1 w:1) + // Storage: Instance1Collective Voting (r:0 w:1) + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(42_192_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(4_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(87_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(361_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective Voting (r:1 w:1) + fn vote(m: u32, ) -> Weight { + Weight::from_ref_time(32_307_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(199_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Instance1Collective Voting (r:1 w:1) + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective Proposals (r:1 w:1) + // Storage: Instance1Collective ProposalOf (r:0 w:1) + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(41_436_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(170_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(333_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Instance1Collective Voting (r:1 w:1) + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective ProposalOf (r:1 w:1) + // Storage: Instance1Collective Proposals (r:1 w:1) + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(57_836_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(170_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(339_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Instance1Collective Voting (r:1 w:1) + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective Prime (r:1 w:0) + // Storage: Instance1Collective Proposals (r:1 w:1) + // Storage: Instance1Collective ProposalOf (r:0 w:1) + fn close_disapproved(m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(45_551_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(172_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(338_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Instance1Collective Voting (r:1 w:1) + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective Prime (r:1 w:0) + // Storage: Instance1Collective ProposalOf (r:1 w:1) + // Storage: Instance1Collective Proposals (r:1 w:1) + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(61_497_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(171_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(343_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Instance1Collective Proposals (r:1 w:1) + // Storage: Instance1Collective Voting (r:0 w:1) + // Storage: Instance1Collective ProposalOf (r:0 w:1) + fn disapprove_proposal(p: u32, ) -> Weight { + Weight::from_ref_time(25_573_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(335_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } +} diff --git a/runtime/rococo/src/weights/pallet_collective_technical_committee.rs b/runtime/rococo/src/weights/pallet_collective_technical_committee.rs new file mode 100644 index 000000000000..acdced982d94 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_collective_technical_committee.rs @@ -0,0 +1,176 @@ +// Copyright 2017-2021 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-08-27, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 128 + +// Executed Command: +// target/release/polkadot +// benchmark +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_collective +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/ + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: Instance2Collective Members (r:1 w:1) + // Storage: Instance2Collective Proposals (r:1 w:0) + // Storage: Instance2Collective Voting (r:100 w:100) + // Storage: Instance2Collective Prime (r:0 w:1) + fn set_members(m: u32, n: u32, p: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(14_473_000 as u64).saturating_mul(m as u64)) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(73_000 as u64).saturating_mul(n as u64)) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(19_551_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(p as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) + } + // Storage: Instance2Collective Members (r:1 w:0) + fn execute(b: u32, m: u32, ) -> Weight { + Weight::from_ref_time(22_690_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(80_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + } + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective ProposalOf (r:1 w:0) + fn propose_execute(b: u32, m: u32, ) -> Weight { + Weight::from_ref_time(27_473_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(159_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + } + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective ProposalOf (r:1 w:1) + // Storage: Instance2Collective Proposals (r:1 w:1) + // Storage: Instance2Collective ProposalCount (r:1 w:1) + // Storage: Instance2Collective Voting (r:0 w:1) + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(42_047_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(4_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(85_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(360_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective Voting (r:1 w:1) + fn vote(m: u32, ) -> Weight { + Weight::from_ref_time(32_023_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(199_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Instance2Collective Voting (r:1 w:1) + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective Proposals (r:1 w:1) + // Storage: Instance2Collective ProposalOf (r:0 w:1) + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(41_107_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(171_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(332_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Instance2Collective Voting (r:1 w:1) + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective ProposalOf (r:1 w:1) + // Storage: Instance2Collective Proposals (r:1 w:1) + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(57_783_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(167_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(336_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Instance2Collective Voting (r:1 w:1) + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective Prime (r:1 w:0) + // Storage: Instance2Collective Proposals (r:1 w:1) + // Storage: Instance2Collective ProposalOf (r:0 w:1) + fn close_disapproved(m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(45_646_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(170_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(335_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Instance2Collective Voting (r:1 w:1) + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective Prime (r:1 w:0) + // Storage: Instance2Collective ProposalOf (r:1 w:1) + // Storage: Instance2Collective Proposals (r:1 w:1) + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + Weight::from_ref_time(61_376_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(172_000 as u64).saturating_mul(m as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(339_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Instance2Collective Proposals (r:1 w:1) + // Storage: Instance2Collective Voting (r:0 w:1) + // Storage: Instance2Collective ProposalOf (r:0 w:1) + fn disapprove_proposal(p: u32, ) -> Weight { + Weight::from_ref_time(25_286_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(336_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } +} diff --git a/runtime/rococo/src/weights/pallet_democracy.rs b/runtime/rococo/src/weights/pallet_democracy.rs new file mode 100644 index 000000000000..317b0d4bb0a1 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_democracy.rs @@ -0,0 +1,299 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_democracy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_democracy +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_democracy.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_democracy`. +pub struct WeightInfo(PhantomData); +impl pallet_democracy::WeightInfo for WeightInfo { + // Storage: Democracy PublicPropCount (r:1 w:1) + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + // Storage: Democracy DepositOf (r:0 w:1) + fn propose() -> Weight { + Weight::from_ref_time(37_453_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Democracy DepositOf (r:1 w:1) + /// The range of component `s` is `[0, 100]`. + fn second(s: u32, ) -> Weight { + Weight::from_ref_time(27_807_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(69_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn vote_new(r: u32, ) -> Weight { + Weight::from_ref_time(35_336_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(120_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn vote_existing(r: u32, ) -> Weight { + Weight::from_ref_time(35_107_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(123_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Cancellations (r:1 w:1) + fn emergency_cancel() -> Weight { + Weight::from_ref_time(17_752_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Blacklist (r:0 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `p` is `[1, 100]`. + fn blacklist(p: u32, ) -> Weight { + Weight::from_ref_time(52_116_000 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(194_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + /// The range of component `v` is `[1, 100]`. + fn external_propose(v: u32, ) -> Weight { + Weight::from_ref_time(10_194_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(10_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_majority() -> Weight { + Weight::from_ref_time(3_700_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_default() -> Weight { + Weight::from_ref_time(3_713_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn fast_track() -> Weight { + Weight::from_ref_time(17_441_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:1) + /// The range of component `v` is `[0, 100]`. + fn veto_external(v: u32, ) -> Weight { + Weight::from_ref_time(18_536_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(42_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `p` is `[1, 100]`. + fn cancel_proposal(p: u32, ) -> Weight { + Weight::from_ref_time(42_174_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(164_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn cancel_referendum() -> Weight { + Weight::from_ref_time(11_892_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn cancel_queued(r: u32, ) -> Weight { + Weight::from_ref_time(23_252_000 as u64) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(2_242_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:1 w:0) + /// The range of component `r` is `[1, 99]`. + fn on_initialize_base(r: u32, ) -> Weight { + Weight::from_ref_time(1_457_000 as u64) + // Standard Error: 3_000 + .saturating_add(Weight::from_ref_time(2_956_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy LastTabledWasExternal (r:1 w:0) + // Storage: Democracy NextExternal (r:1 w:0) + // Storage: Democracy PublicProps (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:1 w:0) + /// The range of component `r` is `[1, 99]`. + fn on_initialize_base_with_launch_period(r: u32, ) -> Weight { + Weight::from_ref_time(6_240_000 as u64) + // Standard Error: 3_000 + .saturating_add(Weight::from_ref_time(2_963_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy VotingOf (r:3 w:3) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn delegate(r: u32, ) -> Weight { + Weight::from_ref_time(34_480_000 as u64) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(3_908_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(r as u64))) + } + // Storage: Democracy VotingOf (r:2 w:2) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn undelegate(r: u32, ) -> Weight { + Weight::from_ref_time(17_446_000 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(3_917_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(r as u64))) + } + // Storage: Democracy PublicProps (r:0 w:1) + fn clear_public_proposals() -> Weight { + Weight::from_ref_time(3_727_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy Preimages (r:1 w:1) + /// The range of component `b` is `[0, 16384]`. + fn note_preimage(b: u32, ) -> Weight { + Weight::from_ref_time(25_720_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy Preimages (r:1 w:1) + /// The range of component `b` is `[0, 16384]`. + fn note_imminent_preimage(b: u32, ) -> Weight { + Weight::from_ref_time(17_884_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy Preimages (r:1 w:1) + // Storage: System Account (r:1 w:0) + /// The range of component `b` is `[0, 16384]`. + fn reap_preimage(b: u32, ) -> Weight { + Weight::from_ref_time(24_695_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn unlock_remove(r: u32, ) -> Weight { + Weight::from_ref_time(22_207_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(36_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn unlock_set(r: u32, ) -> Weight { + Weight::from_ref_time(21_561_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(110_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn remove_vote(r: u32, ) -> Weight { + Weight::from_ref_time(13_204_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(105_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 99]`. + fn remove_other_vote(r: u32, ) -> Weight { + Weight::from_ref_time(12_994_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(106_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } +} diff --git a/runtime/rococo/src/weights/pallet_elections_phragmen.rs b/runtime/rococo/src/weights/pallet_elections_phragmen.rs new file mode 100644 index 000000000000..c4c015fe4412 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_elections_phragmen.rs @@ -0,0 +1,183 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_elections_phragmen` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_elections_phragmen +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_elections_phragmen.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_elections_phragmen`. +pub struct WeightInfo(PhantomData); +impl pallet_elections_phragmen::WeightInfo for WeightInfo { + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[1, 16]`. + fn vote_equal(v: u32, ) -> Weight { + Weight::from_ref_time(24_107_000 as u64) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(184_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_more(v: u32, ) -> Weight { + Weight::from_ref_time(36_869_000 as u64) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(165_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_less(v: u32, ) -> Weight { + Weight::from_ref_time(36_445_000 as u64) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(199_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn remove_voter() -> Weight { + Weight::from_ref_time(33_035_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + /// The range of component `c` is `[1, 1000]`. + fn submit_candidacy(c: u32, ) -> Weight { + Weight::from_ref_time(25_946_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(101_000 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + /// The range of component `c` is `[1, 1000]`. + fn renounce_candidacy_candidate(c: u32, ) -> Weight { + Weight::from_ref_time(22_945_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(69_000 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn renounce_candidacy_members() -> Weight { + Weight::from_ref_time(41_502_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: PhragmenElection RunnersUp (r:1 w:1) + fn renounce_candidacy_runners_up() -> Weight { + Weight::from_ref_time(30_791_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Benchmark Override (r:0 w:0) + fn remove_member_without_replacement() -> Weight { + Weight::from_ref_time(2_000_000_000_000 as u64) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn remove_member_with_replacement() -> Weight { + Weight::from_ref_time(57_184_000 as u64) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) + } + // Storage: PhragmenElection Voting (r:5001 w:5000) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: Balances Locks (r:5000 w:5000) + // Storage: System Account (r:5000 w:5000) + /// The range of component `v` is `[5000, 10000]`. + /// The range of component `d` is `[1, 5000]`. + fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 85_000 + .saturating_add(Weight::from_ref_time(61_507_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(v as u64))) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(v as u64))) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: PhragmenElection Voting (r:10001 w:0) + // Storage: Council Proposals (r:1 w:0) + // Storage: PhragmenElection ElectionRounds (r:1 w:1) + // Storage: Council Members (r:0 w:1) + // Storage: Council Prime (r:0 w:1) + // Storage: System Account (r:3 w:3) + /// The range of component `c` is `[1, 1000]`. + /// The range of component `v` is `[1, 10000]`. + /// The range of component `e` is `[10000, 160000]`. + fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 1_864_000 + .saturating_add(Weight::from_ref_time(167_385_000 as u64).saturating_mul(v as u64)) + // Standard Error: 124_000 + .saturating_add(Weight::from_ref_time(9_721_000 as u64).saturating_mul(e as u64)) + .saturating_add(T::DbWeight::get().reads(265 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(v as u64))) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) + } +} diff --git a/runtime/rococo/src/weights/pallet_gilt.rs b/runtime/rococo/src/weights/pallet_gilt.rs new file mode 100644 index 000000000000..b873684e2311 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_gilt.rs @@ -0,0 +1,119 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_gilt` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_gilt +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_gilt.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_gilt`. +pub struct WeightInfo(PhantomData); +impl pallet_gilt::WeightInfo for WeightInfo { + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + /// The range of component `l` is `[0, 999]`. + fn place_bid(l: u32, ) -> Weight { + Weight::from_ref_time(36_767_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(115_000 as u64).saturating_mul(l as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + fn place_bid_max() -> Weight { + Weight::from_ref_time(119_333_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + /// The range of component `l` is `[1, 1000]`. + fn retract_bid(l: u32, ) -> Weight { + Weight::from_ref_time(37_108_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(94_000 as u64).saturating_mul(l as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Gilt ActiveTotal (r:1 w:1) + fn set_target() -> Weight { + Weight::from_ref_time(5_188_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Gilt Active (r:1 w:1) + // Storage: Gilt ActiveTotal (r:1 w:1) + fn thaw() -> Weight { + Weight::from_ref_time(43_654_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Gilt ActiveTotal (r:1 w:0) + fn pursue_target_noop() -> Weight { + Weight::from_ref_time(1_584_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + } + // Storage: Gilt ActiveTotal (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt Active (r:0 w:1) + /// The range of component `b` is `[1, 1000]`. + fn pursue_target_per_item(b: u32, ) -> Weight { + Weight::from_ref_time(21_464_000 as u64) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(4_387_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(b as u64))) + } + // Storage: Gilt ActiveTotal (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt Active (r:0 w:1) + /// The range of component `q` is `[1, 300]`. + fn pursue_target_per_queue(q: u32, ) -> Weight { + Weight::from_ref_time(12_881_000 as u64) + // Standard Error: 8_000 + .saturating_add(Weight::from_ref_time(8_285_000 as u64).saturating_mul(q as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(q as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(q as u64))) + } +} diff --git a/runtime/rococo/src/weights/pallet_identity.rs b/runtime/rococo/src/weights/pallet_identity.rs new file mode 100644 index 000000000000..57c18f391f4b --- /dev/null +++ b/runtime/rococo/src/weights/pallet_identity.rs @@ -0,0 +1,233 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_identity` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_identity +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_identity.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_identity`. +pub struct WeightInfo(PhantomData); +impl pallet_identity::WeightInfo for WeightInfo { + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn add_registrar(r: u32, ) -> Weight { + Weight::from_ref_time(16_146_000 as u64) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(164_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[1, 100]`. + fn set_identity(r: u32, x: u32, ) -> Weight { + Weight::from_ref_time(28_556_000 as u64) + // Standard Error: 7_000 + .saturating_add(Weight::from_ref_time(208_000 as u64).saturating_mul(r as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(371_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn set_subs_new(s: u32, ) -> Weight { + Weight::from_ref_time(25_214_000 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(3_032_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + fn set_subs_old(p: u32, ) -> Weight { + Weight::from_ref_time(26_402_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(916_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[1, 100]`. + /// The range of component `x` is `[1, 100]`. + fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { + Weight::from_ref_time(32_822_000 as u64) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(74_000 as u64).saturating_mul(r as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(909_000 as u64).saturating_mul(s as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(166_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[1, 100]`. + fn request_judgement(r: u32, x: u32, ) -> Weight { + Weight::from_ref_time(30_696_000 as u64) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(163_000 as u64).saturating_mul(r as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(377_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[1, 100]`. + fn cancel_request(r: u32, x: u32, ) -> Weight { + Weight::from_ref_time(28_144_000 as u64) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(144_000 as u64).saturating_mul(r as u64)) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(363_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fee(r: u32, ) -> Weight { + Weight::from_ref_time(7_135_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(135_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_account_id(r: u32, ) -> Weight { + Weight::from_ref_time(6_861_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(140_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fields(r: u32, ) -> Weight { + Weight::from_ref_time(7_143_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(133_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + /// The range of component `x` is `[1, 100]`. + fn provide_judgement(r: u32, x: u32, ) -> Weight { + Weight::from_ref_time(21_902_000 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(109_000 as u64).saturating_mul(r as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(378_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[1, 100]`. + /// The range of component `x` is `[1, 100]`. + fn kill_identity(_r: u32, s: u32, _x: u32, ) -> Weight { + Weight::from_ref_time(48_712_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(903_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 99]`. + fn add_sub(s: u32, ) -> Weight { + Weight::from_ref_time(33_860_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(97_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn rename_sub(s: u32, ) -> Weight { + Weight::from_ref_time(12_063_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(27_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn remove_sub(s: u32, ) -> Weight { + Weight::from_ref_time(34_418_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(84_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 99]`. + fn quit_sub(s: u32, ) -> Weight { + Weight::from_ref_time(24_186_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(77_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } +} diff --git a/runtime/rococo/src/weights/pallet_preimage.rs b/runtime/rococo/src/weights/pallet_preimage.rs new file mode 100644 index 000000000000..5268e8054a13 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_preimage.rs @@ -0,0 +1,135 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_preimage +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_preimage.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_preimage`. +pub struct WeightInfo(PhantomData); +impl pallet_preimage::WeightInfo for WeightInfo { + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(s: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:0) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(s: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:0) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(s: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_preimage() -> Weight { + Weight::from_ref_time(35_236_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_no_deposit_preimage() -> Weight { + Weight::from_ref_time(23_396_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_preimage() -> Weight { + Weight::from_ref_time(33_944_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_no_deposit_preimage() -> Weight { + Weight::from_ref_time(22_151_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_unnoted_preimage() -> Weight { + Weight::from_ref_time(16_617_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_requested_preimage() -> Weight { + Weight::from_ref_time(6_552_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_preimage() -> Weight { + Weight::from_ref_time(23_787_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_unnoted_preimage() -> Weight { + Weight::from_ref_time(16_327_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_multi_referenced_preimage() -> Weight { + Weight::from_ref_time(6_289_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/rococo/src/weights/pallet_scheduler.rs b/runtime/rococo/src/weights/pallet_scheduler.rs new file mode 100644 index 000000000000..06a77fcee9cb --- /dev/null +++ b/runtime/rococo/src/weights/pallet_scheduler.rs @@ -0,0 +1,207 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_scheduler +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_scheduler.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight { + Weight::from_ref_time(1_256_000 as u64) + // Standard Error: 42_000 + .saturating_add(Weight::from_ref_time(26_925_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((4 as u64).saturating_mul(s as u64))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_named_resolved(s: u32, ) -> Weight { + Weight::from_ref_time(921_000 as u64) + // Standard Error: 35_000 + .saturating_add(Weight::from_ref_time(21_922_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(s as u64))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_periodic_resolved(s: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 62_000 + .saturating_add(Weight::from_ref_time(24_926_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(s as u64))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_resolved(s: u32, ) -> Weight { + Weight::from_ref_time(10_674_000 as u64) + // Standard Error: 31_000 + .saturating_add(Weight::from_ref_time(20_631_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(s as u64))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:0) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_named_aborted(s: u32, ) -> Weight { + Weight::from_ref_time(2_607_000 as u64) + // Standard Error: 20_000 + .saturating_add(Weight::from_ref_time(10_009_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:0) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_aborted(s: u32, ) -> Weight { + Weight::from_ref_time(3_381_000 as u64) + // Standard Error: 17_000 + .saturating_add(Weight::from_ref_time(7_945_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_periodic_named(s: u32, ) -> Weight { + Weight::from_ref_time(6_676_000 as u64) + // Standard Error: 25_000 + .saturating_add(Weight::from_ref_time(16_966_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(s as u64))) + } + // Storage: Scheduler Agenda (r:2 w:2) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_periodic(s: u32, ) -> Weight { + Weight::from_ref_time(8_899_000 as u64) + // Standard Error: 24_000 + .saturating_add(Weight::from_ref_time(14_630_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn on_initialize_named(s: u32, ) -> Weight { + Weight::from_ref_time(8_583_000 as u64) + // Standard Error: 19_000 + .saturating_add(Weight::from_ref_time(12_228_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. + fn on_initialize(s: u32, ) -> Weight { + Weight::from_ref_time(8_544_000 as u64) + // Standard Error: 19_000 + .saturating_add(Weight::from_ref_time(11_364_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 50]`. + fn schedule(s: u32, ) -> Weight { + Weight::from_ref_time(19_060_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(46_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel(s: u32, ) -> Weight { + Weight::from_ref_time(17_694_000 as u64) + // Standard Error: 7_000 + .saturating_add(Weight::from_ref_time(2_368_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 50]`. + fn schedule_named(s: u32, ) -> Weight { + Weight::from_ref_time(22_258_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(60_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel_named(s: u32, ) -> Weight { + Weight::from_ref_time(18_882_000 as u64) + // Standard Error: 7_000 + .saturating_add(Weight::from_ref_time(2_379_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } +} diff --git a/runtime/rococo/src/weights/pallet_session.rs b/runtime/rococo/src/weights/pallet_session.rs index dc50ee8fb59b..e2ee85f0bba0 100644 --- a/runtime/rococo/src/weights/pallet_session.rs +++ b/runtime/rococo/src/weights/pallet_session.rs @@ -22,7 +22,7 @@ // Executed Command: // ./target/production/polkadot // benchmark -// --chain=polkadot-dev +// --chain=rococo-dev // --steps=50 // --repeat=20 // --pallet=pallet_session diff --git a/runtime/rococo/src/weights/pallet_tips.rs b/runtime/rococo/src/weights/pallet_tips.rs new file mode 100644 index 000000000000..9d737bfa5a1b --- /dev/null +++ b/runtime/rococo/src/weights/pallet_tips.rs @@ -0,0 +1,110 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_tips` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_tips +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_tips.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_tips`. +pub struct WeightInfo(PhantomData); +impl pallet_tips::WeightInfo for WeightInfo { + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `r` is `[0, 16384]`. + fn report_awesome(r: u32, ) -> Weight { + Weight::from_ref_time(28_045_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn retract_tip() -> Weight { + Weight::from_ref_time(26_017_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:0 w:1) + /// The range of component `r` is `[0, 16384]`. + /// The range of component `t` is `[1, 19]`. + fn tip_new(r: u32, t: u32, ) -> Weight { + Weight::from_ref_time(19_125_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(r as u64)) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(41_000 as u64).saturating_mul(t as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `t` is `[1, 19]`. + fn tip(t: u32, ) -> Weight { + Weight::from_ref_time(10_895_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(158_000 as u64).saturating_mul(t as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 19]`. + fn close_tip(t: u32, ) -> Weight { + Weight::from_ref_time(42_301_000 as u64) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(154_000 as u64).saturating_mul(t as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 19]`. + fn slash_tip(t: u32, ) -> Weight { + Weight::from_ref_time(16_548_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(21_000 as u64).saturating_mul(t as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } +} diff --git a/runtime/rococo/src/weights/pallet_treasury.rs b/runtime/rococo/src/weights/pallet_treasury.rs new file mode 100644 index 000000000000..09a0d3c819cb --- /dev/null +++ b/runtime/rococo/src/weights/pallet_treasury.rs @@ -0,0 +1,94 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_treasury +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_treasury.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_treasury`. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + fn spend() -> Weight { + Weight::from_ref_time(153_000 as u64) + } + // Storage: Treasury ProposalCount (r:1 w:1) + // Storage: Treasury Proposals (r:0 w:1) + fn propose_spend() -> Weight { + Weight::from_ref_time(25_149_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn reject_proposal() -> Weight { + Weight::from_ref_time(35_748_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Treasury Proposals (r:1 w:0) + // Storage: Treasury Approvals (r:1 w:1) + /// The range of component `p` is `[0, 99]`. + fn approve_proposal(p: u32, ) -> Weight { + Weight::from_ref_time(10_082_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(36_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Treasury Approvals (r:1 w:1) + fn remove_approval() -> Weight { + Weight::from_ref_time(5_612_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Treasury Approvals (r:1 w:1) + // Storage: Bounties BountyApprovals (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Treasury Proposals (r:2 w:2) + /// The range of component `p` is `[0, 100]`. + fn on_initialize_proposals(p: u32, ) -> Weight { + Weight::from_ref_time(36_270_000 as u64) + // Standard Error: 32_000 + .saturating_add(Weight::from_ref_time(30_142_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(p as u64))) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(p as u64))) + } +} diff --git a/runtime/rococo/src/weights/pallet_vesting.rs b/runtime/rococo/src/weights/pallet_vesting.rs new file mode 100644 index 000000000000..32f07f0bc98b --- /dev/null +++ b/runtime/rococo/src/weights/pallet_vesting.rs @@ -0,0 +1,157 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_vesting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_vesting +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_vesting.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_vesting`. +pub struct WeightInfo(PhantomData); +impl pallet_vesting::WeightInfo for WeightInfo { + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_locked(l: u32, s: u32, ) -> Weight { + Weight::from_ref_time(29_030_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(75_000 as u64).saturating_mul(l as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(162_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_unlocked(l: u32, s: u32, ) -> Weight { + Weight::from_ref_time(29_535_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(69_000 as u64).saturating_mul(l as u64)) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(113_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_locked(l: u32, s: u32, ) -> Weight { + Weight::from_ref_time(29_237_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(75_000 as u64).saturating_mul(l as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(160_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { + Weight::from_ref_time(29_750_000 as u64) + // Standard Error: 3_000 + .saturating_add(Weight::from_ref_time(84_000 as u64).saturating_mul(l as u64)) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(109_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn vested_transfer(l: u32, s: u32, ) -> Weight { + Weight::from_ref_time(44_092_000 as u64) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(71_000 as u64).saturating_mul(l as u64)) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(134_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn force_vested_transfer(l: u32, s: u32, ) -> Weight { + Weight::from_ref_time(44_003_000 as u64) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(72_000 as u64).saturating_mul(l as u64)) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(119_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + Weight::from_ref_time(29_853_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(77_000 as u64).saturating_mul(l as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(153_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + Weight::from_ref_time(29_466_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(81_000 as u64).saturating_mul(l as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(158_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } +} diff --git a/runtime/rococo/src/weights/runtime_common_claims.rs b/runtime/rococo/src/weights/runtime_common_claims.rs new file mode 100644 index 000000000000..510592b2ed09 --- /dev/null +++ b/runtime/rococo/src/weights/runtime_common_claims.rs @@ -0,0 +1,102 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `runtime_common::claims` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=runtime_common::claims +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/runtime_common_claims.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `runtime_common::claims`. +pub struct WeightInfo(PhantomData); +impl runtime_common::claims::WeightInfo for WeightInfo { + // Storage: Claims Claims (r:1 w:1) + // Storage: Claims Signing (r:1 w:1) + // Storage: Claims Total (r:1 w:1) + // Storage: Claims Vesting (r:1 w:1) + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + fn claim() -> Weight { + Weight::from_ref_time(139_399_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + } + // Storage: Claims Total (r:1 w:1) + // Storage: Claims Vesting (r:0 w:1) + // Storage: Claims Claims (r:0 w:1) + // Storage: Claims Signing (r:0 w:1) + fn mint_claim() -> Weight { + Weight::from_ref_time(9_284_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: Claims Claims (r:1 w:1) + // Storage: Claims Signing (r:1 w:1) + // Storage: Claims Total (r:1 w:1) + // Storage: Claims Vesting (r:1 w:1) + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + fn claim_attest() -> Weight { + Weight::from_ref_time(143_329_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + } + // Storage: Claims Preclaims (r:1 w:1) + // Storage: Claims Signing (r:1 w:1) + // Storage: Claims Claims (r:1 w:1) + // Storage: Claims Total (r:1 w:1) + // Storage: Claims Vesting (r:1 w:1) + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + fn attest() -> Weight { + Weight::from_ref_time(63_456_000 as u64) + .saturating_add(T::DbWeight::get().reads(8 as u64)) + .saturating_add(T::DbWeight::get().writes(7 as u64)) + } + // Storage: Claims Claims (r:1 w:2) + // Storage: Claims Vesting (r:1 w:2) + // Storage: Claims Signing (r:1 w:2) + // Storage: Claims Preclaims (r:1 w:1) + fn move_claim() -> Weight { + Weight::from_ref_time(19_434_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(7 as u64)) + } +} diff --git a/runtime/rococo/src/weights/xcm/mod.rs b/runtime/rococo/src/weights/xcm/mod.rs new file mode 100644 index 000000000000..2c5d4d6f05f9 --- /dev/null +++ b/runtime/rococo/src/weights/xcm/mod.rs @@ -0,0 +1,203 @@ +mod pallet_xcm_benchmarks_fungible; +mod pallet_xcm_benchmarks_generic; + +use crate::Runtime; +use frame_support::weights::Weight; +use sp_std::prelude::*; +use xcm::{ + latest::{prelude::*, Weight as XCMWeight}, + DoubleEncoded, +}; + +use pallet_xcm_benchmarks_fungible::WeightInfo as XcmBalancesWeight; +use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; + +/// Types of asset supported by the Rococo runtime. +pub enum AssetTypes { + /// An asset backed by `pallet-balances`. + Balances, + /// Unknown asset. + Unknown, +} + +impl From<&MultiAsset> for AssetTypes { + fn from(asset: &MultiAsset) -> Self { + match asset { + MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), .. } => + AssetTypes::Balances, + _ => AssetTypes::Unknown, + } + } +} + +trait WeighMultiAssets { + fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight; +} + +// Rococo only knows about one asset, the balances pallet. +const MAX_ASSETS: u32 = 1; + +impl WeighMultiAssets for MultiAssetFilter { + fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight { + let weight = match self { + Self::Definite(assets) => assets + .inner() + .into_iter() + .map(From::from) + .map(|t| match t { + AssetTypes::Balances => balances_weight, + AssetTypes::Unknown => Weight::MAX, + }) + .fold(Weight::zero(), |acc, x| acc.saturating_add(x)), + Self::Wild(_) => balances_weight.saturating_mul(MAX_ASSETS as u64), + }; + + weight.ref_time() + } +} + +impl WeighMultiAssets for MultiAssets { + fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight { + let weight = self + .inner() + .into_iter() + .map(|m| >::from(m)) + .map(|t| match t { + AssetTypes::Balances => balances_weight, + AssetTypes::Unknown => Weight::MAX, + }) + .fold(Weight::zero(), |acc, x| acc.saturating_add(x)); + + weight.ref_time() + } +} + +pub struct RococoXcmWeight(core::marker::PhantomData); +impl XcmWeightInfo for RococoXcmWeight { + fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { + assets.weigh_multi_assets(XcmBalancesWeight::::withdraw_asset()) + } + fn reserve_asset_deposited(assets: &MultiAssets) -> XCMWeight { + assets.weigh_multi_assets(XcmBalancesWeight::::reserve_asset_deposited()) + } + fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight { + assets.weigh_multi_assets(XcmBalancesWeight::::receive_teleported_asset()) + } + fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight { + XcmGeneric::::query_response().ref_time() + } + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight { + assets.weigh_multi_assets(XcmBalancesWeight::::transfer_asset()) + } + fn transfer_reserve_asset( + assets: &MultiAssets, + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> XCMWeight { + assets.weigh_multi_assets(XcmBalancesWeight::::transfer_reserve_asset()) + } + fn transact( + _origin_type: &OriginKind, + _require_weight_at_most: &u64, + _call: &DoubleEncoded, + ) -> XCMWeight { + XcmGeneric::::transact().ref_time() + } + fn hrmp_new_channel_open_request( + _sender: &u32, + _max_message_size: &u32, + _max_capacity: &u32, + ) -> XCMWeight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX.ref_time() + } + fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX.ref_time() + } + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX.ref_time() + } + fn clear_origin() -> XCMWeight { + XcmGeneric::::clear_origin().ref_time() + } + fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight { + XcmGeneric::::descend_origin().ref_time() + } + fn report_error( + _query_id: &QueryId, + _dest: &MultiLocation, + _max_response_weight: &u64, + ) -> XCMWeight { + XcmGeneric::::report_error().ref_time() + } + + fn deposit_asset( + assets: &MultiAssetFilter, + _max_assets: &u32, // TODO use max assets? + _dest: &MultiLocation, + ) -> XCMWeight { + assets.weigh_multi_assets(XcmBalancesWeight::::deposit_asset()) + } + fn deposit_reserve_asset( + assets: &MultiAssetFilter, + _max_assets: &u32, // TODO use max assets? + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> XCMWeight { + assets.weigh_multi_assets(XcmBalancesWeight::::deposit_reserve_asset()) + } + fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight { + Weight::MAX.ref_time() // todo fix + } + fn initiate_reserve_withdraw( + assets: &MultiAssetFilter, + _reserve: &MultiLocation, + _xcm: &Xcm<()>, + ) -> XCMWeight { + assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) + } + fn initiate_teleport( + assets: &MultiAssetFilter, + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> XCMWeight { + assets.weigh_multi_assets(XcmBalancesWeight::::initiate_teleport()) + } + fn query_holding( + _query_id: &u64, + _dest: &MultiLocation, + _assets: &MultiAssetFilter, + _max_response_weight: &u64, + ) -> XCMWeight { + XcmGeneric::::query_holding().ref_time() + } + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight { + XcmGeneric::::buy_execution().ref_time() + } + fn refund_surplus() -> XCMWeight { + XcmGeneric::::refund_surplus().ref_time() + } + fn set_error_handler(_xcm: &Xcm) -> XCMWeight { + XcmGeneric::::set_error_handler().ref_time() + } + fn set_appendix(_xcm: &Xcm) -> XCMWeight { + XcmGeneric::::set_appendix().ref_time() + } + fn clear_error() -> XCMWeight { + XcmGeneric::::clear_error().ref_time() + } + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight { + XcmGeneric::::claim_asset().ref_time() + } + fn trap(_code: &u64) -> XCMWeight { + XcmGeneric::::trap().ref_time() + } + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight { + XcmGeneric::::subscribe_version().ref_time() + } + fn unsubscribe_version() -> XCMWeight { + XcmGeneric::::unsubscribe_version().ref_time() + } +} diff --git a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs new file mode 100644 index 000000000000..99eee16135ba --- /dev/null +++ b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -0,0 +1,112 @@ +// Copyright 2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Autogenerated weights for `pallet_xcm_benchmarks::fungible` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_xcm_benchmarks::fungible +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --template=./xcm/pallet-xcm-benchmarks/template.hbs +// --output=./runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_xcm_benchmarks::fungible`. +pub struct WeightInfo(PhantomData); +impl WeightInfo { + // Storage: System Account (r:1 w:1) + pub(crate) fn withdraw_asset() -> Weight { + Weight::from_ref_time(20_385_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:2 w:2) + pub(crate) fn transfer_asset() -> Weight { + Weight::from_ref_time(32_756_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: System Account (r:2 w:2) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn transfer_reserve_asset() -> Weight { + Weight::from_ref_time(50_645_000 as u64) + .saturating_add(T::DbWeight::get().reads(8 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) + } + // Storage: Benchmark Override (r:0 w:0) + pub(crate) fn reserve_asset_deposited() -> Weight { + Weight::from_ref_time(2_000_000_000_000 as u64) + } + // Storage: System Account (r:1 w:1) + pub(crate) fn receive_teleported_asset() -> Weight { + Weight::from_ref_time(19_595_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + pub(crate) fn deposit_asset() -> Weight { + Weight::from_ref_time(21_763_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn deposit_reserve_asset() -> Weight { + Weight::from_ref_time(40_930_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: System Account (r:1 w:1) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn initiate_teleport() -> Weight { + Weight::from_ref_time(40_788_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } +} diff --git a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs new file mode 100644 index 000000000000..551ddc5903be --- /dev/null +++ b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -0,0 +1,136 @@ +// Copyright 2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! Autogenerated weights for `pallet_xcm_benchmarks::generic` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_xcm_benchmarks::generic +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --template=./xcm/pallet-xcm-benchmarks/template.hbs +// --output=./runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_xcm_benchmarks::generic`. +pub struct WeightInfo(PhantomData); +impl WeightInfo { + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn query_holding() -> Weight { + Weight::from_ref_time(21_822_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + pub(crate) fn buy_execution() -> Weight { + Weight::from_ref_time(3_109_000 as u64) + } + // Storage: XcmPallet Queries (r:1 w:0) + pub(crate) fn query_response() -> Weight { + Weight::from_ref_time(12_087_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + } + pub(crate) fn transact() -> Weight { + Weight::from_ref_time(12_398_000 as u64) + } + pub(crate) fn refund_surplus() -> Weight { + Weight::from_ref_time(3_247_000 as u64) + } + pub(crate) fn set_error_handler() -> Weight { + Weight::from_ref_time(3_086_000 as u64) + } + pub(crate) fn set_appendix() -> Weight { + Weight::from_ref_time(3_112_000 as u64) + } + pub(crate) fn clear_error() -> Weight { + Weight::from_ref_time(3_118_000 as u64) + } + pub(crate) fn descend_origin() -> Weight { + Weight::from_ref_time(4_054_000 as u64) + } + pub(crate) fn clear_origin() -> Weight { + Weight::from_ref_time(3_111_000 as u64) + } + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn report_error() -> Weight { + Weight::from_ref_time(18_425_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: XcmPallet AssetTraps (r:1 w:1) + pub(crate) fn claim_asset() -> Weight { + Weight::from_ref_time(7_144_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + pub(crate) fn trap() -> Weight { + Weight::from_ref_time(3_060_000 as u64) + } + // Storage: XcmPallet VersionNotifyTargets (r:1 w:1) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn subscribe_version() -> Weight { + Weight::from_ref_time(21_642_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: XcmPallet VersionNotifyTargets (r:0 w:1) + pub(crate) fn unsubscribe_version() -> Weight { + Weight::from_ref_time(4_873_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn initiate_reserve_withdraw() -> Weight { + Weight::from_ref_time(22_809_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } +} diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index c1d45f10b072..083ddb1bf081 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -17,33 +17,49 @@ //! XCM configuration for Rococo. use super::{ - parachains_origin, AccountId, Balances, Call, Event, Origin, ParaId, Runtime, WeightToFee, - XcmPallet, -}; -use frame_support::{ - parameter_types, - traits::{Everything, IsInVec, Nothing}, + parachains_origin, AccountId, Balances, Call, CouncilCollective, Event, Origin, ParaId, + Runtime, WeightToFee, XcmPallet, }; +use frame_support::{match_types, parameter_types, traits::Everything}; use runtime_common::{xcm_sender, ToAuthor}; -use sp_std::prelude::*; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality, + AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, + AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, - CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents, + CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete, + LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, + TakeWeightCredit, UsingComponents, WeightInfoBounds, }; parameter_types! { + /// The location of the ROC token, from the context of this chain. Since this token is native to this + /// chain, we make it synonymous with it and thus it is the `Here` location, which means "equivalent to + /// the context". pub const RocLocation: MultiLocation = Here.into(); - pub const RococoNetwork: NetworkId = NetworkId::Polkadot; + /// The Rococo network ID. This is named. + pub RococoNetwork: NetworkId = + NetworkId::Named(b"Rococo".to_vec().try_into().expect("shorter than length limit; qed")); + /// Our XCM location ancestry - i.e. what, if anything, `Parent` means evaluated in our context. Since + /// Rococo is a top-level relay-chain, there is no ancestry. pub const Ancestry: MultiLocation = Here.into(); + /// The check account, which holds any native assets that have been teleported out and not back in (yet). pub CheckAccount: AccountId = XcmPallet::check_account(); } -pub type SovereignAccountOf = - (ChildParachainConvertsVia, AccountId32Aliases); +/// The canonical means of converting a `MultiLocation` into an `AccountId`, used when we want to determine +/// the sovereign account controlled by a location. +pub type SovereignAccountOf = ( + // We can convert a child parachain using the standard `AccountId` conversion. + ChildParachainConvertsVia, + // We can directly alias an `AccountId32` into a local account. + AccountId32Aliases, +); +/// Our asset transactor. This is what allows us to interest with the runtime facilities from the point of +/// view of XCM-only concepts like `MultiLocation` and `MultiAsset`. +/// +/// Ours is only aware of the Balances pallet, which is mapped to `RocLocation`. pub type LocalAssetTransactor = XcmCurrencyAdapter< // Use this currency: Balances, @@ -53,21 +69,29 @@ pub type LocalAssetTransactor = XcmCurrencyAdapter< SovereignAccountOf, // Our chain's account ID type (we can't get away without mentioning it explicitly): AccountId, - // It's a native asset so we keep track of the teleports to maintain total issuance. + // We track our teleports in/out to keep total issuance correct. CheckAccount, >; +/// The means that we convert an the XCM message origin location into a local dispatch origin. type LocalOriginConverter = ( + // A `Signed` origin of the sovereign account that the original location controls. SovereignSignedViaLocation, + // A child parachain, natively expressed, has the `Parachain` origin. ChildParachainAsNative, + // The AccountId32 location type can be expressed natively as a `Signed` origin. SignedAccountId32AsNative, + // A system child parachain, expressed as a Superuser, converts to the `Root` origin. ChildSystemParachainAsSuperuser, ); parameter_types! { + /// The amount of weight an XCM operation takes. This is a safe overestimate. pub const BaseXcmWeight: u64 = 1_000_000_000; + /// Maximum number of instructions in a single XCM fragment. A sanity check against weight + /// calculations getting too crazy. + pub const MaxInstructions: u32 = 100; } - /// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our /// individual routers. pub type XcmRouter = ( @@ -77,44 +101,46 @@ pub type XcmRouter = ( parameter_types! { pub const Rococo: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(RocLocation::get()) }); - pub const RococoForTick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(100).into()); - pub const RococoForTrick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(110).into()); - pub const RococoForTrack: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(120).into()); - pub const RococoForStatemine: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(1000).into()); - pub const RococoForCanvas: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(1002).into()); - pub const RococoForEncointer: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(1003).into()); - pub const MaxInstructions: u32 = 100; + pub const Statemine: MultiLocation = Parachain(1000).into(); + pub const Contracts: MultiLocation = Parachain(1002).into(); + pub const Encointer: MultiLocation = Parachain(1003).into(); + pub const Tick: MultiLocation = Parachain(100).into(); + pub const Trick: MultiLocation = Parachain(110).into(); + pub const Track: MultiLocation = Parachain(120).into(); + pub const RococoForTick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Tick::get()); + pub const RococoForTrick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Trick::get()); + pub const RococoForTrack: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Track::get()); + pub const RococoForStatemine: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Statemine::get()); + pub const RococoForContracts: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Contracts::get()); + pub const RococoForEncointer: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Encointer::get()); } pub type TrustedTeleporters = ( xcm_builder::Case, xcm_builder::Case, xcm_builder::Case, xcm_builder::Case, - xcm_builder::Case, + xcm_builder::Case, xcm_builder::Case, ); -parameter_types! { - pub AllowUnpaidFrom: Vec = - vec![ - Parachain(100).into(), - Parachain(110).into(), - Parachain(120).into(), - Parachain(1000).into(), - Parachain(1002).into(), - Parachain(1003).into(), - ]; +match_types! { + pub type OnlyParachains: impl Contains = { + MultiLocation { parents: 0, interior: X1(Parachain(_)) } + }; } -use xcm_builder::{AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, TakeWeightCredit}; +/// The barriers one of which must be passed for an XCM message to be executed. pub type Barrier = ( + // Weight that is paid for may be consumed. TakeWeightCredit, + // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - AllowUnpaidExecutionFrom>, // <- Trusted parachains get free execution + // Messages coming from system parachains need not pay for execution. + AllowUnpaidExecutionFrom>, // Expected responses are OK. AllowKnownQueryResponses, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + AllowSubscriptionsFrom, ); pub struct XcmConfig; @@ -127,7 +153,9 @@ impl xcm_executor::Config for XcmConfig { type IsTeleporter = TrustedTeleporters; type LocationInverter = LocationInverter; type Barrier = Barrier; - type Weigher = FixedWeightBounds; + type Weigher = + WeightInfoBounds, Call, MaxInstructions>; + // The weight trader piggybacks on the existing transaction-fee conversion logic. type Trader = UsingComponents>; type ResponseHandler = XcmPallet; type AssetTrap = XcmPallet; @@ -139,26 +167,38 @@ parameter_types! { pub const CollectiveBodyId: BodyId = BodyId::Unit; } +parameter_types! { + pub const CouncilBodyId: BodyId = BodyId::Executive; +} + +/// Type to convert the council origin to a Plurality `MultiLocation` value. +pub type CouncilToPlurality = BackingToPlurality< + Origin, + pallet_collective::Origin, + CouncilBodyId, +>; + /// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location /// of this chain. pub type LocalOriginToLocation = ( // We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the // `Unit` body. - BackingToPlurality, CollectiveBodyId>, + CouncilToPlurality, // And a usual Signed origin to be used in XCM as a corresponding AccountId32 SignedToAccountId32, ); - impl pallet_xcm::Config for Runtime { type Event = Event; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; - // Anyone can execute XCM messages locally... + // Anyone can execute XCM messages locally. type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - // ...but they must match our filter, which right now rejects everything. - type XcmExecuteFilter = Nothing; + type XcmExecuteFilter = Everything; type XcmExecutor = xcm_executor::XcmExecutor; + // Anyone is able to use teleportation regardless of who they are and what they want to teleport. type XcmTeleportFilter = Everything; + // Anyone is able to use reserve transfers regardless of who they are and what they want to + // transfer. type XcmReserveTransferFilter = Everything; type Weigher = FixedWeightBounds; type LocationInverter = LocationInverter; diff --git a/scripts/ci/gitlab/lingua.dic b/scripts/ci/gitlab/lingua.dic index 8be00d55c494..6e6d0acea6ad 100644 --- a/scripts/ci/gitlab/lingua.dic +++ b/scripts/ci/gitlab/lingua.dic @@ -225,6 +225,7 @@ reservable responder/SM retriability reverify +ROC roundtrip/MS routable rpc