From 92a1a45041d9980ab0f061cdcbadf477856caf67 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sat, 27 Apr 2024 12:49:59 +0200 Subject: [PATCH 01/12] Update runtime (#1323) --- Cargo.lock | 4 + Cargo.toml | 8 + macros/Cargo.toml | 2 +- node/Cargo.toml | 2 +- primitives/Cargo.toml | 6 +- primitives/src/assets.rs | 17 +- primitives/src/assets/all_assets.rs | 5 +- primitives/src/assets/campaign_assets.rs | 18 +- primitives/src/assets/currencies.rs | 17 +- primitives/src/assets/custom_assets.rs | 18 +- primitives/src/assets/market_assets.rs | 17 +- primitives/src/assets/subsets/base_assets.rs | 20 +- primitives/src/assets/subsets/parimutuel.rs | 19 +- primitives/src/assets/subsets/xcm_assets.rs | 20 +- primitives/src/types.rs | 2 +- runtime/battery-station/Cargo.toml | 6 +- .../src/integration_tests/xcm/setup.rs | 62 +- .../src/integration_tests/xcm/test_net.rs | 76 +- .../xcm/tests/currency_id_convert.rs | 39 +- .../integration_tests/xcm/tests/transfers.rs | 18 +- runtime/battery-station/src/lib.rs | 6 +- .../battery-station/src/parachain_params.rs | 15 +- runtime/battery-station/src/parameters.rs | 15 +- .../src/xcm_config/asset_registry.rs | 15 +- .../battery-station/src/xcm_config/config.rs | 114 +- runtime/common/Cargo.toml | 2 +- runtime/common/src/fees.rs | 204 +- runtime/common/src/lib.rs | 285 +- runtime/common/src/weights/frame_system.rs | 13 + runtime/common/src/weights/pallet_assets.rs | 664 +-- runtime/common/src/weights/pallet_balances.rs | 133 +- .../common/src/weights/pallet_contracts.rs | 3555 ++++++++--------- .../common/src/weights/pallet_democracy.rs | 442 +- .../src/weights/pallet_parachain_staking.rs | 843 ++-- runtime/zeitgeist/Cargo.toml | 10 +- .../src/integration_tests/xcm/setup.rs | 68 +- .../src/integration_tests/xcm/test_net.rs | 75 +- .../xcm/tests/currency_id_convert.rs | 39 +- .../integration_tests/xcm/tests/transfers.rs | 36 +- runtime/zeitgeist/src/lib.rs | 9 +- runtime/zeitgeist/src/parachain_params.rs | 15 +- runtime/zeitgeist/src/parameters.rs | 15 +- .../src/xcm_config/asset_registry.rs | 15 +- runtime/zeitgeist/src/xcm_config/config.rs | 114 +- zrml/asset-router/Cargo.toml | 2 +- zrml/asset-router/src/pallet_impl/balanced.rs | 24 + zrml/asset-router/src/pallet_impl/mod.rs | 1 + zrml/authorized/Cargo.toml | 2 +- zrml/court/Cargo.toml | 2 +- zrml/global-disputes/Cargo.toml | 2 +- zrml/hybrid-router/Cargo.toml | 2 +- zrml/hybrid-router/src/benchmarking.rs | 1 + zrml/liquidity-mining/Cargo.toml | 2 +- zrml/liquidity-mining/src/lib.rs | 5 +- zrml/market-commons/Cargo.toml | 2 +- zrml/neo-swaps/Cargo.toml | 2 +- zrml/neo-swaps/src/benchmarking.rs | 1 + zrml/orderbook/Cargo.toml | 2 +- zrml/orderbook/fuzz/Cargo.toml | 2 +- zrml/parimutuel/Cargo.toml | 2 +- zrml/parimutuel/src/benchmarking.rs | 1 + zrml/prediction-markets/Cargo.toml | 2 +- zrml/prediction-markets/fuzz/Cargo.toml | 2 +- .../prediction-markets/runtime-api/Cargo.toml | 2 +- zrml/rikiddo/Cargo.toml | 2 +- zrml/rikiddo/fuzz/Cargo.toml | 2 +- zrml/simple-disputes/Cargo.toml | 2 +- zrml/styx/Cargo.toml | 2 +- zrml/swaps/Cargo.toml | 2 +- zrml/swaps/fuzz/Cargo.toml | 2 +- zrml/swaps/rpc/Cargo.toml | 2 +- zrml/swaps/runtime-api/Cargo.toml | 2 +- 72 files changed, 3894 insertions(+), 3261 deletions(-) create mode 100644 zrml/asset-router/src/pallet_impl/balanced.rs diff --git a/Cargo.lock b/Cargo.lock index fdaa4123f..a0b7d23b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -799,6 +799,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", + "env_logger 0.10.2", "frame-benchmarking", "frame-executive", "frame-support", @@ -833,6 +834,7 @@ dependencies = [ "pallet-identity", "pallet-insecure-randomness-collective-flip", "pallet-membership", + "pallet-message-queue", "pallet-multisig", "pallet-parachain-staking", "pallet-preimage", @@ -14866,6 +14868,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", + "env_logger 0.10.2", "frame-benchmarking", "frame-executive", "frame-support", @@ -14900,6 +14903,7 @@ dependencies = [ "pallet-identity", "pallet-insecure-randomness-collective-flip", "pallet-membership", + "pallet-message-queue", "pallet-multisig", "pallet-parachain-staking", "pallet-preimage", diff --git a/Cargo.toml b/Cargo.toml index 834d15d49..3d05054d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,10 @@ +[workspace.package] +authors = ["Zeitgeist PM "] +edition = "2021" +homepage = "https://zeitgeist.pm/" +license = "GPL-3.0" +repository = "https://github.com/zeitgeistpm/zeitgeist" + [workspace] default-members = [ "macros", @@ -217,6 +224,7 @@ polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch polkadot-test-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } # Polkadot / XCM (wasm) +pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } diff --git a/macros/Cargo.toml b/macros/Cargo.toml index 39397744a..903bd3b33 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -1,5 +1,5 @@ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zeitgeist-macros" version = "0.5.2" diff --git a/node/Cargo.toml b/node/Cargo.toml index 42ca8bc00..cb75bb0bf 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -184,7 +184,7 @@ with-zeitgeist-runtime = ["zeitgeist-runtime"] authors = ["Zeitgeist PM "] build = "build.rs" description = "An evolving blockchain for prediction markets and futarchy." -edition = "2021" +edition.workspace = true homepage = "https://zeitgeist.pm" name = "zeitgeist-node" version = "0.5.2" diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 689562b82..55040397a 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -9,8 +9,8 @@ orml-currencies = { workspace = true } orml-tokens = { workspace = true } orml-traits = { workspace = true } parity-scale-codec = { workspace = true, features = ["derive", "max-encoded-len"] } -scale-info = { workspace = true, features = ["derive"] } -serde = { workspace = true, features = ["derive"], optional = true } +scale-info = { workspace = true, features = ["derive", "serde"] } +serde = { workspace = true, features = ["alloc", "derive", "rc"] } sp-arithmetic = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } @@ -38,6 +38,6 @@ std = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zeitgeist-primitives" version = "0.5.2" diff --git a/primitives/src/assets.rs b/primitives/src/assets.rs index 7de237bb8..a32f7c4cf 100644 --- a/primitives/src/assets.rs +++ b/primitives/src/assets.rs @@ -45,11 +45,22 @@ mod tests; /// meaning that they think the outcome will be closer to the upper bound /// or a `Short` position meaning that they think the outcome will be closer /// to the lower bound. -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] #[derive( - Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, Ord, PartialEq, PartialOrd, TypeInfo, + Clone, + Copy, + Debug, + Decode, + Eq, + Encode, + MaxEncodedLen, + Ord, + PartialEq, + PartialOrd, + TypeInfo, + serde::Deserialize, + serde::Serialize, )] +#[serde(rename_all = "camelCase")] pub enum ScalarPosition { Long, Short, diff --git a/primitives/src/assets/all_assets.rs b/primitives/src/assets/all_assets.rs index 012486af9..a14acc5b7 100644 --- a/primitives/src/assets/all_assets.rs +++ b/primitives/src/assets/all_assets.rs @@ -37,8 +37,6 @@ use super::*; /// # Types /// /// * `MI`: Market Id -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] #[derive( Clone, Copy, @@ -52,7 +50,10 @@ use super::*; PartialEq, PartialOrd, TypeInfo, + serde::Deserialize, + serde::Serialize, )] +#[serde(rename_all = "camelCase")] pub enum Asset { #[codec(index = 0)] CategoricalOutcome(MI, CategoryIndex), diff --git a/primitives/src/assets/campaign_assets.rs b/primitives/src/assets/campaign_assets.rs index dcf912a77..9461f369e 100644 --- a/primitives/src/assets/campaign_assets.rs +++ b/primitives/src/assets/campaign_assets.rs @@ -20,11 +20,23 @@ use super::*; /// The `CampaignAsset` tuple struct represents all campaign assets. /// Campaign assets can have special properties, such as the capability /// to pay fees. -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] #[derive( - Clone, CompactAs, Copy, Debug, Decode, Default, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo, + Clone, + CompactAs, + Copy, + Debug, + Decode, + Eq, + Encode, + MaxEncodedLen, + Ord, + PartialEq, + PartialOrd, + TypeInfo, + serde::Deserialize, + serde::Serialize, )] +#[serde(rename_all = "camelCase")] pub struct CampaignAssetClass(#[codec(compact)] pub CampaignAssetId); impl From> for CampaignAssetClass { diff --git a/primitives/src/assets/currencies.rs b/primitives/src/assets/currencies.rs index d29359d43..a432d657d 100644 --- a/primitives/src/assets/currencies.rs +++ b/primitives/src/assets/currencies.rs @@ -19,11 +19,22 @@ use super::*; /// The `CurrencyClass` enum represents all non-ztg currencies // used in orml-tokens -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] #[derive( - Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, Ord, PartialEq, PartialOrd, TypeInfo, + Clone, + Copy, + Debug, + Decode, + Eq, + Encode, + MaxEncodedLen, + Ord, + PartialEq, + PartialOrd, + TypeInfo, + serde::Deserialize, + serde::Serialize, )] +#[serde(rename_all = "camelCase")] pub enum CurrencyClass { // All Outcome and Share variants will be removed once the lazy migration from // orml-tokens to pallet-assets is complete diff --git a/primitives/src/assets/custom_assets.rs b/primitives/src/assets/custom_assets.rs index b5f8339ec..65398c526 100644 --- a/primitives/src/assets/custom_assets.rs +++ b/primitives/src/assets/custom_assets.rs @@ -18,11 +18,23 @@ use super::*; /// The `CustomAsset` tuple struct represents all custom assets. -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] #[derive( - Clone, CompactAs, Copy, Debug, Decode, Default, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo, + Clone, + CompactAs, + Copy, + Debug, + Decode, + Eq, + Encode, + MaxEncodedLen, + Ord, + PartialEq, + PartialOrd, + TypeInfo, + serde::Deserialize, + serde::Serialize, )] +#[serde(rename_all = "camelCase")] pub struct CustomAssetClass(#[codec(compact)] pub CustomAssetId); impl From> for CustomAssetClass { diff --git a/primitives/src/assets/market_assets.rs b/primitives/src/assets/market_assets.rs index 7573cf74a..e675f7c67 100644 --- a/primitives/src/assets/market_assets.rs +++ b/primitives/src/assets/market_assets.rs @@ -23,11 +23,22 @@ use super::*; /// # Types /// /// * `MI`: Market Id -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] #[derive( - Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, PartialEq, PartialOrd, Ord, TypeInfo, + Clone, + Copy, + Debug, + Decode, + Eq, + Encode, + MaxEncodedLen, + Ord, + PartialEq, + PartialOrd, + TypeInfo, + serde::Deserialize, + serde::Serialize, )] +#[serde(rename_all = "camelCase")] pub enum MarketAssetClass { #[codec(index = 0)] CategoricalOutcome(MI, CategoryIndex), diff --git a/primitives/src/assets/subsets/base_assets.rs b/primitives/src/assets/subsets/base_assets.rs index 041d0b10c..393a1ab8f 100644 --- a/primitives/src/assets/subsets/base_assets.rs +++ b/primitives/src/assets/subsets/base_assets.rs @@ -19,9 +19,23 @@ use super::*; /// The `BaseAssetClass` enum represents all assets that can be used as collateral in /// prediction markets. -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] -#[derive(Clone, Copy, Debug, Decode, Default, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo)] +#[derive( + Clone, + Copy, + Debug, + Decode, + Default, + Eq, + Encode, + MaxEncodedLen, + Ord, + PartialEq, + PartialOrd, + TypeInfo, + serde::Deserialize, + serde::Serialize, +)] +#[serde(rename_all = "camelCase")] pub enum BaseAssetClass { #[codec(index = 4)] #[default] diff --git a/primitives/src/assets/subsets/parimutuel.rs b/primitives/src/assets/subsets/parimutuel.rs index 26d412a4e..5135db646 100644 --- a/primitives/src/assets/subsets/parimutuel.rs +++ b/primitives/src/assets/subsets/parimutuel.rs @@ -18,9 +18,22 @@ use super::*; /// The `ParimutuelAssetClass` enum represents all assets that are specific to parimutuel markets. -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] -#[derive(Clone, Copy, Debug, Decode, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo)] +#[derive( + Clone, + Copy, + Debug, + Decode, + Eq, + Encode, + MaxEncodedLen, + Ord, + PartialEq, + PartialOrd, + TypeInfo, + serde::Deserialize, + serde::Serialize, +)] +#[serde(rename_all = "camelCase")] pub enum ParimutuelAssetClass { #[codec(index = 6)] Share(MI, CategoryIndex), diff --git a/primitives/src/assets/subsets/xcm_assets.rs b/primitives/src/assets/subsets/xcm_assets.rs index bbad9de08..4b03ecf33 100644 --- a/primitives/src/assets/subsets/xcm_assets.rs +++ b/primitives/src/assets/subsets/xcm_assets.rs @@ -18,9 +18,23 @@ use super::*; /// The `XcmAssetClass` enum represents all assets that can be transferred via XCM. -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] -#[derive(Clone, Copy, Debug, Decode, Default, Eq, Encode, MaxEncodedLen, PartialEq, TypeInfo)] +#[derive( + Clone, + Copy, + Debug, + Decode, + Default, + Eq, + Encode, + MaxEncodedLen, + Ord, + PartialEq, + PartialOrd, + TypeInfo, + serde::Deserialize, + serde::Serialize, +)] +#[serde(rename_all = "camelCase")] pub enum XcmAssetClass { #[codec(index = 4)] #[default] diff --git a/primitives/src/types.rs b/primitives/src/types.rs index 0cc42fb14..a48a5b00d 100644 --- a/primitives/src/types.rs +++ b/primitives/src/types.rs @@ -117,7 +117,7 @@ pub type XcmAsset = XcmAssetClass; pub type TxPaymentAssetId = u32; /// Index of a transaction in the chain. -pub type Index = u64; +pub type Nonce = u64; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; diff --git a/runtime/battery-station/Cargo.toml b/runtime/battery-station/Cargo.toml index 9c1b30917..cf6c27557 100644 --- a/runtime/battery-station/Cargo.toml +++ b/runtime/battery-station/Cargo.toml @@ -98,6 +98,7 @@ orml-asset-registry = { workspace = true, optional = true } orml-unknown-tokens = { workspace = true, optional = true } orml-xcm-support = { workspace = true, optional = true } orml-xtokens = { workspace = true, optional = true } +pallet-message-queue = { workspace = true, optional = true } pallet-xcm = { workspace = true, optional = true } polkadot-runtime-parachains = { workspace = true, optional = true } rococo-runtime = { workspace = true, optional = true } @@ -127,6 +128,7 @@ zrml-swaps = { workspace = true } zrml-swaps-runtime-api = { workspace = true } [dev-dependencies] +env_logger = { workspace = true } sp-io = { workspace = true, features = ["default"] } test-case = { workspace = true } xcm-simulator = { workspace = true } @@ -162,6 +164,7 @@ parachain = [ "orml-unknown-tokens", "orml-xcm-support", "orml-xtokens", + "pallet-message-queue", "pallet-xcm", "polkadot-runtime-parachains", "rococo-runtime", @@ -319,6 +322,7 @@ std = [ "orml-unknown-tokens?/std", "orml-xcm-support?/std", "orml-xtokens?/std", + "pallet-message-queue?/std", "pallet-xcm?/std", "polkadot-runtime-parachains?/std", "rococo-runtime?/std", @@ -428,7 +432,7 @@ force-debug = ["sp-debug-derive/force-debug"] [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "battery-station-runtime" version = "0.5.2" diff --git a/runtime/battery-station/src/integration_tests/xcm/setup.rs b/runtime/battery-station/src/integration_tests/xcm/setup.rs index 092184ade..7e033b5c3 100644 --- a/runtime/battery-station/src/integration_tests/xcm/setup.rs +++ b/runtime/battery-station/src/integration_tests/xcm/setup.rs @@ -18,11 +18,12 @@ use crate::{ xcm_config::config::{battery_station, general_key}, - AccountId, AssetRegistry, Assets, Balance, ExistentialDeposit, Runtime, RuntimeOrigin, System, + AccountId, AssetRegistry, AssetRegistryStringLimit, Assets, Balance, ExistentialDeposit, + Runtime, RuntimeOrigin, System, }; -use frame_support::{assert_ok, traits::GenesisBuild}; +use frame_support::assert_ok; use orml_traits::asset_registry::AssetMetadata; -use sp_runtime::AccountId32; +use sp_runtime::{AccountId32, BuildStorage}; use xcm::{ latest::{Junction::Parachain, Junctions::X2, MultiLocation}, VersionedMultiLocation, @@ -32,11 +33,12 @@ use zeitgeist_primitives::types::{CustomMetadata, XcmAsset}; pub(super) struct ExtBuilder { balances: Vec<(AccountId, Assets, Balance)>, parachain_id: u32, + safe_xcm_version: Option, } impl Default for ExtBuilder { fn default() -> Self { - Self { balances: vec![], parachain_id: battery_station::ID } + Self { balances: vec![], parachain_id: battery_station::ID, safe_xcm_version: None } } } @@ -51,9 +53,15 @@ impl ExtBuilder { self } + pub fn with_safe_xcm_version(mut self, safe_xcm_version: u32) -> Self { + self.safe_xcm_version = Some(safe_xcm_version); + self + } + pub fn build(self) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let native_currency_id = Assets::Ztg; + pallet_balances::GenesisConfig:: { balances: self .balances @@ -79,16 +87,18 @@ impl ExtBuilder { .assimilate_storage(&mut t) .unwrap(); - >::assimilate_storage( - ¶chain_info::GenesisConfig { parachain_id: self.parachain_id.into() }, - &mut t, - ) + parachain_info::GenesisConfig:: { + _config: Default::default(), + parachain_id: self.parachain_id.into(), + } + .assimilate_storage(&mut t) .unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, - &mut t, - ) + pallet_xcm::GenesisConfig:: { + _config: Default::default(), + safe_xcm_version: self.safe_xcm_version, + } + .assimilate_storage(&mut t) .unwrap(); let mut ext = sp_io::TestExternalities::new(t); @@ -163,10 +173,10 @@ pub(super) fn foreign_parent_multilocation() -> MultiLocation { pub(super) fn register_foreign_ztg(additional_meta: Option) { // Register ZTG as foreign asset. - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 10, - name: "Zeitgeist".into(), - symbol: "ZTG".into(), + name: "Zeitgeist".as_bytes().to_vec().try_into().unwrap(), + symbol: "ZTG".as_bytes().to_vec().try_into().unwrap(), existential_deposit: ExistentialDeposit::get(), location: Some(VersionedMultiLocation::V3(foreign_ztg_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -176,10 +186,10 @@ pub(super) fn register_foreign_ztg(additional_meta: Option) { } pub(super) fn register_btc(additional_meta: Option) { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 8, - name: "Bitcoin".into(), - symbol: "BTC".into(), + name: "Bitcoin".as_bytes().to_vec().try_into().unwrap(), + symbol: "BTC".as_bytes().to_vec().try_into().unwrap(), existential_deposit: ExistentialDeposit::get(), location: Some(VersionedMultiLocation::V3(foreign_sibling_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -190,10 +200,10 @@ pub(super) fn register_btc(additional_meta: Option) { pub(super) fn register_foreign_sibling(additional_meta: Option) { // Register native Sibling token as foreign asset. - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 10, - name: "Sibling".into(), - symbol: "SBL".into(), + name: "Sibling".as_bytes().to_vec().try_into().unwrap(), + symbol: "SBL".as_bytes().to_vec().try_into().unwrap(), existential_deposit: ExistentialDeposit::get(), location: Some(VersionedMultiLocation::V3(foreign_sibling_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -208,10 +218,10 @@ pub(super) fn register_foreign_sibling(additional_meta: Option) pub(super) fn register_foreign_parent(additional_meta: Option) { // Register roc as foreign asset in the sibling parachain - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 12, - name: "Rococo".into(), - symbol: "ROC".into(), + name: "Rococo".as_bytes().to_vec().try_into().unwrap(), + symbol: "ROC".as_bytes().to_vec().try_into().unwrap(), existential_deposit: 33_333_333, // 0.0033333333 location: Some(VersionedMultiLocation::V3(foreign_parent_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -234,5 +244,5 @@ pub(super) fn zeitgeist_parachain_account() -> AccountId { fn parachain_account(id: u32) -> AccountId { use sp_runtime::traits::AccountIdConversion; - polkadot_parachain::primitives::Sibling::from(id).into_account_truncating() + polkadot_parachain_primitives::primitives::Sibling::from(id).into_account_truncating() } diff --git a/runtime/battery-station/src/integration_tests/xcm/test_net.rs b/runtime/battery-station/src/integration_tests/xcm/test_net.rs index 2ee922bc5..358110eb1 100644 --- a/runtime/battery-station/src/integration_tests/xcm/test_net.rs +++ b/runtime/battery-station/src/integration_tests/xcm/test_net.rs @@ -18,22 +18,22 @@ use crate::{ parameters::ZeitgeistTreasuryAccount, xcm_config::config::battery_station, Assets, DmpQueue, - Runtime, RuntimeOrigin, XcmpQueue, -}; -use frame_support::{traits::GenesisBuild, weights::Weight}; -use polkadot_primitives::{ - runtime_api::runtime_decl_for_ParachainHost::ParachainHostV3, - v2::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE}, + XcmpQueue, }; use polkadot_runtime_parachains::configuration::HostConfiguration; -use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain}; +use sp_runtime::BuildStorage; +use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; use super::setup::{roc, ztg, ExtBuilder, ALICE, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; decl_test_relay_chain! { pub struct RococoNet { Runtime = rococo_runtime::Runtime, - XcmConfig = rococo_runtime::xcm_config::XcmConfig, + RuntimeCall = rococo_runtime::RuntimeCall, + RuntimeEvent = rococo_runtime::RuntimeEvent, + XcmConfig = rococo_runtime::XcmConfig, + MessageQueue = rococo_runtime::MessageQueue, + System = rococo_runtime::System, new_ext = relay_ext(), } } @@ -41,7 +41,6 @@ decl_test_relay_chain! { decl_test_parachain! { pub struct Zeitgeist { Runtime = Runtime, - RuntimeOrigin = RuntimeOrigin, XcmpMessageHandler = XcmpQueue, DmpMessageHandler = DmpQueue, new_ext = para_ext(battery_station::ID), @@ -51,7 +50,6 @@ decl_test_parachain! { decl_test_parachain! { pub struct Sibling { Runtime = Runtime, - RuntimeOrigin = RuntimeOrigin, XcmpMessageHandler = XcmpQueue, DmpMessageHandler = DmpQueue, new_ext = para_ext(PARA_ID_SIBLING), @@ -76,23 +74,21 @@ decl_test_network! { pub(super) fn relay_ext() -> sp_io::TestExternalities { use rococo_runtime::{Runtime, System}; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(ALICE, roc(2002))] } .assimilate_storage(&mut t) .unwrap(); polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: default_parachains_host_configuration(), + config: mock_relay_config(), } .assimilate_storage(&mut t) .unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, - &mut t, - ) - .unwrap(); + pallet_xcm::GenesisConfig:: { _config: Default::default(), safe_xcm_version: Some(2) } + .assimilate_storage(&mut t) + .unwrap(); let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); @@ -100,6 +96,8 @@ pub(super) fn relay_ext() -> sp_io::TestExternalities { } pub(super) fn para_ext(parachain_id: u32) -> sp_io::TestExternalities { + let _ = env_logger::builder().is_test(true).try_init(); + ExtBuilder::default() .set_balances(vec![ (ALICE, Assets::Ztg, ztg(10)), @@ -107,43 +105,19 @@ pub(super) fn para_ext(parachain_id: u32) -> sp_io::TestExternalities { (ZeitgeistTreasuryAccount::get(), FOREIGN_PARENT_ID.into(), roc(1)), ]) .set_parachain_id(parachain_id) + .with_safe_xcm_version(2) .build() } -fn default_parachains_host_configuration() -> HostConfiguration { - HostConfiguration { - minimum_validation_upgrade_delay: 5, - validation_upgrade_cooldown: 5u32, - validation_upgrade_delay: 5, - code_retention_period: 1200, - max_code_size: MAX_CODE_SIZE, - max_pov_size: MAX_POV_SIZE, - max_head_data_size: 32 * 1024, - group_rotation_frequency: 20, - chain_availability_period: 4, - thread_availability_period: 4, - max_upward_queue_count: 8, - max_upward_queue_size: 1024 * 1024, - max_downward_message_size: 1024, - ump_service_total_weight: Weight::from_ref_time(4_u64 * 1_000_000_000_u64), - max_upward_message_size: 50 * 1024, - max_upward_message_num_per_candidate: 5, - hrmp_sender_deposit: 0, - hrmp_recipient_deposit: 0, - hrmp_channel_max_capacity: 8, - hrmp_channel_max_total_size: 8 * 1024, - hrmp_max_parachain_inbound_channels: 4, - hrmp_max_parathread_inbound_channels: 4, - hrmp_channel_max_message_size: 1024 * 1024, - hrmp_max_parachain_outbound_channels: 4, - hrmp_max_parathread_outbound_channels: 4, - hrmp_max_message_num_per_candidate: 5, - dispute_period: 6, - no_show_slots: 2, - n_delay_tranches: 25, - needed_approvals: 2, - relay_vrf_modulo_samples: 2, - zeroth_delay_tranche_width: 0, +pub fn mock_relay_config() -> HostConfiguration { + HostConfiguration:: { + hrmp_channel_max_capacity: u32::MAX, + hrmp_channel_max_total_size: u32::MAX, + hrmp_max_parachain_inbound_channels: 10, + hrmp_max_parachain_outbound_channels: 10, + hrmp_channel_max_message_size: u32::MAX, + // Changed to avoid aritmetic errors within hrmp_close + max_downward_message_size: 100_000u32, ..Default::default() } } diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs index e28c94407..50dfbcc41 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs @@ -29,17 +29,15 @@ use crate::{ Assets, CustomMetadata, ScalarPosition, XcmAsset, }; use core::fmt::Debug; -use frame_support::assert_err; -use sp_runtime::traits::Convert as C2; +use sp_runtime::traits::{Convert, MaybeEquivalence}; use test_case::test_case; use xcm::latest::{Junction::*, Junctions::*, MultiLocation}; -use xcm_emulator::TestExt; -use xcm_executor::traits::Convert as C1; +use xcm_simulator::TestExt; fn convert_common_native(expected: T) where T: Copy + Debug + PartialEq, - AssetConvert: C1 + C2>, + AssetConvert: MaybeEquivalence + Convert>, { assert_eq!(battery_station::KEY.to_vec(), vec![0, 1]); @@ -47,11 +45,17 @@ where let ztg_location_inner: MultiLocation = MultiLocation::new(0, X1(general_key(battery_station::KEY))); - assert_eq!(>::convert(ztg_location_inner), Ok(expected)); + assert_eq!( + >::convert(&ztg_location_inner), + Some(expected) + ); // The canonical way Ztg is represented out in the wild Zeitgeist::execute_with(|| { - assert_eq!(>::convert(expected), Some(foreign_ztg_multilocation())) + assert_eq!( + >::convert(expected), + Some(foreign_ztg_multilocation()) + ) }); } @@ -61,15 +65,18 @@ fn convert_common_non_native( register: fn(Option), ) where T: Copy + Debug + PartialEq, - AssetConvert: C1 + C2>, + AssetConvert: MaybeEquivalence + Convert>, { Zeitgeist::execute_with(|| { - assert_err!(>::convert(multilocation), multilocation); - assert_eq!(>::convert(expected), None); + assert_eq!(>::convert(&multilocation), None); + assert_eq!(>::convert(expected), None); // Register parent as foreign asset in the Zeitgeist parachain register(None); - assert_eq!(>::convert(multilocation), Ok(expected)); - assert_eq!(>::convert(expected), Some(multilocation)); + assert_eq!( + >::convert(&multilocation), + Some(expected) + ); + assert_eq!(>::convert(expected), Some(multilocation)); }); } @@ -125,7 +132,9 @@ fn convert_unkown_multilocation() { MultiLocation::new(1, X2(Parachain(battery_station::ID), general_key(&[42]))); Zeitgeist::execute_with(|| { - assert!(>::convert(unknown_location).is_err()); + assert!( + >::convert(&unknown_location).is_none() + ); }); } @@ -164,7 +173,7 @@ fn convert_unkown_multilocation() { fn convert_unsupported_asset(asset: T) where T: Copy + Debug + PartialEq, - AssetConvert: C2>, + AssetConvert: Convert>, { - Zeitgeist::execute_with(|| assert_eq!(>::convert(asset), None)); + Zeitgeist::execute_with(|| assert_eq!(>::convert(asset), None)); } diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs index 109a388dd..a2d62dc11 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs @@ -30,10 +30,10 @@ use crate::{ ZeitgeistTreasuryAccount, }; -use frame_support::assert_ok; +use frame_support::{assert_ok, traits::tokens::fungible::Mutate}; use orml_traits::MultiCurrency; use xcm::latest::{Junction, Junction::*, Junctions::*, MultiLocation, WeightLimit}; -use xcm_emulator::TestExt; +use xcm_simulator::TestExt; use zeitgeist_primitives::{ constants::{BalanceFractionalDecimals, BASE}, types::{CustomMetadata, XcmAsset, XcmMetadata}, @@ -192,12 +192,10 @@ fn transfer_btc_sibling_to_zeitgeist() { Sibling::execute_with(|| { assert_eq!(Balances::free_balance(&ALICE), sibling_alice_initial_balance); // Set the sovereign balance such that it is not subject to dust collection - assert_ok!(Balances::set_balance( - RuntimeOrigin::root(), - zeitgeist_parachain_account().into(), - initial_sovereign_balance, - 0 - )); + assert_eq!( + Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), + initial_sovereign_balance + ); assert_ok!(XTokens::transfer( RuntimeOrigin::signed(ALICE), // Target chain will interpret XcmAsset::Ztg as BTC in this context. @@ -444,8 +442,8 @@ fn transfer_ztg_to_sibling_with_custom_fee() { #[test] fn test_total_fee() { - assert_eq!(ztg_fee(), 80_128_000); - assert_eq!(roc_fee(), 8_012_800_000); + assert_eq!(ztg_fee(), 64_296_000); + assert_eq!(roc_fee(), 6_429_600_000); } #[inline] diff --git a/runtime/battery-station/src/lib.rs b/runtime/battery-station/src/lib.rs index 2393a7634..9aa33beb4 100644 --- a/runtime/battery-station/src/lib.rs +++ b/runtime/battery-station/src/lib.rs @@ -17,7 +17,7 @@ // along with Zeitgeist. If not, see . #![cfg_attr(not(feature = "std"), no_std)] -#![recursion_limit = "512"] +#![recursion_limit = "1024"] extern crate alloc; @@ -79,11 +79,10 @@ use { use frame_support::construct_runtime; -use sp_api::impl_runtime_apis; +use sp_api::{impl_runtime_apis, BlockT}; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, - traits::Block as BlockT, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; @@ -224,6 +223,7 @@ create_runtime_with_additional_pallets!( impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); } impl_config_traits!(); diff --git a/runtime/battery-station/src/parachain_params.rs b/runtime/battery-station/src/parachain_params.rs index 3038cbd6d..d9affc3a2 100644 --- a/runtime/battery-station/src/parachain_params.rs +++ b/runtime/battery-station/src/parachain_params.rs @@ -38,6 +38,9 @@ use zeitgeist_primitives::{ }; parameter_types! { + // Asset registry + pub const AssetRegistryStringLimit: u32 = 1024; + // Author-Mapping /// The amount that should be taken as a security deposit when registering a NimbusId. pub const CollatorDeposit: Balance = 2 * BASE; @@ -66,16 +69,20 @@ parameter_types! { pub const LeaveDelegatorsDelay: u32 = 2; /// Maximum bottom delegations per candidate pub const MaxBottomDelegationsPerCandidate: u32 = 50; + /// Maximum number of collator candidates + pub const MaxCandidates: u32 = 200; /// Maximum delegations per delegator pub const MaxDelegationsPerDelegator: u32 = 100; /// Maximum top delegations per candidate pub const MaxTopDelegationsPerCandidate: u32 = 300; + /// Number of rounds until a collator not producing blocks is marked as inactive. + pub const MaxOfflineRounds: u32 = 1; /// Minimum round length is 2 minutes pub const MinBlocksPerRound: u32 = 2 * BLOCKS_PER_MINUTE as u32; /// Minimum stake required to become a collator - pub const MinCollatorStk: u128 = 64 * BASE; + pub const MinCandidateStk: u128 = 64 * BASE; /// Minimum stake required to be reserved to be a delegator - pub const MinDelegatorStk: u128 = BASE / 2; + pub const MinDelegation: u128 = BASE / 2; /// Minimum collators selected per round, default at genesis and minimum forever after pub const MinSelectedCandidates: u32 = 8; /// Rounds before the delegator revocation can be executed @@ -93,6 +100,10 @@ parameter_types! { pub const MaxAssetsIntoHolding: u32 = 64; /// Max instructions per XCM pub const MaxInstructions: u32 = 100; + /// The maximum number of local XCM locks that a single account may have. + pub const MaxLockers: u32 = 8; + /// The maximum number of consumers a single remote lock may have. + pub const MaxRemoteLockConsumers: u32 = 0; /// Relative self location pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into()))); diff --git a/runtime/battery-station/src/parameters.rs b/runtime/battery-station/src/parameters.rs index 2cf328b9c..342355be7 100644 --- a/runtime/battery-station/src/parameters.rs +++ b/runtime/battery-station/src/parameters.rs @@ -47,7 +47,7 @@ use zeitgeist_primitives::{constants::*, types::*}; pub(crate) const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); pub(crate) const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - polkadot_primitives::v2::MAX_POV_SIZE as u64, + polkadot_primitives::MAX_POV_SIZE as u64, ); pub(crate) const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); pub(crate) const FEES_AND_TIPS_TREASURY_PERCENTAGE: u32 = 100; @@ -56,11 +56,13 @@ pub(crate) const FEES_AND_TIPS_BURN_PERCENTAGE: u32 = 0; #[cfg(not(feature = "parachain"))] parameter_types! { // Aura + pub const AllowMultipleBlocksPerSlot: bool = false; pub const MaxAuthorities: u32 = 32; // Grandpa // Can be 0, as equivocation handling is not enabled (HandleEquivocation = ()) pub const MaxSetIdSessionEntries: u32 = 0; + pub const MaxNominators: u32 = 0; } parameter_types! { @@ -122,22 +124,19 @@ parameter_types! { pub const CouncilMaxMembers: u32 = 100; pub const CouncilMaxProposals: u32 = 100; pub const CouncilMotionDuration: BlockNumber = 7 * BLOCKS_PER_DAY; + pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; pub const TechnicalCommitteeMaxMembers: u32 = 100; pub const TechnicalCommitteeMaxProposals: u32 = 64; pub const TechnicalCommitteeMotionDuration: BlockNumber = 7 * BLOCKS_PER_DAY; // Contracts - pub const ContractsDeletionQueueDepth: u32 = 128; - pub ContractsDeletionWeightLimit: Weight = Perbill::from_percent(10) - * RuntimeBlockWeights::get() - .per_class - .get(DispatchClass::Normal) - .max_total - .unwrap_or(RuntimeBlockWeights::get().max_block); + pub const ContractsCodeHashLockupDepositPercent: Perbill = Perbill::from_percent(10); + pub const ContractsDefaultDepositLimit: Balance = deposit(16, 16 * 1024); pub const ContractsDepositPerByte: Balance = deposit(0,1); pub const ContractsDepositPerItem: Balance = deposit(1,0); pub const ContractsMaxCodeLen: u32 = 123 * 1024; pub const ContractsMaxDebugBufferLen: u32 = 2 * 1024 * 1024; + pub const ContractsMaxDelegateDependencies: u32 = 32; pub const ContractsMaxStorageKeyLen: u32 = 128; pub const ContractsUnsafeUnstableInterface: bool = true; pub ContractsSchedule: pallet_contracts::Schedule = Default::default(); diff --git a/runtime/battery-station/src/xcm_config/asset_registry.rs b/runtime/battery-station/src/xcm_config/asset_registry.rs index 9deb85aa0..ab6c618a4 100644 --- a/runtime/battery-station/src/xcm_config/asset_registry.rs +++ b/runtime/battery-station/src/xcm_config/asset_registry.rs @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . -use crate::{Balance, XcmAsset}; +use crate::{AssetRegistryStringLimit, Balance, XcmAsset}; use orml_traits::asset_registry::{AssetMetadata, AssetProcessor}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; @@ -29,11 +29,16 @@ use zeitgeist_primitives::types::CustomMetadata; /// Only pre check is to ensure an asset id was passed. pub struct CustomAssetProcessor; -impl AssetProcessor> for CustomAssetProcessor { +impl AssetProcessor> + for CustomAssetProcessor +{ fn pre_register( id: Option, - metadata: AssetMetadata, - ) -> Result<(XcmAsset, AssetMetadata), DispatchError> { + metadata: AssetMetadata, + ) -> Result< + (XcmAsset, AssetMetadata), + DispatchError, + > { match id { Some(id) => Ok((id, metadata)), None => Err(DispatchError::Other("asset-registry: AssetId is required")), @@ -42,7 +47,7 @@ impl AssetProcessor> for Custom fn post_register( _id: XcmAsset, - _asset_metadata: AssetMetadata, + _asset_metadata: AssetMetadata, ) -> Result<(), DispatchError> { Ok(()) } diff --git a/runtime/battery-station/src/xcm_config/config.rs b/runtime/battery-station/src/xcm_config/config.rs index c68d81f3d..fc97e70e2 100644 --- a/runtime/battery-station/src/xcm_config/config.rs +++ b/runtime/battery-station/src/xcm_config/config.rs @@ -34,8 +34,8 @@ use orml_xcm_support::{ DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset, }; use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; -use sp_runtime::traits::Convert; +use polkadot_parachain_primitives::primitives::Sibling; +use sp_runtime::traits::{ConstU32, Convert, MaybeEquivalence}; use xcm::{ latest::{ prelude::{AccountId32, AssetId, Concrete, GeneralKey, MultiAsset, XcmContext, X1, X2}, @@ -48,9 +48,9 @@ use xcm_builder::{ AllowTopLevelPaidExecutionFrom, FixedRateOfFungible, FixedWeightBounds, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeRevenue, - TakeWeightCredit, + TakeWeightCredit, WithComputedOrigin, }; -use xcm_executor::{traits::TransactAsset, Assets as ExecutorAssets, Config}; +use xcm_executor::{traits::TransactAsset, Assets as ExecutorAssets}; use zeitgeist_primitives::{constants::BalanceFractionalDecimals, types::XcmAsset}; pub mod battery_station { @@ -64,7 +64,10 @@ pub struct XcmConfig; /// The main XCM config /// This is where we configure the core of our XCM integrations: how tokens are transferred, /// how fees are calculated, what barriers we impose on incoming XCM messages, etc. -impl Config for XcmConfig { +impl xcm_executor::Config for XcmConfig { + /// A list of (Origin, Target) pairs allowing a given Origin to be substituted with its + /// corresponding Target pair. + type Aliasers = Nothing; /// Handler for exchanging assets. type AssetExchanger = (); /// The handler for when there is an instruction to claim assets. @@ -122,12 +125,18 @@ impl Config for XcmConfig { pub type Barrier = ( // Execution barrier that just takes max_weight from weight_credit TakeWeightCredit, - // Ensures that execution time is bought with BuyExecution instruction - AllowTopLevelPaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ); /// The means of purchasing weight credit for XCM execution. @@ -151,11 +160,10 @@ pub struct ToTreasury; impl TakeRevenue for ToTreasury { fn take_revenue(revenue: MultiAsset) { use orml_traits::MultiCurrency; - use xcm_executor::traits::Convert; if let MultiAsset { id: Concrete(location), fun: Fungible(_amount) } = revenue { - if let Ok(asset_id) = - >::convert(location) + if let Some(asset_id) = + >::convert(&location) { let adj_am = AlignedFractionalMultiAssetTransactor::adjust_fractional_places(&revenue).fun; @@ -346,88 +354,96 @@ pub struct AssetConvert; /// handle it on their side. impl Convert> for AssetConvert { fn convert(id: Assets) -> Option { - match id { - Assets::Ztg => Some(MultiLocation::new( - 1, - X2( - Junction::Parachain(ParachainInfo::parachain_id().into()), - general_key(battery_station::KEY), - ), - )), - Assets::ForeignAsset(_) => { - let asset = XcmAsset::try_from(id).ok()?; - AssetRegistry::multilocation(&asset).ok()? - } - _ => None, - } + >::convert_back(&id) + } +} + +impl Convert> for AssetConvert { + fn convert(location: MultiLocation) -> Option { + >::convert(&location) } } impl Convert> for AssetConvert { fn convert(id: XcmAsset) -> Option { - >>::convert(id.into()) + >::convert_back(&id) } } /// Convert an incoming `MultiLocation` into a `Asset` if possible. /// Here we need to know the canonical representation of all the tokens we handle in order to /// correctly convert their `MultiLocation` representation into our internal `Asset` type. -impl xcm_executor::traits::Convert for AssetConvert { - fn convert(location: MultiLocation) -> Result { +impl MaybeEquivalence for AssetConvert { + fn convert(location: &MultiLocation) -> Option { match location { MultiLocation { parents: 0, interior: X1(GeneralKey { data, length }) } => { - let key = &data[..data.len().min(length as usize)]; + let key = &data[..data.len().min(*length as usize)]; if key == battery_station::KEY { - return Ok(Assets::Ztg); + return Some(Assets::Ztg); } - Err(location) + None } MultiLocation { parents: 1, interior: X2(Junction::Parachain(para_id), GeneralKey { data, length }), } => { - let key = &data[..data.len().min(length as usize)]; + let key = &data[..data.len().min(*length as usize)]; - if para_id == u32::from(ParachainInfo::parachain_id()) { + if *para_id == u32::from(ParachainInfo::parachain_id()) { if key == battery_station::KEY { - return Ok(Assets::Ztg); + return Some(Assets::Ztg); } - return Err(location); + return None; } - AssetRegistry::location_to_asset_id(location).ok_or(location).map(|a| a.into()) + AssetRegistry::location_to_asset_id(location).map(|a| a.into()) + } + _ => AssetRegistry::location_to_asset_id(location).map(|a| a.into()), + } + } + + fn convert_back(id: &Assets) -> Option { + match id { + Assets::Ztg => Some(MultiLocation::new( + 1, + X2( + Junction::Parachain(ParachainInfo::parachain_id().into()), + general_key(battery_station::KEY), + ), + )), + Assets::ForeignAsset(_) => { + let asset = XcmAsset::try_from(*id).ok()?; + AssetRegistry::multilocation(&asset).ok()? } - _ => AssetRegistry::location_to_asset_id(location).ok_or(location).map(|a| a.into()), + _ => None, } } } -impl xcm_executor::traits::Convert for AssetConvert { - fn convert(location: MultiLocation) -> Result { - >::convert(location) - .and_then(|asset| asset.try_into().map_err(|_| location)) +impl MaybeEquivalence for AssetConvert { + fn convert(location: &MultiLocation) -> Option { + >::convert(&location) + .and_then(|asset| asset.try_into().ok()) + } + + fn convert_back(id: &XcmAsset) -> Option { + >::convert_back(&Assets::from(*id)) } } impl Convert> for AssetConvert { fn convert(asset: MultiAsset) -> Option { if let MultiAsset { id: Concrete(location), .. } = asset { - >::convert(location).ok() + >::convert(&location) } else { None } } } -impl Convert> for AssetConvert { - fn convert(location: MultiLocation) -> Option { - >::convert(location).ok() - } -} - pub struct AccountIdToMultiLocation; impl Convert for AccountIdToMultiLocation { diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 20422994f..7cc61bdc0 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -80,7 +80,7 @@ std = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "common-runtime" version = "0.5.2" diff --git a/runtime/common/src/fees.rs b/runtime/common/src/fees.rs index ce52cdac5..ffa268f68 100644 --- a/runtime/common/src/fees.rs +++ b/runtime/common/src/fees.rs @@ -40,8 +40,8 @@ macro_rules! impl_fee_types { } pub struct DealWithForeignFees; - impl OnUnbalanced> for DealWithForeignFees { - fn on_unbalanced(fees_and_tips: CreditOf) { + impl OnUnbalanced> for DealWithForeignFees { + fn on_unbalanced(fees_and_tips: Credit) { // We have to manage the mint / burn ratio on the Zeitgeist chain, // but we do not have the responsibility and necessary knowledge to // manage the mint / burn ratio for any other chain. @@ -68,9 +68,10 @@ macro_rules! impl_foreign_fees { use frame_support::{ pallet_prelude::InvalidTransaction, traits::{ - fungibles::{CreditOf, Inspect}, + fungibles::{Credit, Inspect}, tokens::{ - fungibles::Balanced, BalanceConversion, WithdrawConsequence, WithdrawReasons, + fungibles::Balanced, ConversionToAssetBalance, Fortitude, Precision, + Preservation, WithdrawConsequence, WithdrawReasons, }, ExistenceRequirement, }, @@ -202,7 +203,7 @@ macro_rules! impl_foreign_fees { } pub struct TTCBalanceToAssetBalance; - impl BalanceConversion for TTCBalanceToAssetBalance { + impl ConversionToAssetBalance for TTCBalanceToAssetBalance { type Error = TransactionValidityError; fn to_asset_balance( @@ -217,7 +218,7 @@ macro_rules! impl_foreign_fees { pub struct TTCHandleCredit; impl HandleCredit for TTCHandleCredit { - fn handle_credit(final_fee: CreditOf) { + fn handle_credit(final_fee: Credit) { let asset = final_fee.asset(); if CampaignAsset::try_from(asset).is_ok() { @@ -232,7 +233,7 @@ macro_rules! impl_foreign_fees { impl pallet_asset_tx_payment::OnChargeAssetTransaction for TxCharger { type AssetId = Assets; type Balance = Balance; - type LiquidityInfo = CreditOf; + type LiquidityInfo = Credit; fn withdraw_fee( who: &AccountId, @@ -256,8 +257,15 @@ macro_rules! impl_foreign_fees { if can_withdraw != WithdrawConsequence::Success { return Err(InvalidTransaction::Payment.into()); } - >::withdraw(asset_id, who, converted_fee) - .map_err(|_| TransactionValidityError::from(InvalidTransaction::Payment)) + >::withdraw( + asset_id, + who, + converted_fee, + Precision::Exact, + Preservation::Expendable, + Fortitude::Force, + ) + .map_err(|_| TransactionValidityError::from(InvalidTransaction::Payment)) } fn correct_and_deposit_fee( @@ -265,9 +273,9 @@ macro_rules! impl_foreign_fees { _dispatch_info: &DispatchInfoOf, _post_info: &PostDispatchInfoOf, corrected_native_fee: Self::Balance, - _tip: Self::Balance, + tip: Self::Balance, paid: Self::LiquidityInfo, - ) -> Result<(), TransactionValidityError> { + ) -> Result<(Self::Balance, Self::Balance), TransactionValidityError> { let min_converted_fee = if corrected_native_fee.is_zero() { Zero::zero() } else { One::one() }; @@ -281,8 +289,9 @@ macro_rules! impl_foreign_fees { // below the existential balance. In that case we don't refund anything. let (final_fee, refund) = paid.split(converted_fee); let _ = AssetRouter::resolve(who, refund); + let final_fee_raw = final_fee.peek(); TTCHandleCredit::handle_credit(final_fee); - Ok(()) + Ok((final_fee_raw, tip)) } } }; @@ -357,7 +366,7 @@ macro_rules! fee_tests { use orml_traits::MultiCurrency; use pallet_asset_tx_payment::OnChargeAssetTransaction; use sp_core::H256; - use sp_runtime::traits::Convert; + use sp_runtime::{traits::Convert, BuildStorage}; use zeitgeist_primitives::constants::BASE; fn run_with_system_weight(w: Weight, mut assertions: F) @@ -365,7 +374,7 @@ macro_rules! fee_tests { F: FnMut(), { let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { System::set_block_consumed_resources(w, 0); assertions() @@ -375,7 +384,7 @@ macro_rules! fee_tests { #[test] fn treasury_receives_correct_amount_of_native_fees_and_tips() { let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { let fee_balance = 3 * ExistentialDeposit::get(); let fee_imbalance = Balances::issue(fee_balance); @@ -393,7 +402,7 @@ macro_rules! fee_tests { #[test] fn treasury_receives_correct_amount_of_foreign_fees_and_tips() { let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { let fee_and_tip_balance = 10 * ExistentialDeposit::get(); let fees_and_tips = AssetRouter::issue(Asset::ForeignAsset(0), fee_and_tip_balance); @@ -412,7 +421,7 @@ macro_rules! fee_tests { #[test] fn fee_payment_campaign_assets_withdraws_correct_amount() { let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { let asset = Asset::CampaignAsset(0); let alice = AccountId::from([0u8; 32]); @@ -450,7 +459,7 @@ macro_rules! fee_tests { }); } - fn campaign_asset_throttled_fee_common() -> CreditOf { + fn campaign_asset_throttled_fee_common() -> Credit { let asset = Asset::CampaignAsset(0); let alice = AccountId::from([0u8; 32]); let initial_balance: Balance = 1_000_000_000_000; @@ -482,7 +491,7 @@ macro_rules! fee_tests { #[test] fn fee_payment_campaign_assets_withdraws_correct_amount_throttled() { let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { let _ = campaign_asset_throttled_fee_common(); }); @@ -491,7 +500,7 @@ macro_rules! fee_tests { #[test] fn fee_payment_campaign_assets_corrects_reimburses_and_burns_fees_properly() { let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { let asset = Asset::CampaignAsset(0); let withdrawn = campaign_asset_throttled_fee_common(); @@ -536,10 +545,11 @@ macro_rules! fee_tests { #[test] fn correct_and_deposit_fee_dot_foreign_asset() { - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() - .unwrap() - .into(); + let mut t: sp_io::TestExternalities = + frame_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into(); t.execute_with(|| { let alice = AccountId::from([0u8; 32]); let fee_factor = 143_120_520; @@ -547,16 +557,17 @@ macro_rules! fee_tests { xcm: XcmMetadata { fee_factor: Some(fee_factor) }, ..Default::default() }; - let meta: AssetMetadata = AssetMetadata { - decimals: 10, - name: "Polkadot".into(), - symbol: "DOT".into(), - existential_deposit: ExistentialDeposit::get(), - location: Some(xcm::VersionedMultiLocation::V3( - xcm::latest::MultiLocation::parent(), - )), - additional: custom_metadata, - }; + let meta: AssetMetadata = + AssetMetadata { + decimals: 10, + name: "Polkadot".as_bytes().to_vec().try_into().unwrap(), + symbol: "DOT".as_bytes().to_vec().try_into().unwrap(), + existential_deposit: ExistentialDeposit::get(), + location: Some(xcm::VersionedMultiLocation::V3( + xcm::latest::MultiLocation::parent(), + )), + additional: custom_metadata, + }; let dot = Asset::ForeignAsset(0); assert_ok!(AssetRegistry::register_asset( @@ -599,25 +610,27 @@ macro_rules! fee_tests { #[test] fn get_fee_factor_works() { - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() - .unwrap() - .into(); + let mut t: sp_io::TestExternalities = + frame_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into(); t.execute_with(|| { let custom_metadata = CustomMetadata { xcm: XcmMetadata { fee_factor: Some(143_120_520u128) }, ..Default::default() }; - let meta: AssetMetadata = AssetMetadata { - decimals: 10, - name: "Polkadot".into(), - symbol: "DOT".into(), - existential_deposit: ExistentialDeposit::get(), - location: Some(xcm::VersionedMultiLocation::V3( - xcm::latest::MultiLocation::parent(), - )), - additional: custom_metadata, - }; + let meta: AssetMetadata = + AssetMetadata { + decimals: 10, + name: "Polkadot".as_bytes().to_vec().try_into().unwrap(), + symbol: "DOT".as_bytes().to_vec().try_into().unwrap(), + existential_deposit: ExistentialDeposit::get(), + location: Some(xcm::VersionedMultiLocation::V3( + xcm::latest::MultiLocation::parent(), + )), + additional: custom_metadata, + }; let dot_asset_id = 0u32; let dot = XcmAsset::ForeignAsset(dot_asset_id); @@ -633,10 +646,11 @@ macro_rules! fee_tests { #[test] fn get_fee_factor_metadata_not_found() { - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() - .unwrap() - .into(); + let mut t: sp_io::TestExternalities = + frame_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into(); t.execute_with(|| { { // no registering of dot @@ -650,25 +664,27 @@ macro_rules! fee_tests { #[test] fn get_fee_factor_fee_factor_not_found() { - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() - .unwrap() - .into(); + let mut t: sp_io::TestExternalities = + frame_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into(); t.execute_with(|| { let custom_metadata = CustomMetadata { xcm: XcmMetadata { fee_factor: None }, ..Default::default() }; - let meta: AssetMetadata = AssetMetadata { - decimals: 10, - name: "Polkadot".into(), - symbol: "DOT".into(), - existential_deposit: ExistentialDeposit::get(), - location: Some(xcm::VersionedMultiLocation::V3( - xcm::latest::MultiLocation::parent(), - )), - additional: custom_metadata, - }; + let meta: AssetMetadata = + AssetMetadata { + decimals: 10, + name: "Polkadot".as_bytes().to_vec().try_into().unwrap(), + symbol: "DOT".as_bytes().to_vec().try_into().unwrap(), + existential_deposit: ExistentialDeposit::get(), + location: Some(xcm::VersionedMultiLocation::V3( + xcm::latest::MultiLocation::parent(), + )), + additional: custom_metadata, + }; let dot_asset_id = 0u32; let dot = XcmAsset::ForeignAsset(dot_asset_id); @@ -687,23 +703,25 @@ macro_rules! fee_tests { #[test] fn get_fee_factor_none_location() { - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() - .unwrap() - .into(); + let mut t: sp_io::TestExternalities = + frame_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into(); t.execute_with(|| { let custom_metadata = CustomMetadata { xcm: XcmMetadata { fee_factor: Some(10_393) }, ..Default::default() }; - let meta: AssetMetadata = AssetMetadata { - decimals: 10, - name: "NoneLocationToken".into(), - symbol: "NONE".into(), - existential_deposit: ExistentialDeposit::get(), - location: None, - additional: custom_metadata, - }; + let meta: AssetMetadata = + AssetMetadata { + decimals: 10, + name: "NoneLocationToken".as_bytes().to_vec().try_into().unwrap(), + symbol: "NONE".as_bytes().to_vec().try_into().unwrap(), + existential_deposit: ExistentialDeposit::get(), + location: None, + additional: custom_metadata, + }; let non_location_token = XcmAsset::ForeignAsset(1); assert_ok!(AssetRegistry::register_asset( @@ -718,26 +736,28 @@ macro_rules! fee_tests { #[test] fn withdraws_correct_dot_foreign_asset_fee() { - let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() - .build_storage::() - .unwrap() - .into(); + let mut t: sp_io::TestExternalities = + frame_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into(); t.execute_with(|| { let fee_factor = 143_120_520; let custom_metadata = CustomMetadata { xcm: XcmMetadata { fee_factor: Some(fee_factor) }, ..Default::default() }; - let meta: AssetMetadata = AssetMetadata { - decimals: 10, - name: "Polkadot".into(), - symbol: "DOT".into(), - existential_deposit: ExistentialDeposit::get(), - location: Some(xcm::VersionedMultiLocation::V3( - xcm::latest::MultiLocation::parent(), - )), - additional: custom_metadata, - }; + let meta: AssetMetadata = + AssetMetadata { + decimals: 10, + name: "Polkadot".as_bytes().to_vec().try_into().unwrap(), + symbol: "DOT".as_bytes().to_vec().try_into().unwrap(), + existential_deposit: ExistentialDeposit::get(), + location: Some(xcm::VersionedMultiLocation::V3( + xcm::latest::MultiLocation::parent(), + )), + additional: custom_metadata, + }; let dot_asset_id = 0u32; let dot = Asset::ForeignAsset(dot_asset_id); diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index eff5c92c0..4e6bb2477 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -90,6 +90,10 @@ macro_rules! decl_common_types { // https://docs.rs/pallet-asset-tx-payment/latest/src/pallet_asset_tx_payment/lib.rs.html#32-34 pallet_asset_tx_payment::ChargeAssetTxPayment, ); + pub type EventRecord = frame_system::EventRecord< + ::RuntimeEvent, + ::Hash, + >; pub type SignedPayload = generic::SignedPayload; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -265,22 +269,18 @@ macro_rules! create_runtime { // `PredictionMarkets` depends on `SimpleDisputes`. construct_runtime!( - pub enum Runtime where - Block = crate::Block, - NodeBlock = crate::NodeBlock, - UncheckedExtrinsic = crate::UncheckedExtrinsic, - { + pub enum Runtime { // System - System: frame_system::{Call, Config, Event, Pallet, Storage} = 0, + System: frame_system::{Call, Config, Event, Pallet, Storage} = 0, Timestamp: pallet_timestamp::{Call, Pallet, Storage, Inherent} = 1, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 2, + RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip::{Pallet, Storage} = 2, Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 3, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 4, // Money Balances: pallet_balances::{Call, Config, Event, Pallet, Storage} = 10, - TransactionPayment: pallet_transaction_payment::{Config, Event, Pallet, Storage} = 11, - Treasury: pallet_treasury::{Call, Config, Event, Pallet, Storage} = 12, + TransactionPayment: pallet_transaction_payment::{Config, Event, Pallet, Storage} = 11, + Treasury: pallet_treasury::{Call, Config, Event, Pallet, Storage} = 12, Vesting: pallet_vesting::{Call, Config, Event, Pallet, Storage} = 13, Multisig: pallet_multisig::{Call, Event, Pallet, Storage} = 14, Bounties: pallet_bounties::{Call, Event, Pallet, Storage} = 15, @@ -337,19 +337,19 @@ macro_rules! create_runtime_with_additional_pallets { #[cfg(feature = "parachain")] create_runtime!( // System - ParachainSystem: cumulus_pallet_parachain_system::{Call, Config, Event, Inherent, Pallet, Storage, ValidateUnsigned} = 100, - ParachainInfo: parachain_info::{Config, Pallet, Storage} = 101, + ParachainSystem: cumulus_pallet_parachain_system::{Call, Config, Event, Inherent, Pallet, Storage, ValidateUnsigned} = 100, + ParachainInfo: parachain_info::{Config, Pallet, Storage} = 101, // Consensus ParachainStaking: pallet_parachain_staking::{Call, Config, Event, Pallet, Storage} = 110, AuthorInherent: pallet_author_inherent::{Call, Inherent, Pallet, Storage} = 111, - AuthorFilter: pallet_author_slot_filter::{Call, Config, Event, Pallet, Storage} = 112, + AuthorFilter: pallet_author_slot_filter::{Call, Config, Event, Pallet, Storage} = 112, AuthorMapping: pallet_author_mapping::{Call, Config, Event, Pallet, Storage} = 113, // XCM CumulusXcm: cumulus_pallet_xcm::{Event, Origin, Pallet} = 120, DmpQueue: cumulus_pallet_dmp_queue::{Call, Event, Pallet, Storage} = 121, - PolkadotXcm: pallet_xcm::{Call, Config, Event, Origin, Pallet, Storage} = 122, + PolkadotXcm: pallet_xcm::{Call, Config, Event, Origin, Pallet, Storage} = 122, XcmpQueue: cumulus_pallet_xcmp_queue::{Call, Event, Pallet, Storage} = 123, AssetRegistry: orml_asset_registry::{Call, Config, Event, Pallet, Storage} = 124, UnknownTokens: orml_unknown_tokens::{Pallet, Storage, Event} = 125, @@ -363,7 +363,7 @@ macro_rules! create_runtime_with_additional_pallets { create_runtime!( // Consensus Aura: pallet_aura::{Config, Pallet, Storage} = 100, - Grandpa: pallet_grandpa::{Call, Config, Event, Pallet, Storage} = 101, + Grandpa: pallet_grandpa::{Call, Config, Event, Pallet, Storage} = 101, // Others $($additional_pallets)* @@ -423,18 +423,17 @@ macro_rules! impl_config_traits { type AccountData = pallet_balances::AccountData; type AccountId = AccountId; type BaseCallFilter = IsCallable; + type Block = Block; type BlockHashCount = BlockHashCount; type BlockLength = RuntimeBlockLength; - type BlockNumber = BlockNumber; type BlockWeights = RuntimeBlockWeights; type RuntimeCall = RuntimeCall; type DbWeight = RocksDbWeight; type RuntimeEvent = RuntimeEvent; type Hash = Hash; type Hashing = BlakeTwo256; - type Header = generic::Header; - type Index = Index; type Lookup = AccountIdLookup; + type Nonce = Nonce; type MaxConsumers = ConstU32<16>; type OnKilledAccount = (); type OnNewAccount = (); @@ -451,6 +450,7 @@ macro_rules! impl_config_traits { #[cfg(not(feature = "parachain"))] impl pallet_aura::Config for Runtime { + type AllowMultipleBlocksPerSlot = AllowMultipleBlocksPerSlot; type AuthorityId = sp_consensus_aura::sr25519::AuthorityId; type DisabledValidators = (); type MaxAuthorities = MaxAuthorities; @@ -459,8 +459,9 @@ macro_rules! impl_config_traits { #[cfg(feature = "parachain")] impl pallet_author_inherent::Config for Runtime { type AccountLookup = AuthorMapping; + type AuthorId = AccountId; type CanAuthor = AuthorFilter; - type SlotBeacon = cumulus_pallet_parachain_system::RelaychainBlockNumberProvider; + type SlotBeacon = cumulus_pallet_parachain_system::RelaychainDataProvider; type WeightInfo = weights::pallet_author_inherent::WeightInfo; } @@ -487,21 +488,12 @@ macro_rules! impl_config_traits { #[cfg(not(feature = "parachain"))] impl pallet_grandpa::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type KeyOwnerProofSystem = (); - type KeyOwnerProof = - >::Proof; - type KeyOwnerIdentification = - >::IdentificationTuple; - type HandleEquivocation = (); + type EquivocationReportSystem = (); + type KeyOwnerProof = sp_core::Void; type MaxAuthorities = MaxAuthorities; + type MaxNominators = MaxNominators; type MaxSetIdSessionEntries = MaxSetIdSessionEntries; + type RuntimeEvent = RuntimeEvent; // Currently the benchmark does yield an invalid weight implementation // type WeightInfo = weights::pallet_grandpa::WeightInfo; type WeightInfo = (); @@ -509,6 +501,7 @@ macro_rules! impl_config_traits { #[cfg(feature = "parachain")] impl pallet_xcm::Config for Runtime { + type AdminOrigin = EnsureRoot; type ExecuteXcmOrigin = EnsureXcmOrigin; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; @@ -528,16 +521,43 @@ macro_rules! impl_config_traits { type CurrencyMatcher = (); type TrustedLockers = (); type SovereignAccountOf = LocationToAccountId; - type MaxLockers = ConstU32<8>; + type MaxLockers = MaxLockers; + type MaxRemoteLockConsumers = MaxRemoteLockConsumers; type WeightInfo = pallet_xcm::TestWeightInfo; #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; + type RemoteLockConsumerIdentifier = (); const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; } + #[cfg(feature = "parachain")] + pub struct OnInactiveCollator; + #[cfg(feature = "parachain")] + impl pallet_parachain_staking::OnInactiveCollator for OnInactiveCollator { + fn on_inactive_collator( + collator_id: AccountId, + round: pallet_parachain_staking::RoundIndex, + ) -> Result< + Weight, + sp_runtime::DispatchErrorWithPostInfo, + > { + use pallet_parachain_staking::WeightInfo; + + ParachainStaking::go_offline_inner(collator_id)?; + let extra_weight = + ::WeightInfo::go_offline( + pallet_parachain_staking::MAX_CANDIDATES, + ); + + Ok(::DbWeight::get() + .reads(1) + .saturating_add(extra_weight)) + } + } + #[cfg(feature = "parachain")] impl pallet_parachain_staking::Config for Runtime { type BlockAuthor = AuthorInherent; @@ -548,16 +568,17 @@ macro_rules! impl_config_traits { type LeaveCandidatesDelay = LeaveCandidatesDelay; type LeaveDelegatorsDelay = LeaveDelegatorsDelay; type MaxBottomDelegationsPerCandidate = MaxBottomDelegationsPerCandidate; - type MaxTopDelegationsPerCandidate = MaxTopDelegationsPerCandidate; + type MaxCandidates = MaxCandidates; type MaxDelegationsPerDelegator = MaxDelegationsPerDelegator; + type MaxTopDelegationsPerCandidate = MaxTopDelegationsPerCandidate; + type MaxOfflineRounds = MaxOfflineRounds; type MinBlocksPerRound = MinBlocksPerRound; - type MinCandidateStk = MinCollatorStk; - type MinCollatorStk = MinCollatorStk; - type MinDelegation = MinDelegatorStk; - type MinDelegatorStk = MinDelegatorStk; + type MinCandidateStk = MinCandidateStk; + type MinDelegation = MinDelegation; type MinSelectedCandidates = MinSelectedCandidates; type MonetaryGovernanceOrigin = EnsureRoot; type OnCollatorPayout = (); + type OnInactiveCollator = OnInactiveCollator; type PayoutCollatorReward = (); type OnNewRound = (); type RevokeDelegationDelay = RevokeDelegationDelay; @@ -573,6 +594,7 @@ macro_rules! impl_config_traits { type Balance = Balance; type CustomMetadata = CustomMetadata; type RuntimeEvent = RuntimeEvent; + type StringLimit = AssetRegistryStringLimit; type WeightInfo = (); } @@ -738,15 +760,30 @@ macro_rules! impl_config_traits { type WeightInfo = weights::pallet_assets::WeightInfo; } + pub struct DustIntoTreasury; + type CreditOfBalances = pallet_balances::CreditOf; + impl OnUnbalanced for DustIntoTreasury { + fn on_nonzero_unbalanced(mut dust: CreditOfBalances) { + let imbalance = NegativeImbalance::new(dust.peek()); + Treasury::on_nonzero_unbalanced(imbalance); + // Ensure issuance is not reduced via OnDrop + core::mem::forget(dust); + } + } + impl pallet_balances::Config for Runtime { type AccountStore = System; type Balance = Balance; - type DustRemoval = Treasury; - type RuntimeEvent = RuntimeEvent; + type DustRemoval = DustIntoTreasury; type ExistentialDeposit = ExistentialDeposit; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<0>; + type MaxHolds = ConstU32<0>; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type RuntimeHoldReason = RuntimeHoldReason; type WeightInfo = weights::pallet_balances::WeightInfo; } @@ -755,8 +792,10 @@ macro_rules! impl_config_traits { type RuntimeEvent = RuntimeEvent; type MaxMembers = AdvisoryCommitteeMaxMembers; type MaxProposals = AdvisoryCommitteeMaxProposals; + type MaxProposalWeight = MaxProposalWeight; type MotionDuration = AdvisoryCommitteeMotionDuration; type RuntimeOrigin = RuntimeOrigin; + type SetMembersOrigin = EnsureRoot; type Proposal = RuntimeCall; type WeightInfo = weights::pallet_collective::WeightInfo; } @@ -766,8 +805,10 @@ macro_rules! impl_config_traits { type RuntimeEvent = RuntimeEvent; type MaxMembers = CouncilMaxMembers; type MaxProposals = CouncilMaxProposals; + type MaxProposalWeight = MaxProposalWeight; type MotionDuration = CouncilMotionDuration; type RuntimeOrigin = RuntimeOrigin; + type SetMembersOrigin = EnsureRoot; type Proposal = RuntimeCall; type WeightInfo = weights::pallet_collective::WeightInfo; } @@ -777,8 +818,10 @@ macro_rules! impl_config_traits { type RuntimeEvent = RuntimeEvent; type MaxMembers = TechnicalCommitteeMaxMembers; type MaxProposals = TechnicalCommitteeMaxProposals; + type MaxProposalWeight = MaxProposalWeight; type MotionDuration = TechnicalCommitteeMotionDuration; type RuntimeOrigin = RuntimeOrigin; + type SetMembersOrigin = EnsureRoot; type Proposal = RuntimeCall; type WeightInfo = weights::pallet_collective::WeightInfo; } @@ -788,17 +831,25 @@ macro_rules! impl_config_traits { type CallFilter = ContractsCallfilter; type CallStack = [pallet_contracts::Frame; 5]; type ChainExtension = (); + type Debug = (); + type DefaultDepositLimit = ContractsDefaultDepositLimit; + type CodeHashLockupDepositPercent = ContractsCodeHashLockupDepositPercent; type Currency = Balances; - type DeletionQueueDepth = ContractsDeletionQueueDepth; - type DeletionWeightLimit = ContractsDeletionWeightLimit; type DepositPerItem = ContractsDepositPerItem; type DepositPerByte = ContractsDepositPerByte; + type Environment = (); type MaxCodeLen = ContractsMaxCodeLen; type MaxDebugBufferLen = ContractsMaxDebugBufferLen; + type MaxDelegateDependencies = ContractsMaxDelegateDependencies; type MaxStorageKeyLen = ContractsMaxStorageKeyLen; + #[cfg(not(feature = "runtime-benchmarks"))] + type Migrations = (); + #[cfg(feature = "runtime-benchmarks")] + type Migrations = pallet_contracts::migration::codegen::BenchMigrations; type Randomness = RandomnessCollectiveFlip; - type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeHoldReason = RuntimeHoldReason; type Schedule = ContractsSchedule; type Time = Timestamp; type UnsafeUnstableInterface = ContractsUnsafeUnstableInterface; @@ -841,6 +892,7 @@ macro_rules! impl_config_traits { type CooloffPeriod = CooloffPeriod; type Slash = Treasury; type Scheduler = Scheduler; + type SubmitOrigin = EnsureSigned; type PalletsOrigin = OriginCaller; type MaxVotes = MaxVotes; type WeightInfo = weights::pallet_democracy::WeightInfo; @@ -1034,7 +1086,7 @@ macro_rules! impl_config_traits { type AnnouncementDepositFactor = AnnouncementDepositFactor; } - impl pallet_randomness_collective_flip::Config for Runtime {} + impl pallet_insecure_randomness_collective_flip::Config for Runtime {} impl pallet_scheduler::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -1043,6 +1095,9 @@ macro_rules! impl_config_traits { type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; + #[cfg(feature = "runtime-benchmarks")] + type MaxScheduledPerBlock = ConstU32<512>; + #[cfg(not(feature = "runtime-benchmarks"))] type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = weights::pallet_scheduler::WeightInfo; type OriginPrivilegeCmp = EqualPrivilegeOnly; @@ -1484,12 +1539,21 @@ macro_rules! create_runtime_api { // return false if author mapping not registered like in can_author impl return false }; + + let candidates = pallet_parachain_staking::Pallet::::compute_top_candidates(); + if candidates.is_empty() { + // If there are zero selected candidates, we use the same eligibility + // as the previous round + return AuthorInherent::can_author(&author, &slot); + } + // predict eligibility post-selection by computing selection results now let (eligible, _) = pallet_author_slot_filter::compute_pseudo_random_subset::( - pallet_parachain_staking::Pallet::::compute_top_candidates(), + candidates, &slot ); + eligible.contains(&author_account_id) } else { AuthorInherent::can_author(&author, &slot) @@ -1503,6 +1567,7 @@ macro_rules! create_runtime_api { Vec, Vec, ) { + use alloc::vec::Vec; use frame_benchmarking::{list_benchmark, baseline::Pallet as BaselineBench, Benchmarking, BenchmarkList}; use frame_support::traits::StorageInfoTrait; use frame_system_benchmarking::Pallet as SystemBench; @@ -1563,39 +1628,24 @@ macro_rules! create_runtime_api { config: frame_benchmarking::BenchmarkConfig, ) -> Result, sp_runtime::RuntimeString> { use frame_benchmarking::{ - add_benchmark, baseline::{Pallet as BaselineBench, Config as BaselineConfig}, vec, BenchmarkBatch, Benchmarking, TrackedStorageKey, Vec + add_benchmark, + baseline::{ + Pallet as BaselineBench, Config as BaselineConfig + }, + BenchmarkBatch, Benchmarking }; + use alloc::{vec, vec::Vec}; + use frame_support::traits::{TrackedStorageKey, WhitelistedStorageKeys}; use frame_system_benchmarking::Pallet as SystemBench; use orml_benchmarking::{add_benchmark as orml_add_benchmark}; + #[allow(non_local_definitions)] impl frame_system_benchmarking::Config for Runtime {} + #[allow(non_local_definitions)] impl BaselineConfig for Runtime {} - let whitelist: Vec = vec![ - // Block Number - hex_literal::hex!( "26aa394eea5630e07c48ae0c9558cef7" - "02a5c1b19ab7a04f536c519aca4983ac") - .to_vec().into(), - // Total Issuance - hex_literal::hex!( "c2261276cc9d1f8598ea4b6a74b15c2f" - "57c875e4cff74148e4628f264b974c80") - .to_vec().into(), - // Execution Phase - hex_literal::hex!( "26aa394eea5630e07c48ae0c9558cef7" - "ff553b5a9862a516939d82b3d3d8661a") - .to_vec().into(), - // Event Count - hex_literal::hex!( "26aa394eea5630e07c48ae0c9558cef7" - "0a98fdbe9ce6c55837576c60c7af3850") - .to_vec().into(), - // System Events - hex_literal::hex!( "26aa394eea5630e07c48ae0c9558cef7" - "80d41e5e16056765bc8461851072c9d7") - .to_vec().into(), - // System BlockWeight - hex_literal::hex!( "26aa394eea5630e07c48ae0c9558cef7" - "34abf5cb34d6244378cddbf18e849d96") - .to_vec().into(), + let mut whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); + let additional_whitelist: Vec = vec![ // ParachainStaking Round hex_literal::hex!( "a686a3043d0adcf2fa655e57bc595a78" "13792e785168f725b60e2969c7fc2552") @@ -1612,6 +1662,7 @@ macro_rules! create_runtime_api { "04a74d81251e398fd8a0a4d55023bb3f") .to_vec().into(), ]; + whitelist.extend(additional_whitelist.into_iter()); let mut batches = Vec::::new(); let params = (&config, &whitelist); @@ -1665,21 +1716,26 @@ macro_rules! create_runtime_api { } if batches.is_empty() { - return Err("Benchmark not found for this pallet.".into()); + return Err("Benchmark not found for this module.".into()); } Ok(batches) } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } - impl pallet_contracts::ContractsApi - for Runtime - { + impl pallet_contracts::ContractsApi< + Block, + AccountId, + Balance, + BlockNumber, + Hash, + EventRecord + > for Runtime { fn call( origin: AccountId, dest: AccountId, @@ -1687,7 +1743,7 @@ macro_rules! create_runtime_api { gas_limit: Option, storage_deposit_limit: Option, input_data: Vec, - ) -> pallet_contracts_primitives::ContractExecResult { + ) -> pallet_contracts_primitives::ContractExecResult { let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block); Contracts::bare_call( origin, @@ -1696,8 +1752,9 @@ macro_rules! create_runtime_api { gas_limit, storage_deposit_limit, input_data, - CONTRACTS_DEBUG_OUTPUT, - pallet_contracts::Determinism::Deterministic, + pallet_contracts::DebugInfo::UnsafeDebug, + pallet_contracts::CollectEvents::UnsafeCollect, + pallet_contracts::Determinism::Enforced, ) } @@ -1709,8 +1766,7 @@ macro_rules! create_runtime_api { code: pallet_contracts_primitives::Code, data: Vec, salt: Vec, - ) -> pallet_contracts_primitives::ContractInstantiateResult - { + ) -> pallet_contracts_primitives::ContractInstantiateResult { let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block); Contracts::bare_instantiate( origin, @@ -1720,7 +1776,8 @@ macro_rules! create_runtime_api { code, data, salt, - CONTRACTS_DEBUG_OUTPUT, + pallet_contracts::DebugInfo::UnsafeDebug, + pallet_contracts::CollectEvents::UnsafeCollect, ) } @@ -1731,12 +1788,7 @@ macro_rules! create_runtime_api { determinism: pallet_contracts::Determinism, ) -> pallet_contracts_primitives::CodeUploadResult { - Contracts::bare_upload_code( - origin, - code, - storage_deposit_limit, - determinism, - ) + Contracts::bare_upload_code(origin, code, storage_deposit_limit, determinism) } fn get_storage( @@ -1828,6 +1880,14 @@ macro_rules! create_runtime_api { fn metadata() -> OpaqueMetadata { OpaqueMetadata::new(Runtime::metadata().into()) } + + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } + + fn metadata_versions() -> Vec { + Runtime::metadata_versions() + } } impl sp_block_builder::BlockBuilder for Runtime { @@ -1863,31 +1923,34 @@ macro_rules! create_runtime_api { } #[cfg(not(feature = "parachain"))] - impl sp_finality_grandpa::GrandpaApi for Runtime { - fn current_set_id() -> pallet_grandpa::fg_primitives::SetId { - Grandpa::current_set_id() - } - - fn generate_key_ownership_proof( - _set_id: pallet_grandpa::fg_primitives::SetId, - _authority_id: pallet_grandpa::AuthorityId, - ) -> Option { - None + impl sp_consensus_grandpa::GrandpaApi for Runtime { + fn grandpa_authorities() -> sp_consensus_grandpa::AuthorityList { + Grandpa::grandpa_authorities() } - fn grandpa_authorities() -> pallet_grandpa::AuthorityList { - Grandpa::grandpa_authorities() + fn current_set_id() -> sp_consensus_grandpa::SetId { + Grandpa::current_set_id() } fn submit_report_equivocation_unsigned_extrinsic( - _equivocation_proof: pallet_grandpa::fg_primitives::EquivocationProof< + _equivocation_proof: sp_consensus_grandpa::EquivocationProof< ::Hash, - sp_runtime::traits::NumberFor, + sp_api::NumberFor, >, - _key_owner_proof: pallet_grandpa::fg_primitives::OpaqueKeyOwnershipProof, + _key_owner_proof: sp_consensus_grandpa::OpaqueKeyOwnershipProof, ) -> Option<()> { None } + + fn generate_key_ownership_proof( + _set_id: sp_consensus_grandpa::SetId, + _authority_id: sp_consensus_grandpa::AuthorityId, + ) -> Option { + // NOTE: this is the only implementation possible since we've + // defined our key owner proof type as a bottom type (i.e. a type + // with no values). + None + } } impl sp_offchain::OffchainWorkerApi for Runtime { @@ -2012,7 +2075,8 @@ macro_rules! create_common_benchmark_logic { AccountId, Amount, AssetManager, Balance, Assets, ExistentialDeposit, GetNativeCurrencyId, Runtime }; - use frame_benchmarking::{account, vec, whitelisted_caller}; + use alloc::vec; + use frame_benchmarking::{account, whitelisted_caller}; use frame_system::RawOrigin; use sp_runtime::traits::UniqueSaturatedInto; use orml_benchmarking::runtime_benchmarks; @@ -2125,7 +2189,8 @@ macro_rules! create_common_benchmark_logic { pub(crate) mod tokens { use super::utils::{lookup_of_account, set_balance as update_balance}; use crate::{AccountId, Balance, Tokens, Runtime}; - use frame_benchmarking::{account, vec, whitelisted_caller}; + use alloc::vec; + use frame_benchmarking::{account, whitelisted_caller}; use frame_system::RawOrigin; use orml_benchmarking::runtime_benchmarks; use orml_traits::MultiCurrency; @@ -2229,8 +2294,11 @@ macro_rules! create_common_benchmark_logic { #[cfg(test)] pub mod tests { + use crate::Runtime; + use sp_runtime::BuildStorage; + pub fn new_test_ext() -> sp_io::TestExternalities { - frame_system::GenesisConfig::default().build_storage::().unwrap().into() + frame_system::GenesisConfig::::default().build_storage().unwrap().into() } } } @@ -2249,6 +2317,7 @@ macro_rules! create_common_tests { use crate::*; use frame_support::PalletId; use test_case::test_case; + use sp_runtime::BuildStorage; #[test_case(AuthorizedPalletId::get(); "authorized")] #[test_case(CourtPalletId::get(); "court")] @@ -2259,7 +2328,7 @@ macro_rules! create_common_tests { #[test_case(TreasuryPalletId::get(); "treasury")] fn whitelisted_pallet_accounts_dont_get_reaped(pallet_id: PalletId) { let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { let pallet_main_account: AccountId = pallet_id.into_account_truncating(); let pallet_sub_account: AccountId = pallet_id.into_sub_account_truncating(42); @@ -2271,7 +2340,7 @@ macro_rules! create_common_tests { #[test] fn non_whitelisted_accounts_get_reaped() { let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { let not_whitelisted = AccountId::from([0u8; 32]); assert!(!DustRemovalWhitelist::contains(¬_whitelisted)) diff --git a/runtime/common/src/weights/frame_system.rs b/runtime/common/src/weights/frame_system.rs index 02094be2c..743242b1f 100644 --- a/runtime/common/src/weights/frame_system.rs +++ b/runtime/common/src/weights/frame_system.rs @@ -85,6 +85,19 @@ impl frame_system::weights::WeightInfo for WeightInfo Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1485` + // Minimum execution time: 84_000_503_000 picoseconds. + Weight::from_parts(87_586_619_000, 1485) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } /// Storage: Skipped Metadata (r:0 w:0) /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) /// The range of component `i` is `[0, 1000]`. diff --git a/runtime/common/src/weights/pallet_assets.rs b/runtime/common/src/weights/pallet_assets.rs index 421d14405..0dafad365 100644 --- a/runtime/common/src/weights/pallet_assets.rs +++ b/runtime/common/src/weights/pallet_assets.rs @@ -52,370 +52,440 @@ use frame_support::{ /// Weight functions for pallet_assets (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_assets::weights::WeightInfo for WeightInfo { - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn create() -> Weight { // Proof Size summary in bytes: - // Measured: `285` - // Estimated: `5304` - // Minimum execution time: 45_580 nanoseconds. - Weight::from_parts(46_600_000, 5304) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `293` + // Estimated: `3675` + // Minimum execution time: 31_340_000 picoseconds. + Weight::from_parts(31_977_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn force_create() -> Weight { // Proof Size summary in bytes: - // Measured: `109` - // Estimated: `2697` - // Minimum execution time: 24_880 nanoseconds. - Weight::from_parts(25_780_000, 2697) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: AssetRouter DestroyAssets (r:1 w:1) - /// Proof: AssetRouter DestroyAssets (max_values: Some(1), max_size: Some(40962), added: 41457, mode: MaxEncodedLen) - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: AssetRouter IndestructibleAssets (r:1 w:0) - /// Proof: AssetRouter IndestructibleAssets (max_values: Some(1), max_size: Some(38914), added: 39409, mode: MaxEncodedLen) + // Measured: `153` + // Estimated: `3675` + // Minimum execution time: 13_342_000 picoseconds. + Weight::from_parts(13_782_000, 3675) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn start_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `452` - // Estimated: `83563` - // Minimum execution time: 37_170 nanoseconds. - Weight::from_parts(38_891_000, 83563) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:51 w:50) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) - /// Storage: System Account (r:50 w:50) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - /// The range of component `c` is `[0, 50]`. + // Measured: `385` + // Estimated: `3675` + // Minimum execution time: 14_437_000 picoseconds. + Weight::from_parts(14_833_000, 3675) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1001 w:1000) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: System Account (r:1000 w:1000) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `413 + c * (241 ±0)` - // Estimated: `5286 + c * (5196 ±0)` - // Minimum execution time: 35_950 nanoseconds. - Weight::from_parts(27_443_769, 5286) - // Standard Error: 187_706 - .saturating_add(Weight::from_parts(27_794_683, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Measured: `0 + c * (208 ±0)` + // Estimated: `3675 + c * (2609 ±0)` + // Minimum execution time: 18_728_000 picoseconds. + Weight::from_parts(18_982_000, 3675) + // Standard Error: 11_708 + .saturating_add(Weight::from_parts(14_363_570, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) - .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 5196).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2609).saturating_mul(c.into())) } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Approvals (r:51 w:50) - /// Proof: CustomAssets Approvals (max_values: None, max_size: Some(160), added: 2635, mode: MaxEncodedLen) - /// The range of component `a` is `[0, 50]`. + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Approvals (r:1001 w:1000) + /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) + /// The range of component `a` is `[0, 1000]`. fn destroy_approvals(a: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `499 + a * (86 ±0)` - // Estimated: `5332 + a * (2635 ±0)` - // Minimum execution time: 29_050 nanoseconds. - Weight::from_parts(47_517_757, 5332) - // Standard Error: 73_418 - .saturating_add(Weight::from_parts(24_955_809, 0).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Measured: `522 + a * (86 ±0)` + // Estimated: `3675 + a * (2623 ±0)` + // Minimum execution time: 18_611_000 picoseconds. + Weight::from_parts(18_970_000, 3675) + // Standard Error: 13_224 + .saturating_add(Weight::from_parts(16_397_299, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) - .saturating_add(Weight::from_parts(0, 2635).saturating_mul(a.into())) + .saturating_add(Weight::from_parts(0, 2623).saturating_mul(a.into())) } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Metadata (r:1 w:0) - /// Proof: CustomAssets Metadata (max_values: None, max_size: Some(152), added: 2627, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Metadata (r:1 w:0) + /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn finish_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `376` - // Estimated: `5324` - // Minimum execution time: 27_720 nanoseconds. - Weight::from_parts(29_560_000, 5324) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:1 w:1) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 14_504_000 picoseconds. + Weight::from_parts(14_906_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `376` - // Estimated: `5286` - // Minimum execution time: 47_300 nanoseconds. - Weight::from_parts(48_191_000, 5286) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:1 w:1) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 26_653_000 picoseconds. + Weight::from_parts(27_260_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `481` - // Estimated: `5286` - // Minimum execution time: 56_541 nanoseconds. - Weight::from_parts(57_720_000, 5286) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:2 w:2) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 33_625_000 picoseconds. + Weight::from_parts(34_474_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:2 w:2) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `520` - // Estimated: `10482` - // Minimum execution time: 66_921 nanoseconds. - Weight::from_parts(81_670_000, 10482) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:2 w:2) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 47_609_000 picoseconds. + Weight::from_parts(48_476_000, 6208) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:2 w:2) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `520` - // Estimated: `10482` - // Minimum execution time: 70_230 nanoseconds. - Weight::from_parts(71_750_000, 10482) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:2 w:2) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 41_625_000 picoseconds. + Weight::from_parts(43_030_000, 6208) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:2 w:2) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `520` - // Estimated: `10482` - // Minimum execution time: 81_470 nanoseconds. - Weight::from_parts(83_780_000, 10482) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: CustomAssets Asset (r:1 w:0) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:1 w:1) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 47_661_000 picoseconds. + Weight::from_parts(48_469_000, 6208) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn freeze() -> Weight { // Proof Size summary in bytes: - // Measured: `481` - // Estimated: `5286` - // Minimum execution time: 31_790 nanoseconds. - Weight::from_parts(32_470_000, 5286) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: CustomAssets Asset (r:1 w:0) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:1 w:1) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_727_000 picoseconds. + Weight::from_parts(18_384_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn thaw() -> Weight { // Proof Size summary in bytes: - // Measured: `481` - // Estimated: `5286` - // Minimum execution time: 31_250 nanoseconds. - Weight::from_parts(32_661_000, 5286) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_657_000 picoseconds. + Weight::from_parts(18_282_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn freeze_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `410` - // Estimated: `2697` - // Minimum execution time: 24_740 nanoseconds. - Weight::from_parts(25_781_000, 2697) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `385` + // Estimated: `3675` + // Minimum execution time: 13_743_000 picoseconds. + Weight::from_parts(14_193_000, 3675) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn thaw_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `410` - // Estimated: `2697` - // Minimum execution time: 23_900 nanoseconds. - Weight::from_parts(25_160_000, 2697) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Metadata (r:1 w:0) - /// Proof: CustomAssets Metadata (max_values: None, max_size: Some(152), added: 2627, mode: MaxEncodedLen) + // Measured: `385` + // Estimated: `3675` + // Minimum execution time: 13_653_000 picoseconds. + Weight::from_parts(14_263_000, 3675) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Metadata (r:1 w:0) + /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn transfer_ownership() -> Weight { // Proof Size summary in bytes: - // Measured: `376` - // Estimated: `5324` - // Minimum execution time: 29_690 nanoseconds. - Weight::from_parts(30_700_000, 5324) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 15_328_000 picoseconds. + Weight::from_parts(16_042_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn set_team() -> Weight { // Proof Size summary in bytes: - // Measured: `376` - // Estimated: `2697` - // Minimum execution time: 26_960 nanoseconds. - Weight::from_parts(28_210_000, 2697) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: CustomAssets Asset (r:1 w:0) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Metadata (r:1 w:1) - /// Proof: CustomAssets Metadata (max_values: None, max_size: Some(152), added: 2627, mode: MaxEncodedLen) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 14_097_000 picoseconds. + Weight::from_parts(14_641_000, 3675) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Metadata (r:1 w:1) + /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(n: u32, s: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `376` - // Estimated: `5324` - // Minimum execution time: 35_650 nanoseconds. - Weight::from_parts(44_501_301, 5324) - // Standard Error: 2_153 - .saturating_add(Weight::from_parts(14_080, 0).saturating_mul(n.into())) - // Standard Error: 2_153 - .saturating_add(Weight::from_parts(8_285, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: CustomAssets Asset (r:1 w:0) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Metadata (r:1 w:1) - /// Proof: CustomAssets Metadata (max_values: None, max_size: Some(152), added: 2627, mode: MaxEncodedLen) + fn set_metadata(_n: u32, _s: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 29_535_000 picoseconds. + Weight::from_parts(31_456_892, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Metadata (r:1 w:1) + /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `569` - // Estimated: `5324` - // Minimum execution time: 45_190 nanoseconds. - Weight::from_parts(45_860_000, 5324) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: CustomAssets Asset (r:1 w:0) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Metadata (r:1 w:1) - /// Proof: CustomAssets Metadata (max_values: None, max_size: Some(152), added: 2627, mode: MaxEncodedLen) + // Measured: `515` + // Estimated: `3675` + // Minimum execution time: 30_680_000 picoseconds. + Weight::from_parts(31_930_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Metadata (r:1 w:1) + /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(n: u32, s: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `183` - // Estimated: `5324` - // Minimum execution time: 23_380 nanoseconds. - Weight::from_parts(29_007_377, 5324) - // Standard Error: 1_825 - .saturating_add(Weight::from_parts(5_450, 0).saturating_mul(n.into())) - // Standard Error: 1_825 - .saturating_add(Weight::from_parts(9_969, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: CustomAssets Asset (r:1 w:0) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Metadata (r:1 w:1) - /// Proof: CustomAssets Metadata (max_values: None, max_size: Some(152), added: 2627, mode: MaxEncodedLen) + fn force_set_metadata(_n: u32, s: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `190` + // Estimated: `3675` + // Minimum execution time: 14_660_000 picoseconds. + Weight::from_parts(15_718_387, 3675) + // Standard Error: 622 + .saturating_add(Weight::from_parts(2_640, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Metadata (r:1 w:1) + /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `569` - // Estimated: `5324` - // Minimum execution time: 36_830 nanoseconds. - Weight::from_parts(44_640_000, 5324) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `515` + // Estimated: `3675` + // Minimum execution time: 30_853_000 picoseconds. + Weight::from_parts(31_483_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn force_asset_status() -> Weight { // Proof Size summary in bytes: - // Measured: `376` - // Estimated: `2697` - // Minimum execution time: 22_220 nanoseconds. - Weight::from_parts(26_050_000, 2697) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Approvals (r:1 w:1) - /// Proof: CustomAssets Approvals (max_values: None, max_size: Some(160), added: 2635, mode: MaxEncodedLen) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 13_632_000 picoseconds. + Weight::from_parts(14_077_000, 3675) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Approvals (r:1 w:1) + /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn approve_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `410` - // Estimated: `5332` - // Minimum execution time: 40_120 nanoseconds. - Weight::from_parts(49_370_000, 5332) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Approvals (r:1 w:1) - /// Proof: CustomAssets Approvals (max_values: None, max_size: Some(160), added: 2635, mode: MaxEncodedLen) - /// Storage: CustomAssets Account (r:2 w:2) - /// Proof: CustomAssets Account (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + // Measured: `385` + // Estimated: `3675` + // Minimum execution time: 33_780_000 picoseconds. + Weight::from_parts(34_533_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Approvals (r:1 w:1) + /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) + /// Storage: Assets Account (r:2 w:2) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `687` - // Estimated: `13117` - // Minimum execution time: 95_171 nanoseconds. - Weight::from_parts(106_670_000, 13117) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Approvals (r:1 w:1) - /// Proof: CustomAssets Approvals (max_values: None, max_size: Some(160), added: 2635, mode: MaxEncodedLen) + // Measured: `668` + // Estimated: `6208` + // Minimum execution time: 67_712_000 picoseconds. + Weight::from_parts(69_946_000, 6208) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Approvals (r:1 w:1) + /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `577` - // Estimated: `5332` - // Minimum execution time: 52_550 nanoseconds. - Weight::from_parts(54_550_000, 5332) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: CustomAssets Asset (r:1 w:1) - /// Proof: CustomAssets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen) - /// Storage: CustomAssets Approvals (r:1 w:1) - /// Proof: CustomAssets Approvals (max_values: None, max_size: Some(160), added: 2635, mode: MaxEncodedLen) + // Measured: `555` + // Estimated: `3675` + // Minimum execution time: 36_668_000 picoseconds. + Weight::from_parts(37_637_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Approvals (r:1 w:1) + /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `577` - // Estimated: `5332` - // Minimum execution time: 53_511 nanoseconds. - Weight::from_parts(55_160_000, 5332) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `555` + // Estimated: `3675` + // Minimum execution time: 36_685_000 picoseconds. + Weight::from_parts(37_950_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn set_min_balance() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 14_466_000 picoseconds. + Weight::from_parts(14_924_000, 3675) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 34_874_000 picoseconds. + Weight::from_parts(36_330_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 33_278_000 picoseconds. + Weight::from_parts(34_104_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 32_898_000 picoseconds. + Weight::from_parts(33_489_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 31_243_000 picoseconds. + Weight::from_parts(31_909_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_692_000 picoseconds. + Weight::from_parts(18_253_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/pallet_balances.rs b/runtime/common/src/weights/pallet_balances.rs index 5e2f6c805..012c55b91 100644 --- a/runtime/common/src/weights/pallet_balances.rs +++ b/runtime/common/src/weights/pallet_balances.rs @@ -52,81 +52,96 @@ use frame_support::{ /// Weight functions for pallet_balances (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_balances::weights::WeightInfo for WeightInfo { - /// Storage: System Account (r:2 w:2) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn transfer() -> Weight { + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn transfer_allow_death() -> Weight { // Proof Size summary in bytes: - // Measured: `1585` - // Estimated: `5214` - // Minimum execution time: 109_871 nanoseconds. - Weight::from_parts(111_051_000, 5214) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `0` + // Estimated: `3593` + // Minimum execution time: 58_474_000 picoseconds. + Weight::from_parts(59_117_000, 3593) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `1409` - // Estimated: `2607` - // Minimum execution time: 60_490 nanoseconds. - Weight::from_parts(73_760_000, 2607) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `0` + // Estimated: `3593` + // Minimum execution time: 44_629_000 picoseconds. + Weight::from_parts(45_798_000, 3593) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn set_balance_creating() -> Weight { + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn force_set_balance_creating() -> Weight { // Proof Size summary in bytes: - // Measured: `1559` - // Estimated: `2607` - // Minimum execution time: 46_650 nanoseconds. - Weight::from_parts(57_640_000, 2607) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `174` + // Estimated: `3593` + // Minimum execution time: 16_483_000 picoseconds. + Weight::from_parts(16_939_000, 3593) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - fn set_balance_killing() -> Weight { + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn force_set_balance_killing() -> Weight { // Proof Size summary in bytes: - // Measured: `1559` - // Estimated: `2607` - // Minimum execution time: 63_361 nanoseconds. - Weight::from_parts(64_691_000, 2607) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `174` + // Estimated: `3593` + // Minimum execution time: 24_638_000 picoseconds. + Weight::from_parts(25_487_000, 3593) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: System Account (r:3 w:3) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `1581` - // Estimated: `7821` - // Minimum execution time: 108_390 nanoseconds. - Weight::from_parts(109_831_000, 7821) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `103` + // Estimated: `6196` + // Minimum execution time: 60_041_000 picoseconds. + Weight::from_parts(63_365_000, 6196) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `1409` - // Estimated: `2607` - // Minimum execution time: 69_251 nanoseconds. - Weight::from_parts(85_261_000, 2607) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `0` + // Estimated: `3593` + // Minimum execution time: 54_445_000 picoseconds. + Weight::from_parts(55_623_000, 3593) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn force_unreserve() -> Weight { // Proof Size summary in bytes: - // Measured: `1443` - // Estimated: `2607` - // Minimum execution time: 49_440 nanoseconds. - Weight::from_parts(50_850_000, 2607) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `174` + // Estimated: `3593` + // Minimum execution time: 19_309_000 picoseconds. + Weight::from_parts(19_953_000, 3593) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `System::Account` (r:999 w:999) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `u` is `[1, 1000]`. + fn upgrade_accounts(u: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (135 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 19_362_000 picoseconds. + Weight::from_parts(19_612_000, 990) + // Standard Error: 13_108 + .saturating_add(Weight::from_parts(16_444_591, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) } } diff --git a/runtime/common/src/weights/pallet_contracts.rs b/runtime/common/src/weights/pallet_contracts.rs index e8bb96b42..2671199f1 100644 --- a/runtime/common/src/weights/pallet_contracts.rs +++ b/runtime/common/src/weights/pallet_contracts.rs @@ -52,1902 +52,1891 @@ use frame_support::{ /// Weight functions for pallet_contracts (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_contracts::weights::WeightInfo for WeightInfo { - /// Storage: Contracts DeletionQueue (r:1 w:0) - /// Proof: Contracts DeletionQueue (max_values: Some(1), max_size: Some(16642), added: 17137, mode: Ignored) + /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:0) + /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) fn on_process_deletion_queue_batch() -> Weight { // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `0` - // Minimum execution time: 7_430 nanoseconds. - Weight::from_parts(7_771_000, 0).saturating_add(T::DbWeight::get().reads(1)) + // Measured: `142` + // Estimated: `1627` + // Minimum execution time: 2_548_000 picoseconds. + Weight::from_parts(2_670_000, 1627).saturating_add(T::DbWeight::get().reads(1_u64)) } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `k` is `[0, 1024]`. fn on_initialize_per_trie_key(k: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `414 + k * (69 ±0)` - // Estimated: `0` - // Minimum execution time: 19_010 nanoseconds. - Weight::from_parts(231_178, 0) - // Standard Error: 7_979 - .saturating_add(Weight::from_parts(2_022_917, 0).saturating_mul(k.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `451 + k * (69 ±0)` + // Estimated: `441 + k * (70 ±0)` + // Minimum execution time: 13_526_000 picoseconds. + Weight::from_parts(13_902_000, 441) + // Standard Error: 1_058 + .saturating_add(Weight::from_parts(1_274_724, 0).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(Weight::from_parts(0, 70).saturating_mul(k.into())) } - /// Storage: Contracts DeletionQueue (r:1 w:1) - /// Proof: Contracts DeletionQueue (max_values: Some(1), max_size: Some(16642), added: 17137, mode: Ignored) - /// The range of component `q` is `[0, 128]`. - fn on_initialize_per_queue_item(q: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `214 + q * (33 ±0)` - // Estimated: `0` - // Minimum execution time: 7_500 nanoseconds. - Weight::from_parts(27_206_849, 0) - // Standard Error: 16_209 - .saturating_add(Weight::from_parts(2_358_921, 0).saturating_mul(q.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: Contracts PristineCode (r:1 w:0) - /// Proof: Contracts PristineCode (max_values: None, max_size: Some(125988), added: 128463, mode: Ignored) - /// Storage: Contracts CodeStorage (r:0 w:1) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// The range of component `c` is `[0, 61717]`. - fn reinstrument(c: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `203 + c * (1 ±0)` - // Estimated: `0` - // Minimum execution time: 60_631 nanoseconds. - Weight::from_parts(96_254_618, 0) - // Standard Error: 269 - .saturating_add(Weight::from_parts(112_614, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553022fca90611ba8b7942f8bdb3b97f6580` (r:2 w:1) + /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553022fca90611ba8b7942f8bdb3b97f6580` (r:2 w:1) + /// The range of component `c` is `[0, 125952]`. + fn v9_migration_step(c: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `211 + c * (1 ±0)` + // Estimated: `6149 + c * (1 ±0)` + // Minimum execution time: 8_426_000 picoseconds. + Weight::from_parts(8_591_621, 6149) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_203, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) + } + /// Storage: `Contracts::ContractInfoOf` (r:2 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + fn v10_migration_step() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `6450` + // Minimum execution time: 17_008_000 picoseconds. + Weight::from_parts(17_742_000, 6450) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Contracts::DeletionQueue` (r:1 w:1025) + /// Proof: `Contracts::DeletionQueue` (`max_values`: None, `max_size`: Some(142), added: 2617, mode: `Measured`) + /// Storage: `Contracts::DeletionQueueCounter` (r:0 w:1) + /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// The range of component `k` is `[0, 1024]`. + fn v11_migration_step(k: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `171 + k * (1 ±0)` + // Estimated: `3635 + k * (1 ±0)` + // Minimum execution time: 3_949_000 picoseconds. + Weight::from_parts(4_062_000, 3635) + // Standard Error: 1_983 + .saturating_add(Weight::from_parts(1_173_197, 0).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(k.into())) + } + /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553053f13fd319a03c211337c76e0fe776df` (r:2 w:0) + /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553053f13fd319a03c211337c76e0fe776df` (r:2 w:0) + /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553022fca90611ba8b7942f8bdb3b97f6580` (r:1 w:1) + /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc553022fca90611ba8b7942f8bdb3b97f6580` (r:1 w:1) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:0 w:1) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// The range of component `c` is `[0, 125952]`. + fn v12_migration_step(c: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `325 + c * (1 ±0)` + // Estimated: `6263 + c * (1 ±0)` + // Minimum execution time: 17_094_000 picoseconds. + Weight::from_parts(17_338_591, 6263) + // Standard Error: 1 + .saturating_add(Weight::from_parts(436, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) + } + /// Storage: `Contracts::ContractInfoOf` (r:2 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + fn v13_migration_step() -> Weight { + // Proof Size summary in bytes: + // Measured: `440` + // Estimated: `6380` + // Minimum execution time: 12_704_000 picoseconds. + Weight::from_parts(13_147_000, 6380) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Contracts::CodeInfoOf` (r:2 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) + fn v14_migration_step() -> Weight { + // Proof Size summary in bytes: + // Measured: `360` + // Estimated: `6300` + // Minimum execution time: 48_387_000 picoseconds. + Weight::from_parts(50_024_000, 6300) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Contracts::ContractInfoOf` (r:2 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + fn v15_migration_step() -> Weight { + // Proof Size summary in bytes: + // Measured: `594` + // Estimated: `6534` + // Minimum execution time: 59_300_000 picoseconds. + Weight::from_parts(61_805_000, 6534) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:1) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + fn migration_noop() -> Weight { + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `1627` + // Minimum execution time: 3_327_000 picoseconds. + Weight::from_parts(3_502_000, 1627) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:1) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:1) + /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:1) + fn migrate() -> Weight { + // Proof Size summary in bytes: + // Measured: `166` + // Estimated: `3631` + // Minimum execution time: 12_759_000 picoseconds. + Weight::from_parts(13_134_000, 3631) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) + fn on_runtime_upgrade_noop() -> Weight { + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `3607` + // Minimum execution time: 4_775_000 picoseconds. + Weight::from_parts(5_084_000, 3607).saturating_add(T::DbWeight::get().reads(1_u64)) + } + /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + fn on_runtime_upgrade_in_progress() -> Weight { + // Proof Size summary in bytes: + // Measured: `167` + // Estimated: `3632` + // Minimum execution time: 6_663_000 picoseconds. + Weight::from_parts(6_855_000, 3632).saturating_add(T::DbWeight::get().reads(2_u64)) + } + /// Storage: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x4342193e496fab7ec59d615ed0dc55304e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0) + /// Storage: `Contracts::MigrationInProgress` (r:1 w:1) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + fn on_runtime_upgrade() -> Weight { + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `3607` + // Minimum execution time: 7_212_000 picoseconds. + Weight::from_parts(7_426_000, 3607) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `c` is `[0, 125952]`. fn call_with_code_per_byte(c: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `675` - // Estimated: `0` - // Minimum execution time: 489_121 nanoseconds. - Weight::from_parts(665_502_356, 0) - // Standard Error: 129 - .saturating_add(Weight::from_parts(64_354, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: Contracts CodeStorage (r:1 w:1) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Contracts Nonce (r:1 w:1) - /// Proof: Contracts Nonce (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: System EventTopics (r:3 w:3) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// Storage: Contracts PristineCode (r:0 w:1) - /// Proof: Contracts PristineCode (max_values: None, max_size: Some(125988), added: 128463, mode: Ignored) - /// Storage: Contracts OwnerInfoOf (r:0 w:1) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// The range of component `c` is `[0, 61717]`. + // Measured: `792` + // Estimated: `6743 + c * (1 ±0)` + // Minimum execution time: 289_557_000 picoseconds. + Weight::from_parts(272_895_652, 6743) + // Standard Error: 80 + .saturating_add(Weight::from_parts(39_917, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Balances::Holds` (r:2 w:2) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) + /// Storage: `System::EventTopics` (r:3 w:3) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Contracts::Nonce` (r:1 w:1) + /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:0 w:1) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// The range of component `c` is `[0, 125952]`. /// The range of component `i` is `[0, 1048576]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code(c: u32, i: u32, s: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `157` - // Estimated: `0` - // Minimum execution time: 7_344_163 nanoseconds. - Weight::from_parts(1_338_150_199, 0) - // Standard Error: 519 - .saturating_add(Weight::from_parts(203_646, 0).saturating_mul(c.into())) - // Standard Error: 30 - .saturating_add(Weight::from_parts(2_832, 0).saturating_mul(i.into())) - // Standard Error: 30 - .saturating_add(Weight::from_parts(3_129, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(9)) - } - /// Storage: Contracts CodeStorage (r:1 w:1) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Contracts Nonce (r:1 w:1) - /// Proof: Contracts Nonce (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts OwnerInfoOf (r:1 w:1) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + // Measured: `323` + // Estimated: `8747` + // Minimum execution time: 4_671_359_000 picoseconds. + Weight::from_parts(586_523_882, 8747) + // Standard Error: 206 + .saturating_add(Weight::from_parts(115_402, 0).saturating_mul(c.into())) + // Standard Error: 24 + .saturating_add(Weight::from_parts(1_797, 0).saturating_mul(i.into())) + // Standard Error: 24 + .saturating_add(Weight::from_parts(2_046, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Contracts::Nonce` (r:1 w:1) + /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) /// The range of component `i` is `[0, 1048576]`. /// The range of component `s` is `[0, 1048576]`. fn instantiate(i: u32, s: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `433` - // Estimated: `0` - // Minimum execution time: 2_937_909 nanoseconds. - Weight::from_parts(891_169_449, 0) - // Standard Error: 44 - .saturating_add(Weight::from_parts(2_010, 0).saturating_mul(i.into())) - // Standard Error: 44 - .saturating_add(Weight::from_parts(3_159, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(7)) - } - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + // Measured: `560` + // Estimated: `6504` + // Minimum execution time: 2_170_657_000 picoseconds. + Weight::from_parts(369_331_405, 6504) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_940, 0).saturating_mul(i.into())) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_858, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(10_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) fn call() -> Weight { // Proof Size summary in bytes: - // Measured: `727` - // Estimated: `0` - // Minimum execution time: 227_451 nanoseconds. - Weight::from_parts(280_790_000, 0) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: Contracts CodeStorage (r:1 w:1) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: System EventTopics (r:1 w:1) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// Storage: Contracts PristineCode (r:0 w:1) - /// Proof: Contracts PristineCode (max_values: None, max_size: Some(125988), added: 128463, mode: Ignored) - /// Storage: Contracts OwnerInfoOf (r:0 w:1) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// The range of component `c` is `[0, 61717]`. + // Measured: `826` + // Estimated: `6766` + // Minimum execution time: 204_287_000 picoseconds. + Weight::from_parts(213_239_000, 6766) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) + /// Storage: `System::EventTopics` (r:1 w:1) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:0 w:1) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// The range of component `c` is `[0, 125952]`. fn upload_code(c: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `42` - // Estimated: `0` - // Minimum execution time: 471_521 nanoseconds. - Weight::from_parts(687_711_884, 0) - // Standard Error: 394 - .saturating_add(Weight::from_parts(200_341, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: Contracts OwnerInfoOf (r:1 w:1) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// Storage: System EventTopics (r:1 w:1) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// Storage: Contracts CodeStorage (r:0 w:1) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Contracts PristineCode (r:0 w:1) - /// Proof: Contracts PristineCode (max_values: None, max_size: Some(125988), added: 128463, mode: Ignored) + // Measured: `142` + // Estimated: `3607` + // Minimum execution time: 285_434_000 picoseconds. + Weight::from_parts(242_697_648, 3607) + // Standard Error: 128 + .saturating_add(Weight::from_parts(76_087, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:1) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) + /// Storage: `System::EventTopics` (r:1 w:1) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:0 w:1) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) fn remove_code() -> Weight { // Proof Size summary in bytes: - // Measured: `218` - // Estimated: `0` - // Minimum execution time: 36_600 nanoseconds. - Weight::from_parts(44_600_000, 0) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts OwnerInfoOf (r:2 w:2) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// Storage: System EventTopics (r:3 w:3) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + // Measured: `315` + // Estimated: `3780` + // Minimum execution time: 46_486_000 picoseconds. + Weight::from_parts(48_422_000, 3780) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:2 w:2) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `System::EventTopics` (r:3 w:3) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `567` - // Estimated: `0` - // Minimum execution time: 48_240 nanoseconds. - Weight::from_parts(58_330_000, 0) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(6)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `552` + // Estimated: `8967` + // Minimum execution time: 37_568_000 picoseconds. + Weight::from_parts(38_589_000, 8967) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_caller(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `697 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 431_852 nanoseconds. - Weight::from_parts(517_954_911, 0) - // Standard Error: 272_523 - .saturating_add(Weight::from_parts(41_775_023, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1601 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `866 + r * (6 ±0)` + // Estimated: `6806 + r * (6 ±0)` + // Minimum execution time: 274_513_000 picoseconds. + Weight::from_parts(288_793_403, 6806) + // Standard Error: 650 + .saturating_add(Weight::from_parts(339_309, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1601 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_is_contract(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `749 + r * (19218 ±0)` - // Estimated: `0` - // Minimum execution time: 370_081 nanoseconds. - Weight::from_parts(208_937_394, 0) - // Standard Error: 1_926_054 - .saturating_add(Weight::from_parts(539_165_423, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1601 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `922 + r * (209 ±0)` + // Estimated: `6826 + r * (2684 ±0)` + // Minimum execution time: 260_096_000 picoseconds. + Weight::from_parts(149_954_322, 6826) + // Standard Error: 5_713 + .saturating_add(Weight::from_parts(3_788_924, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 2684).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1601 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_code_hash(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `741 + r * (19539 ±0)` - // Estimated: `0` - // Minimum execution time: 373_452 nanoseconds. - Weight::from_parts(227_921_076, 0) - // Standard Error: 1_913_473 - .saturating_add(Weight::from_parts(631_118_111, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `921 + r * (213 ±0)` + // Estimated: `6830 + r * (2688 ±0)` + // Minimum execution time: 277_496_000 picoseconds. + Weight::from_parts(285_839_000, 6830) + // Standard Error: 10_076 + .saturating_add(Weight::from_parts(4_720_110, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 2688).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_own_code_hash(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `704 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 379_931 nanoseconds. - Weight::from_parts(528_666_677, 0) - // Standard Error: 374_987 - .saturating_add(Weight::from_parts(50_992_877, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `873 + r * (6 ±0)` + // Estimated: `6815 + r * (6 ±0)` + // Minimum execution time: 275_655_000 picoseconds. + Weight::from_parts(291_386_528, 6815) + // Standard Error: 898 + .saturating_add(Weight::from_parts(428_765, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_caller_is_origin(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `694 + r * (240 ±0)` - // Estimated: `0` - // Minimum execution time: 373_091 nanoseconds. - Weight::from_parts(502_021_184, 0) - // Standard Error: 406_594 - .saturating_add(Weight::from_parts(27_810_692, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `863 + r * (3 ±0)` + // Estimated: `6804 + r * (3 ±0)` + // Minimum execution time: 260_323_000 picoseconds. + Weight::from_parts(286_371_403, 6804) + // Standard Error: 451 + .saturating_add(Weight::from_parts(183_053, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. + fn seal_caller_is_root(r: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `753 + r * (3 ±0)` + // Estimated: `6693 + r * (3 ±0)` + // Minimum execution time: 262_974_000 picoseconds. + Weight::from_parts(276_571_502, 6693) + // Standard Error: 527 + .saturating_add(Weight::from_parts(165_364, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_address(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `698 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 383_501 nanoseconds. - Weight::from_parts(541_475_815, 0) - // Standard Error: 379_203 - .saturating_add(Weight::from_parts(39_598_712, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `867 + r * (6 ±0)` + // Estimated: `6807 + r * (6 ±0)` + // Minimum execution time: 272_826_000 picoseconds. + Weight::from_parts(290_963_001, 6807) + // Standard Error: 810 + .saturating_add(Weight::from_parts(343_762, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_gas_left(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `699 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 387_450 nanoseconds. - Weight::from_parts(529_951_635, 0) - // Standard Error: 392_749 - .saturating_add(Weight::from_parts(40_284_485, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:2 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `863 + r * (6 ±0)` + // Estimated: `6806 + r * (6 ±0)` + // Minimum execution time: 277_324_000 picoseconds. + Weight::from_parts(290_872_814, 6806) + // Standard Error: 766 + .saturating_add(Weight::from_parts(371_542, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:2 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_balance(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `873 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 412_591 nanoseconds. - Weight::from_parts(571_653_506, 0) - // Standard Error: 470_423 - .saturating_add(Weight::from_parts(179_738_554, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `1007 + r * (6 ±0)` + // Estimated: `6931 + r * (6 ±0)` + // Minimum execution time: 274_460_000 picoseconds. + Weight::from_parts(285_748_025, 6931) + // Standard Error: 1_570 + .saturating_add(Weight::from_parts(1_656_237, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_value_transferred(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `708 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 395_131 nanoseconds. - Weight::from_parts(527_037_547, 0) - // Standard Error: 354_055 - .saturating_add(Weight::from_parts(40_615_465, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `877 + r * (6 ±0)` + // Estimated: `6823 + r * (6 ±0)` + // Minimum execution time: 278_254_000 picoseconds. + Weight::from_parts(283_893_525, 6823) + // Standard Error: 726 + .saturating_add(Weight::from_parts(347_368, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_minimum_balance(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `706 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 380_230 nanoseconds. - Weight::from_parts(531_816_816, 0) - // Standard Error: 333_964 - .saturating_add(Weight::from_parts(37_754_742, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `875 + r * (6 ±0)` + // Estimated: `6816 + r * (6 ±0)` + // Minimum execution time: 279_646_000 picoseconds. + Weight::from_parts(292_505_446, 6816) + // Standard Error: 867 + .saturating_add(Weight::from_parts(337_202, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_block_number(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `703 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 390_151 nanoseconds. - Weight::from_parts(577_277_614, 0) - // Standard Error: 503_035 - .saturating_add(Weight::from_parts(36_413_279, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `872 + r * (6 ±0)` + // Estimated: `6819 + r * (6 ±0)` + // Minimum execution time: 274_522_000 picoseconds. + Weight::from_parts(295_135_659, 6819) + // Standard Error: 1_052 + .saturating_add(Weight::from_parts(330_788, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_now(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `694 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 376_551 nanoseconds. - Weight::from_parts(535_008_554, 0) - // Standard Error: 353_325 - .saturating_add(Weight::from_parts(38_594_722, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) - /// Proof: TransactionPayment NextFeeMultiplier (max_values: Some(1), max_size: Some(16), added: 511, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `863 + r * (6 ±0)` + // Estimated: `6804 + r * (6 ±0)` + // Minimum execution time: 274_228_000 picoseconds. + Weight::from_parts(289_201_593, 6804) + // Standard Error: 752 + .saturating_add(Weight::from_parts(337_860, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) + /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_weight_to_fee(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `809 + r * (800 ±0)` - // Estimated: `0` - // Minimum execution time: 397_911 nanoseconds. - Weight::from_parts(528_491_853, 0) - // Standard Error: 429_636 - .saturating_add(Weight::from_parts(134_755_404, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. - fn seal_gas(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `661 + r * (320 ±0)` - // Estimated: `0` - // Minimum execution time: 214_380 nanoseconds. - Weight::from_parts(260_658_643, 0) - // Standard Error: 160_864 - .saturating_add(Weight::from_parts(18_814_649, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `937 + r * (14 ±0)` + // Estimated: `6872 + r * (14 ±0)` + // Minimum execution time: 277_142_000 picoseconds. + Weight::from_parts(296_736_114, 6872) + // Standard Error: 1_502 + .saturating_add(Weight::from_parts(1_446_663, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 14).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_input(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `696 + r * (480 ±0)` - // Estimated: `0` - // Minimum execution time: 403_660 nanoseconds. - Weight::from_parts(545_823_848, 0) - // Standard Error: 357_639 - .saturating_add(Weight::from_parts(32_529_346, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 1024]`. - fn seal_input_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `1176` - // Estimated: `0` - // Minimum execution time: 486_961 nanoseconds. - Weight::from_parts(420_704_430, 0) - // Standard Error: 126_136 - .saturating_add(Weight::from_parts(18_130_065, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + // Measured: `865 + r * (6 ±0)` + // Estimated: `6807 + r * (6 ±0)` + // Minimum execution time: 276_087_000 picoseconds. + Weight::from_parts(287_863_377, 6807) + // Standard Error: 495 + .saturating_add(Weight::from_parts(282_718, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 6).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 1048576]`. + fn seal_input_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `869` + // Estimated: `6809` + // Minimum execution time: 277_128_000 picoseconds. + Weight::from_parts(234_478_674, 6809) + // Standard Error: 23 + .saturating_add(Weight::from_parts(1_052, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `r` is `[0, 1]`. fn seal_return(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `684 + r * (8 ±0)` - // Estimated: `0` - // Minimum execution time: 367_101 nanoseconds. - Weight::from_parts(508_054_206, 0) - // Standard Error: 9_076_081 - .saturating_add(Weight::from_parts(100_993, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 1024]`. - fn seal_return_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `694` - // Estimated: `0` - // Minimum execution time: 417_570 nanoseconds. - Weight::from_parts(486_804_833, 0) - // Standard Error: 8_373 - .saturating_add(Weight::from_parts(411_815, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:3 w:3) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts DeletionQueue (r:1 w:1) - /// Proof: Contracts DeletionQueue (max_values: Some(1), max_size: Some(16642), added: 17137, mode: Ignored) - /// Storage: Contracts OwnerInfoOf (r:1 w:1) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// Storage: System EventTopics (r:3 w:3) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + // Measured: `853 + r * (45 ±0)` + // Estimated: `6793 + r * (45 ±0)` + // Minimum execution time: 251_983_000 picoseconds. + Weight::from_parts(277_986_885, 6793) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 45).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 1048576]`. + fn seal_return_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `863` + // Estimated: `6810` + // Minimum execution time: 275_108_000 picoseconds. + Weight::from_parts(284_552_708, 6810) + // Standard Error: 0 + .saturating_add(Weight::from_parts(391, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:2 w:2) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `Contracts::DeletionQueueCounter` (r:1 w:1) + /// Proof: `Contracts::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:4 w:4) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) + /// Storage: `Contracts::DeletionQueue` (r:0 w:1) + /// Proof: `Contracts::DeletionQueue` (`max_values`: None, `max_size`: Some(142), added: 2617, mode: `Measured`) /// The range of component `r` is `[0, 1]`. fn seal_terminate(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `726 + r * (285 ±0)` - // Estimated: `0` - // Minimum execution time: 370_770 nanoseconds. - Weight::from_parts(515_893_028, 0) - // Standard Error: 9_505_249 - .saturating_add(Weight::from_parts(191_277_471, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((6_u64).saturating_mul(r.into()))) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) - /// Proof: RandomnessCollectiveFlip RandomMaterial (max_values: Some(1), max_size: Some(2594), added: 3089, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `2972 + r * (316 ±0)` + // Estimated: `8912 + r * (5266 ±0)` + // Minimum execution time: 281_278_000 picoseconds. + Weight::from_parts(306_800_667, 8912) + // Standard Error: 855_257 + .saturating_add(Weight::from_parts(126_508_132, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((10_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 5266).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `RandomnessCollectiveFlip::RandomMaterial` (r:1 w:0) + /// Proof: `RandomnessCollectiveFlip::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_random(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `775 + r * (800 ±0)` - // Estimated: `0` - // Minimum execution time: 389_531 nanoseconds. - Weight::from_parts(506_659_987, 0) - // Standard Error: 438_015 - .saturating_add(Weight::from_parts(222_549_692, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `944 + r * (10 ±0)` + // Estimated: `6885 + r * (10 ±0)` + // Minimum execution time: 260_609_000 picoseconds. + Weight::from_parts(287_385_076, 6885) + // Standard Error: 2_754 + .saturating_add(Weight::from_parts(2_057_388, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 10).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_deposit_event(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `694 + r * (800 ±0)` - // Estimated: `0` - // Minimum execution time: 419_771 nanoseconds. - Weight::from_parts(556_814_111, 0) - // Standard Error: 666_560 - .saturating_add(Weight::from_parts(423_936_920, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:322 w:322) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + // Measured: `863 + r * (10 ±0)` + // Estimated: `6805 + r * (10 ±0)` + // Minimum execution time: 254_770_000 picoseconds. + Weight::from_parts(255_105_647, 6805) + // Standard Error: 5_707 + .saturating_add(Weight::from_parts(3_808_788, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 10).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:6 w:6) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `t` is `[0, 4]`. - /// The range of component `n` is `[0, 16]`. - fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `1630 + t * (2608 ±0) + n * (8 ±0)` - // Estimated: `0` - // Minimum execution time: 1_916_644 nanoseconds. - Weight::from_parts(876_255_548, 0) - // Standard Error: 2_998_126 - .saturating_add(Weight::from_parts(365_874_853, 0).saturating_mul(t.into())) - // Standard Error: 823_430 - .saturating_add(Weight::from_parts(120_543_255, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(t.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((80_u64).saturating_mul(t.into()))) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + /// The range of component `n` is `[0, 16384]`. + fn seal_deposit_event_per_topic_and_byte(t: u32, n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `880 + t * (32 ±0)` + // Estimated: `6825 + t * (2508 ±0)` + // Minimum execution time: 278_200_000 picoseconds. + Weight::from_parts(288_081_493, 6825) + // Standard Error: 97_535 + .saturating_add(Weight::from_parts(3_683_455, 0).saturating_mul(t.into())) + // Standard Error: 27 + .saturating_add(Weight::from_parts(731, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) + .saturating_add(Weight::from_parts(0, 2508).saturating_mul(t.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_debug_message(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `693 + r * (800 ±0)` - // Estimated: `0` - // Minimum execution time: 211_061 nanoseconds. - Weight::from_parts(291_579_010, 0) - // Standard Error: 162_749 - .saturating_add(Weight::from_parts(27_900_831, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 10]`. + // Measured: `862 + r * (7 ±0)` + // Estimated: `6807 + r * (7 ±0)` + // Minimum execution time: 167_181_000 picoseconds. + Weight::from_parts(178_433_475, 6807) + // Standard Error: 374 + .saturating_add(Weight::from_parts(241_240, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 7).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `MaxEncodedLen`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `MaxEncodedLen`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `i` is `[0, 1048576]`. + fn seal_debug_message_per_byte(i: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `125813` + // Estimated: `131755` + // Minimum execution time: 434_456_000 picoseconds. + Weight::from_parts(400_940_450, 131755) + // Standard Error: 13 + .saturating_add(Weight::from_parts(1_102, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 800]`. fn seal_set_storage(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `720 + r * (23420 ±0)` - // Estimated: `0` - // Minimum execution time: 374_560 nanoseconds. - Weight::from_parts(334_860_847, 0) - // Standard Error: 3_068_197 - .saturating_add(Weight::from_parts(978_042_416, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((80_u64).saturating_mul(r.into()))) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 8]`. - fn seal_set_storage_per_new_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `12402 + n * (12006 ±0)` - // Estimated: `0` - // Minimum execution time: 683_562 nanoseconds. - Weight::from_parts(1_224_575_174, 0) - // Standard Error: 3_929_725 - .saturating_add(Weight::from_parts(196_261_071, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(52)) - .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(50)) - .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(n.into()))) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 8]`. - fn seal_set_storage_per_old_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `14990 + n * (175775 ±0)` - // Estimated: `0` - // Minimum execution time: 597_481 nanoseconds. - Weight::from_parts(1_153_785_439, 0) - // Standard Error: 3_312_108 - .saturating_add(Weight::from_parts(128_606_117, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) - .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(49)) - .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(n.into()))) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 10]`. + // Measured: `924 + r * (292 ±0)` + // Estimated: `925 + r * (293 ±0)` + // Minimum execution time: 277_825_000 picoseconds. + Weight::from_parts(159_688_263, 925) + // Standard Error: 13_610 + .saturating_add(Weight::from_parts(7_145_641, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 293).saturating_mul(r.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 16384]`. + fn seal_set_storage_per_new_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1446` + // Estimated: `1429` + // Minimum execution time: 284_745_000 picoseconds. + Weight::from_parts(345_928_316, 1429) + // Standard Error: 70 + .saturating_add(Weight::from_parts(547, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 16384]`. + fn seal_set_storage_per_old_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1252 + n * (1 ±0)` + // Estimated: `1252 + n * (1 ±0)` + // Minimum execution time: 275_328_000 picoseconds. + Weight::from_parts(300_037_010, 1252) + // Standard Error: 32 + .saturating_add(Weight::from_parts(558, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 800]`. fn seal_clear_storage(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `720 + r * (23100 ±0)` - // Estimated: `0` - // Minimum execution time: 441_841 nanoseconds. - Weight::from_parts(479_192_193, 0) - // Standard Error: 2_871_558 - .saturating_add(Weight::from_parts(916_912_022, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((80_u64).saturating_mul(r.into()))) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 8]`. - fn seal_clear_storage_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `14670 + n * (175775 ±0)` - // Estimated: `0` - // Minimum execution time: 625_381 nanoseconds. - Weight::from_parts(1_137_973_256, 0) - // Standard Error: 3_381_124 - .saturating_add(Weight::from_parts(130_713_708, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) - .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(48)) - .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(n.into()))) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 10]`. + // Measured: `920 + r * (288 ±0)` + // Estimated: `926 + r * (289 ±0)` + // Minimum execution time: 273_742_000 picoseconds. + Weight::from_parts(169_430_806, 926) + // Standard Error: 11_821 + .saturating_add(Weight::from_parts(6_927_074, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 289).saturating_mul(r.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 16384]`. + fn seal_clear_storage_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1248 + n * (1 ±0)` + // Estimated: `1248 + n * (1 ±0)` + // Minimum execution time: 275_167_000 picoseconds. + Weight::from_parts(301_883_655, 1248) + // Standard Error: 35 + .saturating_add(Weight::from_parts(4, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 800]`. fn seal_get_storage(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `730 + r * (23740 ±0)` - // Estimated: `0` - // Minimum execution time: 392_901 nanoseconds. - Weight::from_parts(479_938_978, 0) - // Standard Error: 1_934_626 - .saturating_add(Weight::from_parts(754_683_224, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 8]`. - fn seal_get_storage_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `15321 + n * (175775 ±0)` - // Estimated: `0` - // Minimum execution time: 509_251 nanoseconds. - Weight::from_parts(1_059_139_703, 0) - // Standard Error: 3_539_218 - .saturating_add(Weight::from_parts(303_187_136, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) - .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 10]`. + // Measured: `920 + r * (296 ±0)` + // Estimated: `922 + r * (297 ±0)` + // Minimum execution time: 274_628_000 picoseconds. + Weight::from_parts(195_255_092, 922) + // Standard Error: 9_109 + .saturating_add(Weight::from_parts(5_707_060, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 297).saturating_mul(r.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 16384]`. + fn seal_get_storage_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1264 + n * (1 ±0)` + // Estimated: `1264 + n * (1 ±0)` + // Minimum execution time: 274_202_000 picoseconds. + Weight::from_parts(296_440_752, 1264) + // Standard Error: 38 + .saturating_add(Weight::from_parts(1_010, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 800]`. fn seal_contains_storage(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `723 + r * (23100 ±0)` - // Estimated: `0` - // Minimum execution time: 458_631 nanoseconds. - Weight::from_parts(506_503_466, 0) - // Standard Error: 1_926_675 - .saturating_add(Weight::from_parts(728_611_813, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 8]`. - fn seal_contains_storage_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `14673 + n * (175775 ±0)` - // Estimated: `0` - // Minimum execution time: 525_181 nanoseconds. - Weight::from_parts(1_030_715_942, 0) - // Standard Error: 3_301_932 - .saturating_add(Weight::from_parts(122_011_584, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) - .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 10]`. + // Measured: `931 + r * (288 ±0)` + // Estimated: `928 + r * (289 ±0)` + // Minimum execution time: 274_123_000 picoseconds. + Weight::from_parts(193_280_535, 928) + // Standard Error: 9_264 + .saturating_add(Weight::from_parts(5_548_039, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 289).saturating_mul(r.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 16384]`. + fn seal_contains_storage_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1251 + n * (1 ±0)` + // Estimated: `1251 + n * (1 ±0)` + // Minimum execution time: 276_425_000 picoseconds. + Weight::from_parts(300_521_806, 1251) + // Standard Error: 36 + .saturating_add(Weight::from_parts(83, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 800]`. fn seal_take_storage(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `731 + r * (23740 ±0)` - // Estimated: `0` - // Minimum execution time: 414_821 nanoseconds. - Weight::from_parts(357_950_744, 0) - // Standard Error: 3_475_365 - .saturating_add(Weight::from_parts(981_471_555, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((80_u64).saturating_mul(r.into()))) - } - /// Storage: Skipped Metadata (r:0 w:0) - /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 8]`. - fn seal_take_storage_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `15322 + n * (175775 ±0)` - // Estimated: `0` - // Minimum execution time: 638_781 nanoseconds. - Weight::from_parts(1_188_783_395, 0) - // Standard Error: 3_951_294 - .saturating_add(Weight::from_parts(314_100_376, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) - .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(48)) - .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(n.into()))) - } - /// Storage: System Account (r:1602 w:1601) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `913 + r * (296 ±0)` + // Estimated: `918 + r * (297 ±0)` + // Minimum execution time: 264_860_000 picoseconds. + Weight::from_parts(191_561_777, 918) + // Standard Error: 10_678 + .saturating_add(Weight::from_parts(6_895_457, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 297).saturating_mul(r.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 16384]`. + fn seal_take_storage_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1265 + n * (1 ±0)` + // Estimated: `1265 + n * (1 ±0)` + // Minimum execution time: 282_501_000 picoseconds. + Weight::from_parts(303_351_919, 1265) + // Standard Error: 37 + .saturating_add(Weight::from_parts(643, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1602 w:1601) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_transfer(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `1322 + r * (3601 ±0)` - // Estimated: `0` - // Minimum execution time: 389_761 nanoseconds. - Weight::from_parts(387_985_694, 0) - // Standard Error: 2_529_933 - .saturating_add(Weight::from_parts(2_615_792_463, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().reads((80_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(T::DbWeight::get().writes((80_u64).saturating_mul(r.into()))) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1601 w:1601) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:2 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:1602 w:1602) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `1415 + r * (45 ±0)` + // Estimated: `7307 + r * (2520 ±0)` + // Minimum execution time: 273_198_000 picoseconds. + Weight::from_parts(179_673_238, 7307) + // Standard Error: 34_990 + .saturating_add(Weight::from_parts(38_468_091, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:801 w:801) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:2 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:2 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:803 w:803) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 800]`. fn seal_call(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `948 + r * (20495 ±0)` - // Estimated: `0` - // Minimum execution time: 435_761 nanoseconds. - Weight::from_parts(68_471_501, 0) - // Standard Error: 94_851_428 - .saturating_add(Weight::from_parts(38_479_425_365, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().reads((160_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((160_u64).saturating_mul(r.into()))) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1536 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:1537 w:1537) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `1260 + r * (245 ±0)` + // Estimated: `9440 + r * (2721 ±0)` + // Minimum execution time: 283_869_000 picoseconds. + Weight::from_parts(288_374_000, 9440) + // Standard Error: 137_512 + .saturating_add(Weight::from_parts(248_206_665, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2721).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:736 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:736 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:737 w:737) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 800]`. fn seal_delegate_call(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + r * (71670 ±0)` - // Estimated: `0` - // Minimum execution time: 382_431 nanoseconds. - Weight::from_parts(477_811_000, 0) - // Standard Error: 42_244_071 - .saturating_add(Weight::from_parts(36_082_816_111, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((150_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((75_u64).saturating_mul(r.into()))) - } - /// Storage: System Account (r:82 w:81) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:81 w:81) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:2 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:82 w:82) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + // Measured: `0 + r * (576 ±0)` + // Estimated: `6812 + r * (2637 ±3)` + // Minimum execution time: 257_577_000 picoseconds. + Weight::from_parts(277_310_000, 6812) + // Standard Error: 150_204 + .saturating_add(Weight::from_parts(249_943_483, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2637).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:3 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:2 w:2) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:2 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:2 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:4 w:4) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `t` is `[0, 1]`. - /// The range of component `c` is `[0, 1024]`. - fn seal_call_per_transfer_clone_kb(t: u32, c: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `21128 + t * (15897 ±0)` - // Estimated: `0` - // Minimum execution time: 18_273_642 nanoseconds. - Weight::from_parts(17_523_937_499, 0) - // Standard Error: 89_878_407 - .saturating_add(Weight::from_parts(2_045_724_783, 0).saturating_mul(t.into())) - // Standard Error: 134_767 - .saturating_add(Weight::from_parts(18_073_327, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(167)) - .saturating_add(T::DbWeight::get().reads((81_u64).saturating_mul(t.into()))) - .saturating_add(T::DbWeight::get().writes(163)) - .saturating_add(T::DbWeight::get().writes((81_u64).saturating_mul(t.into()))) - } - /// Storage: System Account (r:1602 w:1602) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1601 w:1601) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1601 w:1600) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts Nonce (r:1 w:1) - /// Proof: Contracts Nonce (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts OwnerInfoOf (r:1600 w:1600) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// Storage: System EventTopics (r:1602 w:1602) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + /// The range of component `c` is `[0, 1048576]`. + fn seal_call_per_transfer_clone_byte(t: u32, c: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1307 + t * (277 ±0)` + // Estimated: `12197 + t * (5227 ±0)` + // Minimum execution time: 471_081_000 picoseconds. + Weight::from_parts(79_081_122, 12197) + // Standard Error: 11_777_790 + .saturating_add(Weight::from_parts(357_425_411, 0).saturating_mul(t.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(1_111, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(t.into()))) + .saturating_add(T::DbWeight::get().writes(6_u64)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(t.into()))) + .saturating_add(Weight::from_parts(0, 5227).saturating_mul(t.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:802 w:802) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:801 w:801) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:801 w:800) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:801 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `Contracts::Nonce` (r:1 w:1) + /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:803 w:803) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Holds` (r:800 w:800) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) + /// The range of component `r` is `[1, 800]`. fn seal_instantiate(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `1512 + r * (25573 ±0)` - // Estimated: `0` - // Minimum execution time: 376_711 nanoseconds. - Weight::from_parts(455_542_000, 0) - // Standard Error: 114_095_743 - .saturating_add(Weight::from_parts(50_953_615_612, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().reads((400_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(5)) - .saturating_add(T::DbWeight::get().writes((400_u64).saturating_mul(r.into()))) - } - /// Storage: System Account (r:82 w:82) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:81 w:81) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:2 w:1) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts Nonce (r:1 w:1) - /// Proof: Contracts Nonce (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts OwnerInfoOf (r:1 w:1) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// Storage: System EventTopics (r:82 w:82) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) + // Measured: `1278 + r * (255 ±0)` + // Estimated: `9620 + r * (2731 ±0)` + // Minimum execution time: 672_742_000 picoseconds. + Weight::from_parts(680_025_000, 9620) + // Standard Error: 313_642 + .saturating_add(Weight::from_parts(388_311_259, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2731).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:2 w:2) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:2 w:1) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:2 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `Contracts::Nonce` (r:1 w:1) + /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:4 w:4) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `Measured`) /// The range of component `t` is `[0, 1]`. - /// The range of component `i` is `[0, 960]`. - /// The range of component `s` is `[0, 960]`. - fn seal_instantiate_per_transfer_input_salt_kb(t: u32, i: u32, s: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `5505 + t * (68 ±0)` - // Estimated: `0` - // Minimum execution time: 210_322_618 nanoseconds. - Weight::from_parts(31_023_451_273, 0) - // Standard Error: 648_986 - .saturating_add(Weight::from_parts(213_692_481, 0).saturating_mul(i.into())) - // Standard Error: 648_986 - .saturating_add(Weight::from_parts(217_643_843, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(249)) + /// The range of component `i` is `[0, 983040]`. + /// The range of component `s` is `[0, 983040]`. + fn seal_instantiate_per_transfer_input_salt_byte(t: u32, i: u32, s: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1303 + t * (104 ±0)` + // Estimated: `12211 + t * (2549 ±1)` + // Minimum execution time: 2_733_870_000 picoseconds. + Weight::from_parts(1_001_793_458, 12211) + // Standard Error: 12 + .saturating_add(Weight::from_parts(1_963, 0).saturating_mul(i.into())) + // Standard Error: 12 + .saturating_add(Weight::from_parts(2_060, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(t.into()))) - .saturating_add(T::DbWeight::get().writes(247)) + .saturating_add(T::DbWeight::get().writes(11_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(t.into()))) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 1]`. + .saturating_add(Weight::from_parts(0, 2549).saturating_mul(t.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_hash_sha2_256(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `691 + r * (642 ±0)` - // Estimated: `0` - // Minimum execution time: 370_871 nanoseconds. - Weight::from_parts(517_046_881, 0) - // Standard Error: 9_392_544 - .saturating_add(Weight::from_parts(1_484_618, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 1024]`. - fn seal_hash_sha2_256_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `1493` - // Estimated: `0` - // Minimum execution time: 435_121 nanoseconds. - Weight::from_parts(502_631_000, 0) - // Standard Error: 81_123 - .saturating_add(Weight::from_parts(94_181_133, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 1]`. + // Measured: `862 + r * (8 ±0)` + // Estimated: `6801 + r * (8 ±0)` + // Minimum execution time: 272_658_000 picoseconds. + Weight::from_parts(282_717_645, 6801) + // Standard Error: 517 + .saturating_add(Weight::from_parts(400_604, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 1048576]`. + fn seal_hash_sha2_256_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `870` + // Estimated: `6808` + // Minimum execution time: 260_969_000 picoseconds. + Weight::from_parts(265_206_847, 6808) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_134, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_hash_keccak_256(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `693 + r * (642 ±0)` - // Estimated: `0` - // Minimum execution time: 372_401 nanoseconds. - Weight::from_parts(558_599_716, 0) - // Standard Error: 10_105_961 - .saturating_add(Weight::from_parts(103_731_083, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 1024]`. - fn seal_hash_keccak_256_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `1495` - // Estimated: `0` - // Minimum execution time: 537_732 nanoseconds. - Weight::from_parts(579_512_000, 0) - // Standard Error: 208_304 - .saturating_add(Weight::from_parts(369_317_236, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 1]`. + // Measured: `864 + r * (8 ±0)` + // Estimated: `6806 + r * (8 ±0)` + // Minimum execution time: 262_351_000 picoseconds. + Weight::from_parts(286_974_296, 6806) + // Standard Error: 514 + .saturating_add(Weight::from_parts(802_363, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 1048576]`. + fn seal_hash_keccak_256_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `872` + // Estimated: `6814` + // Minimum execution time: 276_907_000 picoseconds. + Weight::from_parts(277_928_418, 6814) + // Standard Error: 1 + .saturating_add(Weight::from_parts(3_410, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_hash_blake2_256(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `693 + r * (642 ±0)` - // Estimated: `0` - // Minimum execution time: 368_311 nanoseconds. - Weight::from_parts(507_392_248, 0) - // Standard Error: 8_916_313 - .saturating_add(Weight::from_parts(108_580_551, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 1024]`. - fn seal_hash_blake2_256_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `1495` - // Estimated: `0` - // Minimum execution time: 522_392 nanoseconds. - Weight::from_parts(567_922_000, 0) - // Standard Error: 111_886 - .saturating_add(Weight::from_parts(163_798_185, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 1]`. + // Measured: `864 + r * (8 ±0)` + // Estimated: `6808 + r * (8 ±0)` + // Minimum execution time: 263_660_000 picoseconds. + Weight::from_parts(285_665_916, 6808) + // Standard Error: 527 + .saturating_add(Weight::from_parts(480_457, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 1048576]`. + fn seal_hash_blake2_256_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `872` + // Estimated: `6813` + // Minimum execution time: 262_071_000 picoseconds. + Weight::from_parts(270_115_341, 6813) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_254, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_hash_blake2_128(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `693 + r * (642 ±0)` - // Estimated: `0` - // Minimum execution time: 366_951 nanoseconds. - Weight::from_parts(500_280_304, 0) - // Standard Error: 9_646_663 - .saturating_add(Weight::from_parts(51_759_095, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `n` is `[0, 1024]`. - fn seal_hash_blake2_128_per_kb(n: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `1495` - // Estimated: `0` - // Minimum execution time: 540_452 nanoseconds. - Weight::from_parts(603_082_000, 0) - // Standard Error: 162_534 - .saturating_add(Weight::from_parts(166_126_166, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 1]`. + // Measured: `864 + r * (8 ±0)` + // Estimated: `6805 + r * (8 ±0)` + // Minimum execution time: 265_568_000 picoseconds. + Weight::from_parts(285_791_811, 6805) + // Standard Error: 559 + .saturating_add(Weight::from_parts(505_330, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 8).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 1048576]`. + fn seal_hash_blake2_128_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `872` + // Estimated: `6811` + // Minimum execution time: 271_336_000 picoseconds. + Weight::from_parts(272_829_313, 6811) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 125697]`. + fn seal_sr25519_verify_per_byte(n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `997 + n * (1 ±0)` + // Estimated: `6934 + n * (1 ±0)` + // Minimum execution time: 351_146_000 picoseconds. + Weight::from_parts(355_368_323, 6934) + // Standard Error: 14 + .saturating_add(Weight::from_parts(6_155, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 160]`. + fn seal_sr25519_verify(r: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `807 + r * (112 ±0)` + // Estimated: `6748 + r * (112 ±0)` + // Minimum execution time: 277_250_000 picoseconds. + Weight::from_parts(346_490_114, 6748) + // Standard Error: 14_654 + .saturating_add(Weight::from_parts(56_127_492, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 112).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 160]`. fn seal_ecdsa_recover(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `737 + r * (6083 ±0)` - // Estimated: `0` - // Minimum execution time: 372_331 nanoseconds. - Weight::from_parts(500_234_279, 0) - // Standard Error: 9_708_530 - .saturating_add(Weight::from_parts(6_049_554_620, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 1]`. + // Measured: `907 + r * (76 ±0)` + // Estimated: `6801 + r * (77 ±0)` + // Minimum execution time: 272_697_000 picoseconds. + Weight::from_parts(345_385_667, 6801) + // Standard Error: 14_226 + .saturating_add(Weight::from_parts(46_037_637, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 77).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 160]`. fn seal_ecdsa_to_eth_address(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `706 + r * (3362 ±0)` - // Estimated: `0` - // Minimum execution time: 370_281 nanoseconds. - Weight::from_parts(487_345_571, 0) - // Standard Error: 8_255_395 - .saturating_add(Weight::from_parts(1_383_599_828, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1536 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts OwnerInfoOf (r:1536 w:1536) - /// Proof: Contracts OwnerInfoOf (max_values: None, max_size: Some(88), added: 2563, mode: Ignored) - /// Storage: System EventTopics (r:1538 w:1538) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `877 + r * (42 ±0)` + // Estimated: `6816 + r * (42 ±0)` + // Minimum execution time: 271_800_000 picoseconds. + Weight::from_parts(314_891_136, 6816) + // Standard Error: 9_762 + .saturating_add(Weight::from_parts(11_949_979, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 42).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1536 w:1536) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1536 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:1538 w:1538) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_set_code_hash(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + r * (79300 ±0)` - // Estimated: `0` - // Minimum execution time: 468_402 nanoseconds. - Weight::from_parts(491_662_000, 0) - // Standard Error: 11_442_378 - .saturating_add(Weight::from_parts(3_208_414_115, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((225_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((150_u64).saturating_mul(r.into()))) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `0 + r * (965 ±0)` + // Estimated: `6807 + r * (3090 ±10)` + // Minimum execution time: 274_238_000 picoseconds. + Weight::from_parts(278_034_000, 6807) + // Standard Error: 77_011 + .saturating_add(Weight::from_parts(27_627_005, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 3090).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:33 w:32) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 32]`. + fn add_delegate_dependency(r: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `928 + r * (131 ±0)` + // Estimated: `6878 + r * (2606 ±0)` + // Minimum execution time: 271_519_000 picoseconds. + Weight::from_parts(292_726_476, 6878) + // Standard Error: 23_870 + .saturating_add(Weight::from_parts(6_695_172, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2606).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `MaxEncodedLen`) + /// Storage: `Contracts::CodeInfoOf` (r:33 w:32) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `MaxEncodedLen`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `MaxEncodedLen`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 32]`. + fn remove_delegate_dependency(r: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `969 + r * (183 ±0)` + // Estimated: `129453 + r * (2568 ±0)` + // Minimum execution time: 274_675_000 picoseconds. + Weight::from_parts(293_727_489, 129453) + // Standard Error: 23_160 + .saturating_add(Weight::from_parts(5_895_043, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2568).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_reentrance_count(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `689 + r * (240 ±0)` - // Estimated: `0` - // Minimum execution time: 418_421 nanoseconds. - Weight::from_parts(536_436_097, 0) - // Standard Error: 310_626 - .saturating_add(Weight::from_parts(20_913_646, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `858 + r * (3 ±0)` + // Estimated: `6804 + r * (3 ±0)` + // Minimum execution time: 253_330_000 picoseconds. + Weight::from_parts(281_079_564, 6804) + // Standard Error: 378 + .saturating_add(Weight::from_parts(180_655, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_account_reentrance_count(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `1387 + r * (3140 ±0)` - // Estimated: `0` - // Minimum execution time: 397_661 nanoseconds. - Weight::from_parts(613_318_772, 0) - // Standard Error: 378_470 - .saturating_add(Weight::from_parts(29_430_515, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: Ignored) - /// Storage: Contracts ContractInfoOf (r:1 w:1) - /// Proof: Contracts ContractInfoOf (max_values: None, max_size: Some(258), added: 2733, mode: Ignored) - /// Storage: Contracts CodeStorage (r:1 w:0) - /// Proof: Contracts CodeStorage (max_values: None, max_size: Some(126001), added: 128476, mode: Ignored) - /// Storage: Timestamp Now (r:1 w:0) - /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: Contracts Nonce (r:1 w:1) - /// Proof: Contracts Nonce (max_values: Some(1), max_size: Some(8), added: 503, mode: Ignored) - /// Storage: System EventTopics (r:2 w:2) - /// Proof Skipped: System EventTopics (max_values: None, max_size: None, mode: Ignored) - /// The range of component `r` is `[0, 20]`. + // Measured: `2109 + r * (39 ±0)` + // Estimated: `7899 + r * (40 ±0)` + // Minimum execution time: 276_552_000 picoseconds. + Weight::from_parts(368_521_088, 7899) + // Standard Error: 2_310 + .saturating_add(Weight::from_parts(318_129, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(r.into())) + } + /// Storage: `Contracts::MigrationInProgress` (r:1 w:0) + /// Proof: `Contracts::MigrationInProgress` (`max_values`: Some(1), `max_size`: Some(1026), added: 1521, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) + /// Storage: `Contracts::ContractInfoOf` (r:1 w:1) + /// Proof: `Contracts::ContractInfoOf` (`max_values`: None, `max_size`: Some(1795), added: 4270, mode: `Measured`) + /// Storage: `Contracts::CodeInfoOf` (r:1 w:0) + /// Proof: `Contracts::CodeInfoOf` (`max_values`: None, `max_size`: Some(93), added: 2568, mode: `Measured`) + /// Storage: `Contracts::PristineCode` (r:1 w:0) + /// Proof: `Contracts::PristineCode` (`max_values`: None, `max_size`: Some(125988), added: 128463, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `Contracts::Nonce` (r:1 w:1) + /// Proof: `Contracts::Nonce` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) + /// Storage: `System::EventTopics` (r:2 w:2) + /// Proof: `System::EventTopics` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `r` is `[0, 1600]`. fn seal_instantiation_nonce(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `692 + r * (240 ±0)` - // Estimated: `0` - // Minimum execution time: 369_881 nanoseconds. - Weight::from_parts(476_815_394, 0) - // Standard Error: 269_936 - .saturating_add(Weight::from_parts(18_315_800, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// The range of component `r` is `[0, 50]`. + // Measured: `861 + r * (3 ±0)` + // Estimated: `6801 + r * (3 ±0)` + // Minimum execution time: 258_953_000 picoseconds. + Weight::from_parts(288_222_836, 6801) + // Standard Error: 367 + .saturating_add(Weight::from_parts(152_842, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 3).saturating_mul(r.into())) + } + /// The range of component `r` is `[0, 5000]`. fn instr_i64const(r: u32) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_780 nanoseconds. - Weight::from_parts(3_136_743, 0) - // Standard Error: 4_188 - .saturating_add(Weight::from_parts(621_351, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64load(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_770 nanoseconds. - Weight::from_parts(9_352_462, 0) - // Standard Error: 15_166 - .saturating_add(Weight::from_parts(1_557_402, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64store(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_860 nanoseconds. - Weight::from_parts(8_180_062, 0) - // Standard Error: 13_817 - .saturating_add(Weight::from_parts(1_622_066, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_select(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_460 nanoseconds. - Weight::from_parts(2_551_334, 0) - // Standard Error: 11_841 - .saturating_add(Weight::from_parts(1_665_255, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_if(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_480 nanoseconds. - Weight::from_parts(2_191_446, 0) - // Standard Error: 12_533 - .saturating_add(Weight::from_parts(2_098_157, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_br(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_630 nanoseconds. - Weight::from_parts(1_945_536, 0) - // Standard Error: 6_420 - .saturating_add(Weight::from_parts(984_796, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_br_if(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_520 nanoseconds. - Weight::from_parts(1_854_661, 0) - // Standard Error: 7_036 - .saturating_add(Weight::from_parts(1_381_991, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_br_table(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_531 nanoseconds. - Weight::from_parts(1_429_591, 0) - // Standard Error: 8_514 - .saturating_add(Weight::from_parts(1_816_297, 0).saturating_mul(r.into())) - } - /// The range of component `e` is `[1, 256]`. - fn instr_br_table_per_entry(e: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 5_630 nanoseconds. - Weight::from_parts(7_467_038, 0) - // Standard Error: 333 - .saturating_add(Weight::from_parts(4_907, 0).saturating_mul(e.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_call(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_560 nanoseconds. - Weight::from_parts(1_650_551, 0) - // Standard Error: 35_615 - .saturating_add(Weight::from_parts(5_246_652, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_call_indirect(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_790 nanoseconds. - Weight::from_parts(8_229_172, 0) - // Standard Error: 36_662 - .saturating_add(Weight::from_parts(5_895_045, 0).saturating_mul(r.into())) - } - /// The range of component `p` is `[0, 128]`. - fn instr_call_indirect_per_param(p: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_690 nanoseconds. - Weight::from_parts(13_888_593, 0) - // Standard Error: 3_490 - .saturating_add(Weight::from_parts(312_955, 0).saturating_mul(p.into())) - } - /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 7_050 nanoseconds. - Weight::from_parts(8_811_701, 0) - // Standard Error: 656 - .saturating_add(Weight::from_parts(93_440, 0).saturating_mul(l.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_local_get(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_840 nanoseconds. - Weight::from_parts(5_853_123, 0) - // Standard Error: 6_625 - .saturating_add(Weight::from_parts(765_633, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_local_set(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_340 nanoseconds. - Weight::from_parts(4_113_945, 0) - // Standard Error: 8_909 - .saturating_add(Weight::from_parts(1_198_001, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_local_tee(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 3_970 nanoseconds. - Weight::from_parts(4_643_752, 0) - // Standard Error: 9_875 - .saturating_add(Weight::from_parts(1_463_310, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_global_get(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_620 nanoseconds. - Weight::from_parts(2_315_667, 0) - // Standard Error: 13_076 - .saturating_add(Weight::from_parts(2_015_150, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_global_set(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_600 nanoseconds. - Weight::from_parts(1_483_134, 0) - // Standard Error: 11_873 - .saturating_add(Weight::from_parts(2_058_012, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_memory_current(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_990 nanoseconds. - Weight::from_parts(3_095_465, 0) - // Standard Error: 10_245 - .saturating_add(Weight::from_parts(1_332_117, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 1]`. - fn instr_memory_grow(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_480 nanoseconds. - Weight::from_parts(1_934_187, 0) - // Standard Error: 1_165_957 - .saturating_add(Weight::from_parts(352_987_712, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64clz(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_830 nanoseconds. - Weight::from_parts(3_764_219, 0) - // Standard Error: 7_276 - .saturating_add(Weight::from_parts(908_339, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64ctz(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_440 nanoseconds. - Weight::from_parts(2_932_299, 0) - // Standard Error: 6_288 - .saturating_add(Weight::from_parts(927_100, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64popcnt(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_810 nanoseconds. - Weight::from_parts(3_383_481, 0) - // Standard Error: 6_988 - .saturating_add(Weight::from_parts(911_269, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64eqz(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_690 nanoseconds. - Weight::from_parts(2_921_686, 0) - // Standard Error: 5_839 - .saturating_add(Weight::from_parts(943_173, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64extendsi32(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_500 nanoseconds. - Weight::from_parts(2_623_859, 0) - // Standard Error: 6_524 - .saturating_add(Weight::from_parts(928_298, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64extendui32(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_550 nanoseconds. - Weight::from_parts(4_627_690, 0) - // Standard Error: 8_179 - .saturating_add(Weight::from_parts(863_051, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i32wrapi64(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_550 nanoseconds. - Weight::from_parts(2_595_110, 0) - // Standard Error: 6_474 - .saturating_add(Weight::from_parts(928_065, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64eq(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_510 nanoseconds. - Weight::from_parts(3_894_235, 0) - // Standard Error: 8_463 - .saturating_add(Weight::from_parts(1_219_500, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64ne(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_460 nanoseconds. - Weight::from_parts(2_563_440, 0) - // Standard Error: 8_687 - .saturating_add(Weight::from_parts(1_247_172, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64lts(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_740 nanoseconds. - Weight::from_parts(3_152_891, 0) - // Standard Error: 8_071 - .saturating_add(Weight::from_parts(1_248_541, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64ltu(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_520 nanoseconds. - Weight::from_parts(3_388_594, 0) - // Standard Error: 9_001 - .saturating_add(Weight::from_parts(1_217_995, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64gts(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_740 nanoseconds. - Weight::from_parts(1_635_986, 0) - // Standard Error: 6_243 - .saturating_add(Weight::from_parts(1_305_180, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64gtu(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_710 nanoseconds. - Weight::from_parts(2_638_243, 0) - // Standard Error: 5_966 - .saturating_add(Weight::from_parts(1_275_338, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64les(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_450 nanoseconds. - Weight::from_parts(3_146_830, 0) - // Standard Error: 8_968 - .saturating_add(Weight::from_parts(1_227_357, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64leu(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_460 nanoseconds. - Weight::from_parts(3_252_838, 0) - // Standard Error: 7_613 - .saturating_add(Weight::from_parts(1_246_230, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64ges(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_530 nanoseconds. - Weight::from_parts(2_491_422, 0) - // Standard Error: 7_290 - .saturating_add(Weight::from_parts(1_279_578, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64geu(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_480 nanoseconds. - Weight::from_parts(1_696_914, 0) - // Standard Error: 7_284 - .saturating_add(Weight::from_parts(1_291_501, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64add(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_720 nanoseconds. - Weight::from_parts(3_244_000, 0) - // Standard Error: 8_247 - .saturating_add(Weight::from_parts(1_223_730, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64sub(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_740 nanoseconds. - Weight::from_parts(2_339_735, 0) - // Standard Error: 6_588 - .saturating_add(Weight::from_parts(1_275_672, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64mul(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_760 nanoseconds. - Weight::from_parts(3_085_111, 0) - // Standard Error: 7_619 - .saturating_add(Weight::from_parts(1_248_370, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64divs(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_490 nanoseconds. - Weight::from_parts(2_468_536, 0) - // Standard Error: 9_812 - .saturating_add(Weight::from_parts(1_454_375, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64divu(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_520 nanoseconds. - Weight::from_parts(3_650_517, 0) - // Standard Error: 9_928 - .saturating_add(Weight::from_parts(1_207_003, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64rems(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_470 nanoseconds. - Weight::from_parts(1_449_755, 0) - // Standard Error: 9_386 - .saturating_add(Weight::from_parts(1_576_210, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64remu(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_530 nanoseconds. - Weight::from_parts(3_604_036, 0) - // Standard Error: 9_582 - .saturating_add(Weight::from_parts(1_387_067, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64and(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_450 nanoseconds. - Weight::from_parts(3_741_153, 0) - // Standard Error: 9_330 - .saturating_add(Weight::from_parts(1_187_944, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64or(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_550 nanoseconds. - Weight::from_parts(1_900_000, 0) - // Standard Error: 23_251 - .saturating_add(Weight::from_parts(1_513_468, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64xor(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_510 nanoseconds. - Weight::from_parts(2_921_475, 0) - // Standard Error: 7_444 - .saturating_add(Weight::from_parts(1_249_617, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64shl(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_780 nanoseconds. - Weight::from_parts(3_548_981, 0) - // Standard Error: 7_767 - .saturating_add(Weight::from_parts(1_242_323, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64shrs(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_710 nanoseconds. - Weight::from_parts(1_904_247, 0) - // Standard Error: 7_361 - .saturating_add(Weight::from_parts(1_279_805, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64shru(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_450 nanoseconds. - Weight::from_parts(1_679_219, 0) - // Standard Error: 6_529 - .saturating_add(Weight::from_parts(1_291_802, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64rotl(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_720 nanoseconds. - Weight::from_parts(3_744_484, 0) - // Standard Error: 8_338 - .saturating_add(Weight::from_parts(1_227_022, 0).saturating_mul(r.into())) - } - /// The range of component `r` is `[0, 50]`. - fn instr_i64rotr(r: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 1_500 nanoseconds. - Weight::from_parts(3_433_997, 0) - // Standard Error: 8_899 - .saturating_add(Weight::from_parts(1_211_884, 0).saturating_mul(r.into())) + // Minimum execution time: 1_476_000 picoseconds. + Weight::from_parts(2_119_717, 0) + // Standard Error: 28 + .saturating_add(Weight::from_parts(9_805, 0).saturating_mul(r.into())) } } diff --git a/runtime/common/src/weights/pallet_democracy.rs b/runtime/common/src/weights/pallet_democracy.rs index 81df45f93..78f1f7ee1 100644 --- a/runtime/common/src/weights/pallet_democracy.rs +++ b/runtime/common/src/weights/pallet_democracy.rs @@ -57,105 +57,113 @@ impl pallet_democracy::weights::WeightInfo for WeightIn /// Storage: Democracy PublicProps (r:1 w:1) /// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen) /// Storage: Democracy Blacklist (r:1 w:0) - /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3242), added: 5717, mode: MaxEncodedLen) + /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3238), added: 5713, mode: MaxEncodedLen) /// Storage: Democracy DepositOf (r:0 w:1) /// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen) fn propose() -> Weight { // Proof Size summary in bytes: - // Measured: `4835` - // Estimated: `23413` - // Minimum execution time: 50_690 nanoseconds. - Weight::from_parts(63_110_000, 23413) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `4801` + // Estimated: `18187` + // Minimum execution time: 49_339_000 picoseconds. + Weight::from_parts(50_942_000, 18187) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy DepositOf (r:1 w:1) /// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen) fn second() -> Weight { // Proof Size summary in bytes: - // Measured: `3591` - // Estimated: `5705` - // Minimum execution time: 43_520 nanoseconds. - Weight::from_parts(45_040_000, 5705) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `3556` + // Estimated: `6695` + // Minimum execution time: 43_291_000 picoseconds. + Weight::from_parts(44_856_000, 6695) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Democracy VotingOf (r:1 w:1) - /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn vote_new() -> Weight { // Proof Size summary in bytes: - // Measured: `3500` - // Estimated: `12732` - // Minimum execution time: 59_010 nanoseconds. - Weight::from_parts(72_290_000, 12732) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `3470` + // Estimated: `7260` + // Minimum execution time: 61_890_000 picoseconds. + Weight::from_parts(63_626_000, 7260) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Democracy VotingOf (r:1 w:1) - /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn vote_existing() -> Weight { // Proof Size summary in bytes: - // Measured: `3522` - // Estimated: `12732` - // Minimum execution time: 59_810 nanoseconds. - Weight::from_parts(72_890_000, 12732) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `3492` + // Estimated: `7260` + // Minimum execution time: 67_802_000 picoseconds. + Weight::from_parts(69_132_000, 7260) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Democracy Cancellations (r:1 w:1) /// Proof: Democracy Cancellations (max_values: None, max_size: Some(33), added: 2508, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:1 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) fn emergency_cancel() -> Weight { // Proof Size summary in bytes: - // Measured: `295` - // Estimated: `5192` - // Minimum execution time: 26_390 nanoseconds. - Weight::from_parts(32_000_000, 5192) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `366` + // Estimated: `3666` + // Minimum execution time: 25_757_000 picoseconds. + Weight::from_parts(27_226_000, 3666) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy PublicProps (r:1 w:1) /// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen) /// Storage: Democracy DepositOf (r:1 w:1) /// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen) - /// Storage: System Account (r:2 w:2) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:3 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) /// Storage: Democracy NextExternal (r:1 w:1) /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) /// Storage: Democracy ReferendumInfoOf (r:1 w:1) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Democracy Blacklist (r:0 w:1) - /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3242), added: 5717, mode: MaxEncodedLen) + /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3238), added: 5713, mode: MaxEncodedLen) fn blacklist() -> Weight { // Proof Size summary in bytes: - // Measured: `6251` - // Estimated: `31427` - // Minimum execution time: 112_670 nanoseconds. - Weight::from_parts(139_060_000, 31427) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(7)) + // Measured: `5910` + // Estimated: `18187` + // Minimum execution time: 113_060_000 picoseconds. + Weight::from_parts(114_813_000, 18187) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) } /// Storage: Democracy NextExternal (r:1 w:1) /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) /// Storage: Democracy Blacklist (r:1 w:0) - /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3242), added: 5717, mode: MaxEncodedLen) + /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3238), added: 5713, mode: MaxEncodedLen) fn external_propose() -> Weight { // Proof Size summary in bytes: - // Measured: `3419` - // Estimated: `6344` - // Minimum execution time: 28_210 nanoseconds. - Weight::from_parts(28_970_000, 6344) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `3416` + // Estimated: `6703` + // Minimum execution time: 13_413_000 picoseconds. + Weight::from_parts(13_794_000, 6703) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Democracy NextExternal (r:0 w:1) /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) @@ -163,8 +171,8 @@ impl pallet_democracy::weights::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_060 nanoseconds. - Weight::from_parts(6_540_000, 0).saturating_add(T::DbWeight::get().writes(1)) + // Minimum execution time: 3_213_000 picoseconds. + Weight::from_parts(3_429_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Democracy NextExternal (r:0 w:1) /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) @@ -172,80 +180,90 @@ impl pallet_democracy::weights::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_150 nanoseconds. - Weight::from_parts(6_650_000, 0).saturating_add(T::DbWeight::get().writes(1)) + // Minimum execution time: 3_280_000 picoseconds. + Weight::from_parts(3_389_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Democracy NextExternal (r:1 w:1) /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) /// Storage: Democracy ReferendumCount (r:1 w:1) /// Proof: Democracy ReferendumCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:1 w:2) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) /// Storage: Democracy ReferendumInfoOf (r:0 w:1) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) fn fast_track() -> Weight { // Proof Size summary in bytes: - // Measured: `179` - // Estimated: `1126` - // Minimum execution time: 28_070 nanoseconds. - Weight::from_parts(34_820_000, 1126) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `286` + // Estimated: `3518` + // Minimum execution time: 28_142_000 picoseconds. + Weight::from_parts(28_862_000, 3518) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: Democracy NextExternal (r:1 w:1) /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) /// Storage: Democracy Blacklist (r:1 w:1) - /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3242), added: 5717, mode: MaxEncodedLen) + /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3238), added: 5713, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:1 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) fn veto_external() -> Weight { // Proof Size summary in bytes: - // Measured: `3448` - // Estimated: `6344` - // Minimum execution time: 36_350 nanoseconds. - Weight::from_parts(44_300_000, 6344) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `3519` + // Estimated: `6703` + // Minimum execution time: 32_395_000 picoseconds. + Weight::from_parts(33_617_000, 6703) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy PublicProps (r:1 w:1) /// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen) /// Storage: Democracy DepositOf (r:1 w:1) /// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen) - /// Storage: System Account (r:2 w:2) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:1 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) fn cancel_proposal() -> Weight { // Proof Size summary in bytes: - // Measured: `6122` - // Estimated: `28116` - // Minimum execution time: 94_210 nanoseconds. - Weight::from_parts(115_161_000, 28116) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + // Measured: `5821` + // Estimated: `18187` + // Minimum execution time: 92_255_000 picoseconds. + Weight::from_parts(93_704_000, 18187) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } + /// Storage: Democracy MetadataOf (r:1 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) /// Storage: Democracy ReferendumInfoOf (r:0 w:1) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) fn cancel_referendum() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 11_520 nanoseconds. - Weight::from_parts(13_900_000, 0).saturating_add(T::DbWeight::get().writes(1)) + // Measured: `271` + // Estimated: `3518` + // Minimum execution time: 19_623_000 picoseconds. + Weight::from_parts(20_545_000, 3518) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Democracy LowestUnbaked (r:1 w:1) /// Proof: Democracy LowestUnbaked (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Democracy ReferendumCount (r:1 w:0) /// Proof: Democracy ReferendumCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: Democracy ReferendumInfoOf (r:99 w:0) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// The range of component `r` is `[0, 99]`. fn on_initialize_base(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `174 + r * (125 ±0)` - // Estimated: `998 + r * (2684 ±0)` - // Minimum execution time: 14_730 nanoseconds. - Weight::from_parts(28_833_321, 998) - // Standard Error: 37_839 - .saturating_add(Weight::from_parts(4_701_815, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Measured: `244 + r * (86 ±0)` + // Estimated: `1489 + r * (2676 ±0)` + // Minimum execution time: 7_032_000 picoseconds. + Weight::from_parts(7_931_421, 1489) + // Standard Error: 7_395 + .saturating_add(Weight::from_parts(3_236_964, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 2684).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_parts(0, 2676).saturating_mul(r.into())) } /// Storage: Democracy LowestUnbaked (r:1 w:1) /// Proof: Democracy LowestUnbaked (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) @@ -258,60 +276,62 @@ impl pallet_democracy::weights::WeightInfo for WeightIn /// Storage: Democracy PublicProps (r:1 w:0) /// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen) /// Storage: Democracy ReferendumInfoOf (r:99 w:0) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// The range of component `r` is `[0, 99]`. fn on_initialize_base_with_launch_period(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `174 + r * (125 ±0)` - // Estimated: `19318 + r * (2684 ±0)` - // Minimum execution time: 18_190 nanoseconds. - Weight::from_parts(29_838_845, 19318) - // Standard Error: 39_893 - .saturating_add(Weight::from_parts(4_571_724, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(5)) + // Measured: `244 + r * (86 ±0)` + // Estimated: `18187 + r * (2676 ±0)` + // Minimum execution time: 10_524_000 picoseconds. + Weight::from_parts(10_369_064, 18187) + // Standard Error: 8_385 + .saturating_add(Weight::from_parts(3_242_334, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 2684).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_parts(0, 2676).saturating_mul(r.into())) } /// Storage: Democracy VotingOf (r:3 w:3) - /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Democracy ReferendumInfoOf (r:99 w:99) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `r` is `[0, 99]`. fn delegate(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `897 + r * (147 ±0)` - // Estimated: `22596 + r * (2684 ±0)` - // Minimum execution time: 55_960 nanoseconds. - Weight::from_parts(72_937_258, 22596) - // Standard Error: 49_578 - .saturating_add(Weight::from_parts(6_045_111, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(4)) + // Measured: `830 + r * (108 ±0)` + // Estimated: `19800 + r * (2676 ±0)` + // Minimum execution time: 46_106_000 picoseconds. + Weight::from_parts(48_936_654, 19800) + // Standard Error: 8_879 + .saturating_add(Weight::from_parts(4_708_141, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 2684).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2676).saturating_mul(r.into())) } /// Storage: Democracy VotingOf (r:2 w:2) - /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Democracy ReferendumInfoOf (r:99 w:99) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// The range of component `r` is `[0, 99]`. fn undelegate(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `522 + r * (147 ±0)` - // Estimated: `12548 + r * (2684 ±0)` - // Minimum execution time: 33_530 nanoseconds. - Weight::from_parts(45_434_419, 12548) - // Standard Error: 48_431 - .saturating_add(Weight::from_parts(6_200_443, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Measured: `493 + r * (108 ±0)` + // Estimated: `13530 + r * (2676 ±0)` + // Minimum execution time: 21_078_000 picoseconds. + Weight::from_parts(22_732_737, 13530) + // Standard Error: 7_969 + .saturating_add(Weight::from_parts(4_626_458, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) - .saturating_add(Weight::from_parts(0, 2684).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(0, 2676).saturating_mul(r.into())) } /// Storage: Democracy PublicProps (r:0 w:1) /// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen) @@ -319,73 +339,161 @@ impl pallet_democracy::weights::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_870 nanoseconds. - Weight::from_parts(7_050_000, 0).saturating_add(T::DbWeight::get().writes(1)) + // Minimum execution time: 3_229_000 picoseconds. + Weight::from_parts(3_415_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Democracy VotingOf (r:1 w:1) - /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `r` is `[0, 99]`. - fn unlock_remove(_r: u32) -> Weight { + fn unlock_remove(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `554` - // Estimated: `12655` - // Minimum execution time: 31_950 nanoseconds. - Weight::from_parts(46_451_047, 12655) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `563` + // Estimated: `7260` + // Minimum execution time: 25_735_000 picoseconds. + Weight::from_parts(41_341_468, 7260) + // Standard Error: 3_727 + .saturating_add(Weight::from_parts(94_755, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy VotingOf (r:1 w:1) - /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `r` is `[0, 99]`. fn unlock_set(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `555 + r * (22 ±0)` - // Estimated: `12655` - // Minimum execution time: 34_100 nanoseconds. - Weight::from_parts(44_669_466, 12655) - // Standard Error: 5_077 - .saturating_add(Weight::from_parts(42_607, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `564 + r * (22 ±0)` + // Estimated: `7260` + // Minimum execution time: 36_233_000 picoseconds. + Weight::from_parts(39_836_017, 7260) + // Standard Error: 1_791 + .saturating_add(Weight::from_parts(132_158, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Democracy VotingOf (r:1 w:1) - /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// The range of component `r` is `[1, 100]`. fn remove_vote(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `760 + r * (26 ±0)` - // Estimated: `8958` - // Minimum execution time: 26_160 nanoseconds. - Weight::from_parts(34_737_151, 8958) - // Standard Error: 4_560 - .saturating_add(Weight::from_parts(64_111, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `728 + r * (26 ±0)` + // Estimated: `7260` + // Minimum execution time: 16_081_000 picoseconds. + Weight::from_parts(19_624_101, 7260) + // Standard Error: 1_639 + .saturating_add(Weight::from_parts(133_630, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Democracy ReferendumInfoOf (r:1 w:1) - /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) /// Storage: Democracy VotingOf (r:1 w:1) - /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3795), added: 6270, mode: MaxEncodedLen) /// The range of component `r` is `[1, 100]`. fn remove_other_vote(r: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `760 + r * (26 ±0)` - // Estimated: `8958` - // Minimum execution time: 25_821 nanoseconds. - Weight::from_parts(32_571_293, 8958) - // Standard Error: 3_984 - .saturating_add(Weight::from_parts(94_520, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `728 + r * (26 ±0)` + // Estimated: `7260` + // Minimum execution time: 15_634_000 picoseconds. + Weight::from_parts(19_573_407, 7260) + // Standard Error: 1_790 + .saturating_add(Weight::from_parts(139_707, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Democracy NextExternal (r:1 w:0) + /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) + /// Storage: Preimage StatusFor (r:1 w:0) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:0 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) + fn set_external_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `356` + // Estimated: `3556` + // Minimum execution time: 18_344_000 picoseconds. + Weight::from_parts(18_727_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Democracy NextExternal (r:1 w:0) + /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:1 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) + fn clear_external_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `286` + // Estimated: `3518` + // Minimum execution time: 16_497_000 picoseconds. + Weight::from_parts(16_892_000, 3518) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Democracy PublicProps (r:1 w:0) + /// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen) + /// Storage: Preimage StatusFor (r:1 w:0) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:0 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) + fn set_proposal_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `4888` + // Estimated: `18187` + // Minimum execution time: 39_517_000 picoseconds. + Weight::from_parts(40_632_000, 18187) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Democracy PublicProps (r:1 w:0) + /// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:1 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) + fn clear_proposal_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `4822` + // Estimated: `18187` + // Minimum execution time: 37_108_000 picoseconds. + Weight::from_parts(37_599_000, 18187) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Preimage StatusFor (r:1 w:0) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:0 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) + fn set_referendum_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `144` + // Estimated: `3556` + // Minimum execution time: 13_997_000 picoseconds. + Weight::from_parts(14_298_000, 3556) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Democracy ReferendumInfoOf (r:1 w:0) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(201), added: 2676, mode: MaxEncodedLen) + /// Storage: Democracy MetadataOf (r:1 w:1) + /// Proof: Democracy MetadataOf (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) + fn clear_referendum_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `302` + // Estimated: `3666` + // Minimum execution time: 18_122_000 picoseconds. + Weight::from_parts(18_655_000, 3666) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/pallet_parachain_staking.rs b/runtime/common/src/weights/pallet_parachain_staking.rs index 0ff678f08..788b12083 100644 --- a/runtime/common/src/weights/pallet_parachain_staking.rs +++ b/runtime/common/src/weights/pallet_parachain_staking.rs @@ -56,67 +56,67 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Proof Skipped: ParachainStaking InflationConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_staking_expectations() -> Weight { // Proof Size summary in bytes: - // Measured: `119` - // Estimated: `614` - // Minimum execution time: 21_650 nanoseconds. - Weight::from_parts(22_480_000, 614) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `88` + // Estimated: `1573` + // Minimum execution time: 15_889_000 picoseconds. + Weight::from_parts(16_404_000, 1573) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking InflationConfig (r:1 w:1) /// Proof Skipped: ParachainStaking InflationConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_inflation() -> Weight { // Proof Size summary in bytes: - // Measured: `119` - // Estimated: `614` - // Minimum execution time: 76_630 nanoseconds. - Weight::from_parts(77_480_000, 614) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `88` + // Estimated: `1573` + // Minimum execution time: 44_509_000 picoseconds. + Weight::from_parts(45_011_000, 1573) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking ParachainBondInfo (r:1 w:1) /// Proof Skipped: ParachainStaking ParachainBondInfo (max_values: Some(1), max_size: None, mode: Measured) fn set_parachain_bond_account() -> Weight { // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `547` - // Minimum execution time: 19_300 nanoseconds. - Weight::from_parts(19_930_000, 547) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `6` + // Estimated: `1491` + // Minimum execution time: 14_675_000 picoseconds. + Weight::from_parts(15_094_000, 1491) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking ParachainBondInfo (r:1 w:1) /// Proof Skipped: ParachainStaking ParachainBondInfo (max_values: Some(1), max_size: None, mode: Measured) fn set_parachain_bond_reserve_percent() -> Weight { // Proof Size summary in bytes: - // Measured: `52` - // Estimated: `547` - // Minimum execution time: 18_880 nanoseconds. - Weight::from_parts(19_530_000, 547) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `6` + // Estimated: `1491` + // Minimum execution time: 13_898_000 picoseconds. + Weight::from_parts(14_492_000, 1491) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking TotalSelected (r:1 w:1) /// Proof Skipped: ParachainStaking TotalSelected (max_values: Some(1), max_size: None, mode: Measured) fn set_total_selected() -> Weight { // Proof Size summary in bytes: // Measured: `28` - // Estimated: `523` - // Minimum execution time: 20_290 nanoseconds. - Weight::from_parts(20_680_000, 523) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Estimated: `1513` + // Minimum execution time: 15_666_000 picoseconds. + Weight::from_parts(15_939_000, 1513) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking CollatorCommission (r:1 w:1) /// Proof Skipped: ParachainStaking CollatorCommission (max_values: Some(1), max_size: None, mode: Measured) fn set_collator_commission() -> Weight { // Proof Size summary in bytes: // Measured: `27` - // Estimated: `522` - // Minimum execution time: 17_990 nanoseconds. - Weight::from_parts(19_230_000, 522) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Estimated: `1512` + // Minimum execution time: 13_997_000 picoseconds. + Weight::from_parts(14_320_000, 1512) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking TotalSelected (r:1 w:0) /// Proof Skipped: ParachainStaking TotalSelected (max_values: Some(1), max_size: None, mode: Measured) @@ -124,12 +124,12 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Proof Skipped: ParachainStaking InflationConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_blocks_per_round() -> Weight { // Proof Size summary in bytes: - // Measured: `147` - // Estimated: `1284` - // Minimum execution time: 81_350 nanoseconds. - Weight::from_parts(82_360_000, 1284) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `116` + // Estimated: `1601` + // Minimum execution time: 48_389_000 picoseconds. + Weight::from_parts(49_554_000, 1601) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) @@ -138,183 +138,255 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) /// Storage: ParachainStaking TopDelegations (r:0 w:1) /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking BottomDelegations (r:0 w:1) /// Proof Skipped: ParachainStaking BottomDelegations (max_values: None, max_size: None, mode: Measured) - /// The range of component `x` is `[3, 1000]`. + /// The range of component `x` is `[3, 200]`. fn join_candidates(x: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `1898 + x * (49 ±0)` - // Estimated: `22371 + x * (300 ±0)` - // Minimum execution time: 66_890 nanoseconds. - Weight::from_parts(96_425_237, 22371) - // Standard Error: 2_143 - .saturating_add(Weight::from_parts(185_610, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(7)) - .saturating_add(Weight::from_parts(0, 300).saturating_mul(x.into())) + // Measured: `1421 + x * (38 ±0)` + // Estimated: `4752 + x * (41 ±0)` + // Minimum execution time: 76_742_000 picoseconds. + Weight::from_parts(88_864_511, 4752) + // Standard Error: 2_004 + .saturating_add(Weight::from_parts(88_538, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(Weight::from_parts(0, 41).saturating_mul(x.into())) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) - /// The range of component `x` is `[3, 1000]`. + /// The range of component `x` is `[3, 200]`. fn schedule_leave_candidates(x: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `990 + x * (48 ±0)` - // Estimated: `4794 + x * (98 ±0)` - // Minimum execution time: 31_150 nanoseconds. - Weight::from_parts(45_204_630, 4794) - // Standard Error: 1_892 - .saturating_add(Weight::from_parts(159_930, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(Weight::from_parts(0, 98).saturating_mul(x.into())) + // Measured: `702 + x * (37 ±0)` + // Estimated: `4060 + x * (38 ±0)` + // Minimum execution time: 27_238_000 picoseconds. + Weight::from_parts(34_109_750, 4060) + // Standard Error: 1_116 + .saturating_add(Weight::from_parts(62_292, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 38).saturating_mul(x.into())) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking AutoCompoundingDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking TopDelegations (r:1 w:1) /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking DelegatorState (r:349 w:349) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:350 w:350) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:350 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) /// Storage: System Account (r:350 w:350) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking BottomDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking BottomDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking Total (r:1 w:1) + /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) + /// The range of component `x` is `[2, 350]`. + fn execute_leave_candidates_worst_case(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1157 + x * (431 ±0)` + // Estimated: `4696 + x * (3762 ±0)` + // Minimum execution time: 141_946_000 picoseconds. + Weight::from_parts(144_961_000, 4696) + // Standard Error: 79_832 + .saturating_add(Weight::from_parts(49_060_154, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(x.into()))) + .saturating_add(Weight::from_parts(0, 3762).saturating_mul(x.into())) + } + /// Storage: ParachainStaking CandidateInfo (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:1) /// Proof Skipped: ParachainStaking AutoCompoundingDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking TopDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking DelegatorState (r:349 w:349) + /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) + /// Storage: Balances Locks (r:350 w:350) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:350 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) + /// Storage: System Account (r:350 w:350) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) + /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking BottomDelegations (r:1 w:1) /// Proof Skipped: ParachainStaking BottomDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) /// The range of component `x` is `[2, 350]`. - fn execute_leave_candidates(x: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `238 + x * (595 ±0)` - // Estimated: `18229 + x * (12995 ±0)` - // Minimum execution time: 121_740 nanoseconds. - Weight::from_parts(137_141_000, 18229) - // Standard Error: 158_049 - .saturating_add(Weight::from_parts(46_465_017, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(x.into()))) - .saturating_add(T::DbWeight::get().writes(5)) + /// The range of component `y` is `[2, 350]`. + fn execute_leave_candidates_ideal(x: u32, _y: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1149 + x * (431 ±0)` + // Estimated: `4696 + x * (3762 ±0)` + // Minimum execution time: 133_121_000 picoseconds. + Weight::from_parts(134_388_000, 4696) + // Standard Error: 34_256 + .saturating_add(Weight::from_parts(50_828_386, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(x.into()))) - .saturating_add(Weight::from_parts(0, 12995).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 3762).saturating_mul(x.into())) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) - /// The range of component `x` is `[3, 1000]`. + /// The range of component `x` is `[3, 200]`. fn cancel_leave_candidates(x: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `946 + x * (48 ±0)` - // Estimated: `4704 + x * (98 ±0)` - // Minimum execution time: 31_720 nanoseconds. - Weight::from_parts(41_148_720, 4704) - // Standard Error: 1_807 - .saturating_add(Weight::from_parts(174_213, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(Weight::from_parts(0, 98).saturating_mul(x.into())) + // Measured: `670 + x * (37 ±0)` + // Estimated: `4028 + x * (38 ±0)` + // Minimum execution time: 25_910_000 picoseconds. + Weight::from_parts(32_465_127, 4028) + // Standard Error: 1_064 + .saturating_add(Weight::from_parts(60_655, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 38).saturating_mul(x.into())) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) - fn go_offline() -> Weight { - // Proof Size summary in bytes: - // Measured: `371` - // Estimated: `3712` - // Minimum execution time: 34_840 nanoseconds. - Weight::from_parts(35_820_000, 3712) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + /// The range of component `x` is `[1, 200]`. + fn go_offline(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `567 + x * (38 ±0)` + // Estimated: `3968 + x * (39 ±0)` + // Minimum execution time: 24_471_000 picoseconds. + Weight::from_parts(30_875_133, 3968) + // Standard Error: 1_124 + .saturating_add(Weight::from_parts(66_032, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(x.into())) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) - fn go_online() -> Weight { - // Proof Size summary in bytes: - // Measured: `322` - // Estimated: `3614` - // Minimum execution time: 34_860 nanoseconds. - Weight::from_parts(36_040_000, 3614) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + /// The range of component `x` is `[1, 200]`. + fn go_online(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `531 + x * (38 ±0)` + // Estimated: `3932 + x * (39 ±0)` + // Minimum execution time: 24_249_000 picoseconds. + Weight::from_parts(30_765_292, 3932) + // Standard Error: 1_181 + .saturating_add(Weight::from_parts(65_935, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(x.into())) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidatePool (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: ParachainStaking CandidatePool (r:1 w:1) - /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) - fn candidate_bond_more() -> Weight { - // Proof Size summary in bytes: - // Measured: `650` - // Estimated: `11796` - // Minimum execution time: 61_311 nanoseconds. - Weight::from_parts(75_650_000, 11796) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) + /// The range of component `x` is `[1, 200]`. + fn candidate_bond_more(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1270 + x * (42 ±0)` + // Estimated: `4752 + x * (44 ±0)` + // Minimum execution time: 68_720_000 picoseconds. + Weight::from_parts(79_722_709, 4752) + // Standard Error: 2_059 + .saturating_add(Weight::from_parts(113_832, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(Weight::from_parts(0, 44).saturating_mul(x.into())) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) fn schedule_candidate_bond_less() -> Weight { // Proof Size summary in bytes: - // Measured: `216` - // Estimated: `2691` - // Minimum execution time: 29_000 nanoseconds. - Weight::from_parts(29_870_000, 2691) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `171` + // Estimated: `3636` + // Minimum execution time: 21_049_000 picoseconds. + Weight::from_parts(21_735_000, 3636) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidatePool (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - /// Storage: ParachainStaking CandidatePool (r:1 w:1) - /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) - fn execute_candidate_bond_less() -> Weight { - // Proof Size summary in bytes: - // Measured: `670` - // Estimated: `11856` - // Minimum execution time: 65_100 nanoseconds. - Weight::from_parts(66_880_000, 11856) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// The range of component `x` is `[1, 200]`. + fn execute_candidate_bond_less(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1322 + x * (42 ±0)` + // Estimated: `4752 + x * (43 ±0)` + // Minimum execution time: 71_996_000 picoseconds. + Weight::from_parts(80_620_929, 4752) + // Standard Error: 1_363 + .saturating_add(Weight::from_parts(94_580, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(Weight::from_parts(0, 43).saturating_mul(x.into())) } /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) fn cancel_candidate_bond_less() -> Weight { // Proof Size summary in bytes: - // Measured: `236` - // Estimated: `2711` - // Minimum execution time: 22_170 nanoseconds. - Weight::from_parts(27_290_000, 2711) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `191` + // Estimated: `3656` + // Minimum execution time: 18_991_000 picoseconds. + Weight::from_parts(19_491_000, 3656) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + fn set_candidate_bond_to_zero(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1322 + x * (42 ±0)` + // Estimated: `4752 + x * (43 ±0)` + // Minimum execution time: 71_996_000 picoseconds. + Weight::from_parts(80_620_929, 4752) + // Standard Error: 1_363 + .saturating_add(Weight::from_parts(94_580, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(Weight::from_parts(0, 43).saturating_mul(x.into())) } /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidateInfo (r:1 w:1) @@ -324,106 +396,105 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) /// The range of component `x` is `[3, 100]`. /// The range of component `y` is `[2, 300]`. fn delegate(x: u32, y: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `2374 + x * (103 ±0) + y * (52 ±0)` - // Estimated: `25391 + x * (530 ±0) + y * (265 ±0)` - // Minimum execution time: 125_490 nanoseconds. - Weight::from_parts(135_398_832, 25391) - // Standard Error: 6_396 - .saturating_add(Weight::from_parts(265_077, 0).saturating_mul(x.into())) - // Standard Error: 2_098 - .saturating_add(Weight::from_parts(138_672, 0).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(7)) - .saturating_add(Weight::from_parts(0, 530).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 265).saturating_mul(y.into())) + // Measured: `2479 + x * (79 ±0) + y * (38 ±0)` + // Estimated: `5723 + x * (81 ±0) + y * (39 ±0)` + // Minimum execution time: 120_061_000 picoseconds. + Weight::from_parts(111_894_468, 5723) + // Standard Error: 1_320 + .saturating_add(Weight::from_parts(135_446, 0).saturating_mul(x.into())) + // Standard Error: 433 + .saturating_add(Weight::from_parts(41_110, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(Weight::from_parts(0, 81).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(y.into())) } /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) - fn schedule_leave_delegators() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `5302` - // Minimum execution time: 32_930 nanoseconds. - Weight::from_parts(33_951_000, 5302) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + /// The range of component `x` is `[0, 349]`. + fn schedule_revoke_delegation(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `566 + x * (42 ±0)` + // Estimated: `4012 + x * (43 ±0)` + // Minimum execution time: 25_479_000 picoseconds. + Weight::from_parts(35_344_986, 4012) + // Standard Error: 803 + .saturating_add(Weight::from_parts(60_212, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 43).saturating_mul(x.into())) } /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainStaking DelegationScheduledRequests (r:99 w:99) + /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:0) /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainStaking CandidateInfo (r:99 w:99) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) + /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainStaking TopDelegations (r:99 w:99) + /// Storage: ParachainStaking TopDelegations (r:1 w:1) /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: ParachainStaking AutoCompoundingDelegations (r:99 w:0) - /// Proof Skipped: ParachainStaking AutoCompoundingDelegations (max_values: None, max_size: None, mode: Measured) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - /// The range of component `x` is `[2, 100]`. - fn execute_leave_delegators(x: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `755 + x * (558 ±0)` - // Estimated: `26542 + x * (13492 ±2)` - // Minimum execution time: 105_910 nanoseconds. - Weight::from_parts(108_141_000, 26542) - // Standard Error: 76_935 - .saturating_add(Weight::from_parts(37_566_563, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(x.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(x.into()))) - .saturating_add(Weight::from_parts(0, 13492).saturating_mul(x.into())) + /// The range of component `x` is `[0, 349]`. + fn delegator_bond_more(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `1996 + x * (79 ±0)` + // Estimated: `5428 + x * (79 ±0)` + // Minimum execution time: 90_985_000 picoseconds. + Weight::from_parts(111_258_553, 5428) + // Standard Error: 1_580 + .saturating_add(Weight::from_parts(109_354, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(Weight::from_parts(0, 79).saturating_mul(x.into())) } /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) - fn cancel_leave_delegators() -> Weight { - // Proof Size summary in bytes: - // Measured: `298` - // Estimated: `5546` - // Minimum execution time: 36_750 nanoseconds. - Weight::from_parts(38_090_000, 5546) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + /// The range of component `x` is `[0, 349]`. + fn schedule_delegator_bond_less(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `566 + x * (42 ±0)` + // Estimated: `4012 + x * (43 ±0)` + // Minimum execution time: 25_784_000 picoseconds. + Weight::from_parts(35_792_924, 4012) + // Standard Error: 793 + .saturating_add(Weight::from_parts(60_874, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 43).saturating_mul(x.into())) } /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) - fn schedule_revoke_delegation() -> Weight { - // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `5302` - // Minimum execution time: 27_410 nanoseconds. - Weight::from_parts(33_560_000, 5302) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:0) - /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainStaking DelegatorState (r:1 w:1) - /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:0) + /// Proof Skipped: ParachainStaking AutoCompoundingDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking TopDelegations (r:1 w:1) @@ -432,54 +503,45 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) - fn delegator_bond_more() -> Weight { - // Proof Size summary in bytes: - // Measured: `1066` - // Estimated: `23667` - // Minimum execution time: 103_840 nanoseconds. - Weight::from_parts(105_370_000, 23667) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(7)) - } - /// Storage: ParachainStaking DelegatorState (r:1 w:1) - /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) - /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) - fn schedule_delegator_bond_less() -> Weight { + fn execute_revoke_delegation() -> Weight { // Proof Size summary in bytes: - // Measured: `176` - // Estimated: `5302` - // Minimum execution time: 28_110 nanoseconds. - Weight::from_parts(34_080_000, 5302) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Measured: `964` + // Estimated: `4752` + // Minimum execution time: 113_086_000 picoseconds. + Weight::from_parts(115_421_000, 4752) + .saturating_add(T::DbWeight::get().reads(10_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) } /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) - /// Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:1) /// Proof Skipped: ParachainStaking AutoCompoundingDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking TopDelegations (r:1 w:1) /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking BottomDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking BottomDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) - fn execute_revoke_delegation() -> Weight { + fn execute_delegator_revoke_delegation_worst() -> Weight { // Proof Size summary in bytes: - // Measured: `1243` - // Estimated: `28447` - // Minimum execution time: 103_180 nanoseconds. - Weight::from_parts(126_781_000, 28447) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(8)) + // Measured: `37308` + // Estimated: `40773` + // Minimum execution time: 179_325_000 picoseconds. + Weight::from_parts(182_100_000, 40773) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) } /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) @@ -488,49 +550,44 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Storage: ParachainStaking CandidateInfo (r:1 w:1) /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) /// Storage: ParachainStaking TopDelegations (r:1 w:1) /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking BottomDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking BottomDelegations (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) - fn execute_delegator_bond_less() -> Weight { + fn execute_delegator_bond_less_worst() -> Weight { // Proof Size summary in bytes: - // Measured: `1188` - // Estimated: `24399` - // Minimum execution time: 80_960 nanoseconds. - Weight::from_parts(95_831_000, 24399) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(8)) + // Measured: `29930` + // Estimated: `33395` + // Minimum execution time: 150_818_000 picoseconds. + Weight::from_parts(152_294_000, 33395) + .saturating_add(T::DbWeight::get().reads(10_u64)) + .saturating_add(T::DbWeight::get().writes(9_u64)) } /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) - fn cancel_revoke_delegation() -> Weight { - // Proof Size summary in bytes: - // Measured: `298` - // Estimated: `5546` - // Minimum execution time: 27_681 nanoseconds. - Weight::from_parts(34_100_000, 5546) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: ParachainStaking DelegatorState (r:1 w:1) - /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) - /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) - fn cancel_delegator_bond_less() -> Weight { - // Proof Size summary in bytes: - // Measured: `298` - // Estimated: `5546` - // Minimum execution time: 34_470 nanoseconds. - Weight::from_parts(35_990_000, 5546) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + /// The range of component `x` is `[0, 349]`. + fn cancel_delegation_request(x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `663 + x * (42 ±0)` + // Estimated: `4092 + x * (43 ±0)` + // Minimum execution time: 30_062_000 picoseconds. + Weight::from_parts(37_242_991, 4092) + // Standard Error: 767 + .saturating_add(Weight::from_parts(62_995, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 43).saturating_mul(x.into())) } /// Storage: ParachainStaking Points (r:1 w:0) /// Proof Skipped: ParachainStaking Points (max_values: None, max_size: None, mode: Measured) @@ -541,19 +598,19 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Storage: ParachainStaking ParachainBondInfo (r:1 w:0) /// Proof Skipped: ParachainStaking ParachainBondInfo (max_values: Some(1), max_size: None, mode: Measured) /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) /// Storage: ParachainStaking CollatorCommission (r:1 w:0) /// Proof Skipped: ParachainStaking CollatorCommission (max_values: Some(1), max_size: None, mode: Measured) /// Storage: ParachainStaking DelayedPayouts (r:0 w:1) /// Proof Skipped: ParachainStaking DelayedPayouts (max_values: None, max_size: None, mode: Measured) fn prepare_staking_payouts() -> Weight { // Proof Size summary in bytes: - // Measured: `438` - // Estimated: `11670` - // Minimum execution time: 57_220 nanoseconds. - Weight::from_parts(58_131_000, 11670) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) + // Measured: `380` + // Estimated: `3845` + // Minimum execution time: 48_260_000 picoseconds. + Weight::from_parts(49_856_000, 3845) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:0) /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) @@ -562,14 +619,14 @@ impl pallet_parachain_staking::weights::WeightInfo for /// The range of component `y` is `[0, 100]`. fn get_rewardable_delegators(y: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `118 + y * (48 ±0)` - // Estimated: `5180 + y * (96 ±0)` - // Minimum execution time: 9_370 nanoseconds. - Weight::from_parts(11_359_043, 5180) - // Standard Error: 1_783 - .saturating_add(Weight::from_parts(143_685, 0).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(Weight::from_parts(0, 96).saturating_mul(y.into())) + // Measured: `73 + y * (36 ±0)` + // Estimated: `3537 + y * (36 ±0)` + // Minimum execution time: 8_183_000 picoseconds. + Weight::from_parts(10_416_160, 3537) + // Standard Error: 780 + .saturating_add(Weight::from_parts(44_865, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(y.into())) } /// Storage: ParachainStaking TotalSelected (r:1 w:0) /// Proof Skipped: ParachainStaking TotalSelected (max_values: Some(1), max_size: None, mode: Measured) @@ -591,20 +648,61 @@ impl pallet_parachain_staking::weights::WeightInfo for /// The range of component `y` is `[0, 100]`. fn select_top_candidates(x: u32, y: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + x * (5122 ±0) + y * (2400 ±0)` - // Estimated: `13898 + x * (26124 ±53) + y * (6816 ±26)` - // Minimum execution time: 37_410 nanoseconds. - Weight::from_parts(37_950_000, 13898) - // Standard Error: 177_349 - .saturating_add(Weight::from_parts(30_156_055, 0).saturating_mul(x.into())) - // Standard Error: 88_439 - .saturating_add(Weight::from_parts(2_943_699, 0).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Measured: `0 + x * (3816 ±0) + y * (1800 ±0)` + // Estimated: `3730 + x * (3975 ±39) + y * (639 ±19)` + // Minimum execution time: 31_870_000 picoseconds. + Weight::from_parts(32_158_000, 3730) + // Standard Error: 51_554 + .saturating_add(Weight::from_parts(22_540_635, 0).saturating_mul(x.into())) + // Standard Error: 25_709 + .saturating_add(Weight::from_parts(957_745, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(x.into()))) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x.into()))) - .saturating_add(Weight::from_parts(0, 26124).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 6816).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3975).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 639).saturating_mul(y.into())) + } + /// Storage: System Account (r:349 w:349) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: ParachainStaking DelegatorState (r:349 w:349) + /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:0) + /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) + /// Storage: Balances Locks (r:349 w:349) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:349 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) + /// Storage: ParachainStaking CandidateInfo (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking TopDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidatePool (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking Total (r:1 w:1) + /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking BottomDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking BottomDelegations (max_values: None, max_size: None, mode: Measured) + /// The range of component `x` is `[0, 349]`. + /// The range of component `y` is `[0, 349]`. + /// The range of component `z` is `[0, 349]`. + fn pay_one_collator_reward_best(x: u32, y: u32, z: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + x * (395 ±0) + y * (156 ±0) + z * (41 ±0)` + // Estimated: `125757 + x * (2591 ±19) + y * (2234 ±19) + z * (28 ±0)` + // Minimum execution time: 459_000 picoseconds. + Weight::from_parts(472_000, 125757) + // Standard Error: 685_607 + .saturating_add(Weight::from_parts(74_007_162, 0).saturating_mul(x.into())) + // Standard Error: 685_607 + .saturating_add(Weight::from_parts(43_825_857, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(y.into()))) + .saturating_add(Weight::from_parts(0, 2591).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2234).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 28).saturating_mul(z.into())) } /// Storage: ParachainStaking DelayedPayouts (r:1 w:0) /// Proof Skipped: ParachainStaking DelayedPayouts (max_values: None, max_size: None, mode: Measured) @@ -614,29 +712,33 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Proof Skipped: ParachainStaking AtStake (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking AwardedPts (r:1 w:1) /// Proof Skipped: ParachainStaking AwardedPts (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:0) + /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) + /// Storage: MoonbeamOrbiters OrbiterPerRound (r:1 w:0) + /// Proof Skipped: MoonbeamOrbiters OrbiterPerRound (max_values: None, max_size: None, mode: Measured) /// Storage: System Account (r:301 w:301) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) /// The range of component `y` is `[0, 300]`. fn pay_one_collator_reward(y: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `485 + y * (219 ±0)` - // Estimated: `16898 + y * (3483 ±0)` - // Minimum execution time: 67_041 nanoseconds. - Weight::from_parts(50_795_146, 16898) - // Standard Error: 39_567 - .saturating_add(Weight::from_parts(21_634_242, 0).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Measured: `1208 + y * (160 ±0)` + // Estimated: `6978 + y * (2591 ±0)` + // Minimum execution time: 65_428_000 picoseconds. + Weight::from_parts(68_535_135, 6978) + // Standard Error: 6_093 + .saturating_add(Weight::from_parts(25_186_464, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(y.into()))) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(y.into()))) - .saturating_add(Weight::from_parts(0, 3483).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 2591).saturating_mul(y.into())) } fn base_on_initialize() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_940 nanoseconds. - Weight::from_parts(2_240_000, 0) + // Minimum execution time: 2_024_000 picoseconds. + Weight::from_parts(2_168_000, 0) } /// Storage: ParachainStaking DelegatorState (r:1 w:0) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) @@ -646,21 +748,21 @@ impl pallet_parachain_staking::weights::WeightInfo for /// The range of component `y` is `[0, 100]`. fn set_auto_compound(x: u32, y: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `718 + x * (34 ±0) + y * (48 ±0)` - // Estimated: `6134 + x * (70 ±0) + y * (98 ±0)` - // Minimum execution time: 45_920 nanoseconds. - Weight::from_parts(57_096_271, 6134) - // Standard Error: 899 - .saturating_add(Weight::from_parts(84_579, 0).saturating_mul(x.into())) - // Standard Error: 2_691 - .saturating_add(Weight::from_parts(64_670, 0).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 70).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 98).saturating_mul(y.into())) + // Measured: `671 + x * (22 ±0) + y * (36 ±0)` + // Estimated: `4027 + x * (23 ±0) + y * (36 ±0)` + // Minimum execution time: 34_494_000 picoseconds. + Weight::from_parts(33_677_881, 4027) + // Standard Error: 278 + .saturating_add(Weight::from_parts(45_734, 0).saturating_mul(x.into())) + // Standard Error: 833 + .saturating_add(Weight::from_parts(39_753, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_parts(0, 23).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(y.into())) } /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) /// Storage: ParachainStaking DelegatorState (r:1 w:1) /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) /// Storage: ParachainStaking CandidateInfo (r:1 w:1) @@ -674,7 +776,9 @@ impl pallet_parachain_staking::weights::WeightInfo for /// Storage: ParachainStaking CandidatePool (r:1 w:1) /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) /// Storage: ParachainStaking Total (r:1 w:1) /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) /// The range of component `x` is `[0, 350]`. @@ -682,31 +786,86 @@ impl pallet_parachain_staking::weights::WeightInfo for /// The range of component `z` is `[0, 99]`. fn delegate_with_auto_compound(x: u32, y: u32, z: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + x * (84 ±0) + y * (33 ±0) + z * (114 ±0)` - // Estimated: `127262 + x * (367 ±0) + y * (73 ±0) + z * (230 ±1)` - // Minimum execution time: 120_201 nanoseconds. - Weight::from_parts(118_425_126, 127262) - // Standard Error: 2_407 - .saturating_add(Weight::from_parts(242_420, 0).saturating_mul(x.into())) - // Standard Error: 2_413 - .saturating_add(Weight::from_parts(48_797, 0).saturating_mul(y.into())) - // Standard Error: 8_501 - .saturating_add(Weight::from_parts(281_230, 0).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(8)) - .saturating_add(Weight::from_parts(0, 367).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 73).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 230).saturating_mul(z.into())) + // Measured: `0 + x * (60 ±0) + y * (21 ±0) + z * (78 ±0)` + // Estimated: `26253 + x * (44 ±0) + y * (19 ±0) + z * (76 ±1)` + // Minimum execution time: 130_103_000 picoseconds. + Weight::from_parts(116_616_415, 26253) + // Standard Error: 1_141 + .saturating_add(Weight::from_parts(117_041, 0).saturating_mul(x.into())) + // Standard Error: 4_030 + .saturating_add(Weight::from_parts(178_483, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + .saturating_add(Weight::from_parts(0, 44).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 19).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 76).saturating_mul(z.into())) + } + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: ParachainStaking DelegatorState (r:2 w:2) + /// Proof Skipped: ParachainStaking DelegatorState (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidateInfo (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking AutoCompoundingDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking TopDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking BottomDelegations (r:1 w:1) + /// Proof Skipped: ParachainStaking BottomDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: Balances Locks (r:2 w:2) + /// Proof: Balances Locks (max_values: None, max_size: Some(1287), added: 3762, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:2 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(37), added: 2512, mode: MaxEncodedLen) + /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) + /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidatePool (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking Total (r:1 w:1) + /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) + fn delegate_with_auto_compound_worst() -> Weight { + // Proof Size summary in bytes: + // Measured: `48167` + // Estimated: `54107` + // Minimum execution time: 276_584_000 picoseconds. + Weight::from_parts(279_594_000, 54107) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) } /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) fn mint_collator_reward() -> Weight { // Proof Size summary in bytes: - // Measured: `139` - // Estimated: `2607` - // Minimum execution time: 23_320 nanoseconds. - Weight::from_parts(28_710_000, 2607) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `128` + // Estimated: `3581` + // Minimum execution time: 28_741_000 picoseconds. + Weight::from_parts(29_344_000, 3581) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: ParachainStaking EnableMarkingOffline (r:1 w:0) + /// Proof Skipped: ParachainStaking EnableMarkingOffline (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking TotalSelected (r:1 w:0) + /// Proof Skipped: ParachainStaking TotalSelected (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking SelectedCandidates (r:1 w:0) + /// Proof Skipped: ParachainStaking SelectedCandidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking AtStake (r:2 w:0) + /// Proof Skipped: ParachainStaking AtStake (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking AwardedPts (r:2 w:0) + /// Proof Skipped: ParachainStaking AwardedPts (max_values: None, max_size: None, mode: Measured) + /// Storage: MoonbeamOrbiters OrbiterPerRound (r:1 w:0) + /// Proof Skipped: MoonbeamOrbiters OrbiterPerRound (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidateInfo (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidatePool (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) + fn notify_inactive_collator() -> Weight { + // Proof Size summary in bytes: + // Measured: `11494` + // Estimated: `17434` + // Minimum execution time: 41_130_000 picoseconds. + Weight::from_parts(41_130_000, 0) + .saturating_add(Weight::from_parts(0, 17434)) + .saturating_add(T::DbWeight::get().reads(10_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } } diff --git a/runtime/zeitgeist/Cargo.toml b/runtime/zeitgeist/Cargo.toml index 9765f65be..c53c48831 100644 --- a/runtime/zeitgeist/Cargo.toml +++ b/runtime/zeitgeist/Cargo.toml @@ -97,6 +97,7 @@ orml-asset-registry = { workspace = true, optional = true } orml-unknown-tokens = { workspace = true, optional = true } orml-xcm-support = { workspace = true, optional = true } orml-xtokens = { workspace = true, optional = true } +pallet-message-queue = { workspace = true, optional = true } pallet-xcm = { workspace = true, optional = true } polkadot-runtime = { workspace = true, optional = true } polkadot-runtime-parachains = { workspace = true, optional = true } @@ -126,6 +127,7 @@ zrml-swaps = { workspace = true } zrml-swaps-runtime-api = { workspace = true } [dev-dependencies] +env_logger = { workspace = true } sp-io = { workspace = true, features = ["default"] } test-case = { workspace = true } xcm-simulator = { workspace = true } @@ -163,6 +165,7 @@ parachain = [ "orml-unknown-tokens", "orml-xcm-support", "orml-xtokens", + "pallet-message-queue", "pallet-xcm", "xcm-builder", "xcm-executor", @@ -246,6 +249,7 @@ std = [ "pallet-democracy/std", "pallet-identity/std", "pallet-membership/std", + "pallet-message-queue?/std", "pallet-multisig/std", "pallet-preimage/std", "pallet-proxy/std", @@ -340,7 +344,6 @@ try-runtime = [ "frame-try-runtime/try-runtime", # For every pallet in the runtime include try-runtime - # System runtime pallets "frame-support/try-runtime", "frame-system/try-runtime", @@ -411,13 +414,16 @@ try-runtime = [ "cumulus-pallet-xcm?/try-runtime", "cumulus-pallet-xcmp-queue?/try-runtime", "parachain-info?/try-runtime", + + # Polkadot + "polkadot-runtime?/try-runtime", ] # Allow to print logs details (no wasm:stripped) force-debug = ["sp-debug-derive/force-debug"] [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zeitgeist-runtime" version = "0.5.2" diff --git a/runtime/zeitgeist/src/integration_tests/xcm/setup.rs b/runtime/zeitgeist/src/integration_tests/xcm/setup.rs index 525a2e369..ba1433fef 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/setup.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/setup.rs @@ -18,11 +18,12 @@ use crate::{ xcm_config::config::{general_key, zeitgeist}, - AccountId, AssetRegistry, Assets, Balance, ExistentialDeposit, Runtime, RuntimeOrigin, System, + AccountId, AssetRegistry, AssetRegistryStringLimit, Assets, Balance, ExistentialDeposit, + Runtime, RuntimeOrigin, System, }; -use frame_support::{assert_ok, traits::GenesisBuild}; +use frame_support::assert_ok; use orml_traits::asset_registry::AssetMetadata; -use sp_runtime::AccountId32; +use sp_runtime::{AccountId32, BuildStorage}; use xcm::{ latest::{Junction::Parachain, Junctions::X2, MultiLocation}, VersionedMultiLocation, @@ -32,11 +33,12 @@ use zeitgeist_primitives::types::{CustomMetadata, XcmAsset}; pub(super) struct ExtBuilder { balances: Vec<(AccountId, Assets, Balance)>, parachain_id: u32, + safe_xcm_version: Option, } impl Default for ExtBuilder { fn default() -> Self { - Self { balances: vec![], parachain_id: zeitgeist::ID } + Self { balances: vec![], parachain_id: zeitgeist::ID, safe_xcm_version: None } } } @@ -51,9 +53,15 @@ impl ExtBuilder { self } + pub fn with_safe_xcm_version(mut self, safe_xcm_version: u32) -> Self { + self.safe_xcm_version = Some(safe_xcm_version); + self + } + pub fn build(self) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let native_currency_id = Assets::Ztg; + pallet_balances::GenesisConfig:: { balances: self .balances @@ -79,16 +87,18 @@ impl ExtBuilder { .assimilate_storage(&mut t) .unwrap(); - >::assimilate_storage( - ¶chain_info::GenesisConfig { parachain_id: self.parachain_id.into() }, - &mut t, - ) + parachain_info::GenesisConfig:: { + _config: Default::default(), + parachain_id: self.parachain_id.into(), + } + .assimilate_storage(&mut t) .unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, - &mut t, - ) + pallet_xcm::GenesisConfig:: { + _config: Default::default(), + safe_xcm_version: self.safe_xcm_version, + } + .assimilate_storage(&mut t) .unwrap(); let mut ext = sp_io::TestExternalities::new(t); @@ -169,10 +179,10 @@ pub(super) fn foreign_parent_multilocation() -> MultiLocation { pub(super) fn register_foreign_ztg(additional_meta: Option) { // Register ZTG as foreign asset. - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 10, - name: "Zeitgeist".into(), - symbol: "ZTG".into(), + name: "Zeitgeist".as_bytes().to_vec().try_into().unwrap(), + symbol: "ZTG".as_bytes().to_vec().try_into().unwrap(), existential_deposit: ExistentialDeposit::get(), location: Some(VersionedMultiLocation::V3(foreign_ztg_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -182,10 +192,10 @@ pub(super) fn register_foreign_ztg(additional_meta: Option) { } pub(super) fn register_btc(additional_meta: Option) { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 8, - name: "Bitcoin".into(), - symbol: "BTC".into(), + name: "Bitcoin".as_bytes().to_vec().try_into().unwrap(), + symbol: "BTC".as_bytes().to_vec().try_into().unwrap(), existential_deposit: ExistentialDeposit::get(), location: Some(VersionedMultiLocation::V3(foreign_sibling_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -195,10 +205,10 @@ pub(super) fn register_btc(additional_meta: Option) { } pub(super) fn register_eth(additional_meta: Option) { - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 18, - name: "Ethereum".into(), - symbol: "ETH".into(), + name: "Ethereum".as_bytes().to_vec().try_into().unwrap(), + symbol: "ETH".as_bytes().to_vec().try_into().unwrap(), existential_deposit: ExistentialDeposit::get(), location: Some(VersionedMultiLocation::V3(foreign_sibling_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -209,10 +219,10 @@ pub(super) fn register_eth(additional_meta: Option) { pub(super) fn register_foreign_sibling(additional_meta: Option) { // Register native Sibling token as foreign asset. - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 10, - name: "Sibling".into(), - symbol: "SBL".into(), + name: "Sibling".as_bytes().to_vec().try_into().unwrap(), + symbol: "SBL".as_bytes().to_vec().try_into().unwrap(), existential_deposit: ExistentialDeposit::get(), location: Some(VersionedMultiLocation::V3(foreign_sibling_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -227,10 +237,10 @@ pub(super) fn register_foreign_sibling(additional_meta: Option) pub(super) fn register_foreign_parent(additional_meta: Option) { // Register dot as foreign asset in the sibling parachain - let meta: AssetMetadata = AssetMetadata { + let meta: AssetMetadata = AssetMetadata { decimals: 10, - name: "Polkadot".into(), - symbol: "DOT".into(), + name: "Polkadot".as_bytes().to_vec().try_into().unwrap(), + symbol: "DOT".as_bytes().to_vec().try_into().unwrap(), existential_deposit: 10_000_000_000, // 1 location: Some(VersionedMultiLocation::V3(foreign_parent_multilocation())), additional: additional_meta.unwrap_or_default(), @@ -253,5 +263,5 @@ pub(super) fn zeitgeist_parachain_account() -> AccountId { fn parachain_account(id: u32) -> AccountId { use sp_runtime::traits::AccountIdConversion; - polkadot_parachain::primitives::Sibling::from(id).into_account_truncating() + polkadot_parachain_primitives::primitives::Sibling::from(id).into_account_truncating() } diff --git a/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs b/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs index c8f212d12..6558aa0da 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs @@ -17,20 +17,23 @@ // along with Zeitgeist. If not, see . use crate::{ - parameters::ZeitgeistTreasuryAccount, xcm_config::config::zeitgeist, Assets, DmpQueue, Runtime, - RuntimeOrigin, XcmpQueue, + parameters::ZeitgeistTreasuryAccount, xcm_config::config::zeitgeist, Assets, DmpQueue, + XcmpQueue, }; -use frame_support::{traits::GenesisBuild, weights::Weight}; -use polkadot_primitives::v2::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE}; use polkadot_runtime_parachains::configuration::HostConfiguration; -use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain}; +use sp_runtime::BuildStorage; +use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; use super::setup::{dot, ztg, ExtBuilder, ALICE, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; decl_test_relay_chain! { pub struct PolkadotNet { Runtime = polkadot_runtime::Runtime, - XcmConfig = polkadot_runtime::xcm_config::XcmConfig, + RuntimeCall = polkadot_runtime::RuntimeCall, + RuntimeEvent = polkadot_runtime::RuntimeEvent, + XcmConfig = polkadot_runtime::XcmConfig, + MessageQueue = polkadot_runtime::MessageQueue, + System = polkadot_runtime::System, new_ext = relay_ext(), } } @@ -38,7 +41,6 @@ decl_test_relay_chain! { decl_test_parachain! { pub struct Zeitgeist { Runtime = Runtime, - RuntimeOrigin = RuntimeOrigin, XcmpMessageHandler = XcmpQueue, DmpMessageHandler = DmpQueue, new_ext = para_ext(zeitgeist::ID), @@ -48,7 +50,6 @@ decl_test_parachain! { decl_test_parachain! { pub struct Sibling { Runtime = Runtime, - RuntimeOrigin = RuntimeOrigin, XcmpMessageHandler = XcmpQueue, DmpMessageHandler = DmpQueue, new_ext = para_ext(PARA_ID_SIBLING), @@ -73,23 +74,21 @@ decl_test_network! { pub(super) fn relay_ext() -> sp_io::TestExternalities { use polkadot_runtime::{Runtime, System}; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(ALICE, dot(2002))] } .assimilate_storage(&mut t) .unwrap(); polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: default_parachains_host_configuration(), + config: mock_relay_config(), } .assimilate_storage(&mut t) .unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, - &mut t, - ) - .unwrap(); + pallet_xcm::GenesisConfig:: { _config: Default::default(), safe_xcm_version: Some(2) } + .assimilate_storage(&mut t) + .unwrap(); let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); @@ -97,6 +96,8 @@ pub(super) fn relay_ext() -> sp_io::TestExternalities { } pub(super) fn para_ext(parachain_id: u32) -> sp_io::TestExternalities { + let _ = env_logger::builder().is_test(true).try_init(); + ExtBuilder::default() .set_balances(vec![ (ALICE, Assets::Ztg, ztg(10)), @@ -104,43 +105,19 @@ pub(super) fn para_ext(parachain_id: u32) -> sp_io::TestExternalities { (ZeitgeistTreasuryAccount::get(), FOREIGN_PARENT_ID.into(), dot(10)), ]) .set_parachain_id(parachain_id) + .with_safe_xcm_version(2) .build() } -fn default_parachains_host_configuration() -> HostConfiguration { - HostConfiguration { - minimum_validation_upgrade_delay: 5, - validation_upgrade_cooldown: 5u32, - validation_upgrade_delay: 5, - code_retention_period: 1200, - max_code_size: MAX_CODE_SIZE, - max_pov_size: MAX_POV_SIZE, - max_head_data_size: 32 * 1024, - group_rotation_frequency: 20, - chain_availability_period: 4, - thread_availability_period: 4, - max_upward_queue_count: 8, - max_upward_queue_size: 1024 * 1024, - max_downward_message_size: 1024, - ump_service_total_weight: Weight::from_ref_time(4_u64 * 1_000_000_000_u64), - max_upward_message_size: 50 * 1024, - max_upward_message_num_per_candidate: 5, - hrmp_sender_deposit: 0, - hrmp_recipient_deposit: 0, - hrmp_channel_max_capacity: 8, - hrmp_channel_max_total_size: 8 * 1024, - hrmp_max_parachain_inbound_channels: 4, - hrmp_max_parathread_inbound_channels: 4, - hrmp_channel_max_message_size: 1024 * 1024, - hrmp_max_parachain_outbound_channels: 4, - hrmp_max_parathread_outbound_channels: 4, - hrmp_max_message_num_per_candidate: 5, - dispute_period: 6, - no_show_slots: 2, - n_delay_tranches: 25, - needed_approvals: 2, - relay_vrf_modulo_samples: 2, - zeroth_delay_tranche_width: 0, +pub fn mock_relay_config() -> HostConfiguration { + HostConfiguration:: { + hrmp_channel_max_capacity: u32::MAX, + hrmp_channel_max_total_size: u32::MAX, + hrmp_max_parachain_inbound_channels: 10, + hrmp_max_parachain_outbound_channels: 10, + hrmp_channel_max_message_size: u32::MAX, + // Changed to avoid aritmetic errors within hrmp_close + max_downward_message_size: 100_000u32, ..Default::default() } } diff --git a/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs b/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs index d23021334..27f8c94fa 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs @@ -29,28 +29,32 @@ use crate::{ Assets, CustomMetadata, ScalarPosition, XcmAsset, }; use core::fmt::Debug; -use frame_support::assert_err; -use sp_runtime::traits::Convert as C2; +use sp_runtime::traits::{Convert, MaybeEquivalence}; use test_case::test_case; use xcm::latest::{Junction::*, Junctions::*, MultiLocation}; -use xcm_emulator::TestExt; -use xcm_executor::traits::Convert as C1; +use xcm_simulator::TestExt; fn convert_common_native(expected: T) where T: Copy + Debug + PartialEq, - AssetConvert: C1 + C2>, + AssetConvert: MaybeEquivalence + Convert>, { assert_eq!(zeitgeist::KEY.to_vec(), vec![0, 1]); // The way Ztg is represented relative within the Zeitgeist runtime let ztg_location_inner: MultiLocation = MultiLocation::new(0, X1(general_key(zeitgeist::KEY))); - assert_eq!(>::convert(ztg_location_inner), Ok(expected)); + assert_eq!( + >::convert(&ztg_location_inner), + Some(expected) + ); // The canonical way Ztg is represented out in the wild Zeitgeist::execute_with(|| { - assert_eq!(>::convert(expected), Some(foreign_ztg_multilocation())) + assert_eq!( + >::convert(expected), + Some(foreign_ztg_multilocation()) + ) }); } @@ -60,15 +64,18 @@ fn convert_common_non_native( register: fn(Option), ) where T: Copy + Debug + PartialEq, - AssetConvert: C1 + C2>, + AssetConvert: MaybeEquivalence + Convert>, { Zeitgeist::execute_with(|| { - assert_err!(>::convert(multilocation), multilocation); - assert_eq!(>::convert(expected), None); + assert_eq!(>::convert(&multilocation), None); + assert_eq!(>::convert(expected), None); // Register parent as foreign asset in the Zeitgeist parachain register(None); - assert_eq!(>::convert(multilocation), Ok(expected)); - assert_eq!(>::convert(expected), Some(multilocation)); + assert_eq!( + >::convert(&multilocation), + Some(expected) + ); + assert_eq!(>::convert(expected), Some(multilocation)); }); } @@ -124,7 +131,9 @@ fn convert_unkown_multilocation() { MultiLocation::new(1, X2(Parachain(zeitgeist::ID), general_key(&[42]))); Zeitgeist::execute_with(|| { - assert!(>::convert(unknown_location).is_err()); + assert!( + >::convert(&unknown_location).is_none() + ); }); } @@ -163,7 +172,7 @@ fn convert_unkown_multilocation() { fn convert_unsupported_asset(asset: T) where T: Copy + Debug + PartialEq, - AssetConvert: C2>, + AssetConvert: Convert>, { - Zeitgeist::execute_with(|| assert_eq!(>::convert(asset), None)); + Zeitgeist::execute_with(|| assert_eq!(>::convert(asset), None)); } diff --git a/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs b/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs index bb5d66e3a..13fca9797 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs @@ -30,10 +30,10 @@ use crate::{ ZeitgeistTreasuryAccount, }; -use frame_support::assert_ok; +use frame_support::{assert_ok, traits::tokens::fungible::Mutate}; use orml_traits::MultiCurrency; use xcm::latest::{Junction, Junction::*, Junctions::*, MultiLocation, WeightLimit}; -use xcm_emulator::TestExt; +use xcm_simulator::TestExt; use zeitgeist_primitives::{ constants::{BalanceFractionalDecimals, BASE}, types::{CustomMetadata, XcmAsset, XcmMetadata}, @@ -192,12 +192,10 @@ fn transfer_btc_sibling_to_zeitgeist() { Sibling::execute_with(|| { assert_eq!(Balances::free_balance(&ALICE), sibling_alice_initial_balance); // Set the sovereign balance such that it is not subject to dust collection - assert_ok!(Balances::set_balance( - RuntimeOrigin::root(), - zeitgeist_parachain_account().into(), - initial_sovereign_balance, - 0 - )); + assert_eq!( + Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), + initial_sovereign_balance + ); assert_ok!(XTokens::transfer( RuntimeOrigin::signed(ALICE), // Target chain will interpret XcmAsset::Ztg as BTC in this context. @@ -318,19 +316,15 @@ fn transfer_eth_sibling_to_zeitgeist() { Sibling::execute_with(|| { // Set the sovereign balance such that it is not subject to dust collection - assert_ok!(Balances::set_balance( - RuntimeOrigin::root(), - zeitgeist_parachain_account().into(), - initial_sovereign_balance, - 0 - )); + assert_eq!( + Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), + initial_sovereign_balance + ); // Add 1 "fake" ETH to Alice's balance - assert_ok!(Balances::set_balance( - RuntimeOrigin::root(), - ALICE.into(), - sibling_alice_initial_balance, - 0 - )); + assert_eq!( + Balances::set_balance(&ALICE, sibling_alice_initial_balance,), + sibling_alice_initial_balance + ); assert_ok!(XTokens::transfer( RuntimeOrigin::signed(ALICE), // Target chain will interpret XcmAsset::Ztg as ETH in this context. @@ -571,7 +565,7 @@ fn transfer_ztg_to_sibling_with_custom_fee() { #[test] fn test_total_fee() { - assert_eq!(ztg_fee(), 80_128_000); + assert_eq!(ztg_fee(), 64_296_000); assert_eq!(dot_fee(), ztg_fee()); } diff --git a/runtime/zeitgeist/src/lib.rs b/runtime/zeitgeist/src/lib.rs index 4fcde1f80..e655c5c35 100644 --- a/runtime/zeitgeist/src/lib.rs +++ b/runtime/zeitgeist/src/lib.rs @@ -17,7 +17,7 @@ // along with Zeitgeist. If not, see . #![cfg_attr(not(feature = "std"), no_std)] -#![recursion_limit = "512"] +#![recursion_limit = "1024"] extern crate alloc; @@ -68,11 +68,10 @@ use { use frame_support::construct_runtime; -use sp_api::impl_runtime_apis; +use sp_api::{impl_runtime_apis, BlockT}; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, - traits::Block as BlockT, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; @@ -117,7 +116,7 @@ impl Contains for IsCallable { }; use orml_currencies::Call::update_balance; use pallet_assets::Call::{destroy_accounts, destroy_approvals, finish_destroy}; - use pallet_balances::Call::{force_transfer, set_balance}; + use pallet_balances::Call::{force_set_balance, force_transfer}; use pallet_collective::Call::set_members; use pallet_contracts::Call::{ call, call_old_weight, instantiate, instantiate_old_weight, remove_code, @@ -144,7 +143,7 @@ impl Contains for IsCallable { // in case something goes terribly wrong (like a hack that draws the funds // from such an account, see Maganta hack). Invoking this function one can // also easily mess up consistency in regards to reserved tokens and locks. - set_balance { .. } => false, + force_set_balance { .. } => false, // There should be no reason to force an account to transfer funds. force_transfer { .. } => false, _ => true, diff --git a/runtime/zeitgeist/src/parachain_params.rs b/runtime/zeitgeist/src/parachain_params.rs index c08bd8549..598488d90 100644 --- a/runtime/zeitgeist/src/parachain_params.rs +++ b/runtime/zeitgeist/src/parachain_params.rs @@ -38,6 +38,9 @@ use zeitgeist_primitives::{ }; parameter_types! { + // Asset registry + pub const AssetRegistryStringLimit: u32 = 1024; + // Author-Mapping /// The amount that should be taken as a security deposit when registering a NimbusId pub const CollatorDeposit: Balance = 2 * BASE; @@ -67,22 +70,30 @@ parameter_types! { pub const LeaveDelegatorsDelay: u32 = 2; /// Maximum bottom delegations per candidate pub const MaxBottomDelegationsPerCandidate: u32 = 50; + /// Maximum number of collator candidates + pub const MaxCandidates: u32 = 200; /// Maximum delegations per delegator pub const MaxDelegationsPerDelegator: u32 = 100; /// Maximum top delegations per candidate pub const MaxTopDelegationsPerCandidate: u32 = 300; + /// Number of rounds until a collator not producing blocks is marked as inactive. + pub const MaxOfflineRounds: u32 = 1; /// Minimum round length is 2 minutes pub const MinBlocksPerRound: u32 = 2 * BLOCKS_PER_MINUTE as u32; /// Minimum stake required to become a collator - pub const MinCollatorStk: u128 = 64 * BASE; + pub const MinCandidateStk: u128 = 64 * BASE; /// Minimum stake required to be reserved to be a delegator - pub const MinDelegatorStk: u128 = BASE / 2; + pub const MinDelegation: u128 = BASE / 2; /// Minimum collators selected per round, default at genesis and minimum forever after pub const MinSelectedCandidates: u32 = 8; /// Rounds before the delegator revocation can be executed pub const RevokeDelegationDelay: u32 = 2; /// Rounds before the reward is paid pub const RewardPaymentDelay: u32 = 2; + /// The maximum number of local XCM locks that a single account may have. + pub const MaxLockers: u32 = 8; + /// The maximum number of consumers a single remote lock may have. + pub const MaxRemoteLockConsumers: u32 = 0; // XCM /// Base weight for XCM execution diff --git a/runtime/zeitgeist/src/parameters.rs b/runtime/zeitgeist/src/parameters.rs index a5c1eacf8..b3c88c8d3 100644 --- a/runtime/zeitgeist/src/parameters.rs +++ b/runtime/zeitgeist/src/parameters.rs @@ -47,7 +47,7 @@ use zeitgeist_primitives::{constants::*, types::*}; pub(crate) const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); pub(crate) const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - polkadot_primitives::v2::MAX_POV_SIZE as u64, + polkadot_primitives::MAX_POV_SIZE as u64, ); pub(crate) const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); pub(crate) const FEES_AND_TIPS_TREASURY_PERCENTAGE: u32 = 100; @@ -56,11 +56,13 @@ pub(crate) const FEES_AND_TIPS_BURN_PERCENTAGE: u32 = 0; #[cfg(not(feature = "parachain"))] parameter_types! { // Aura + pub const AllowMultipleBlocksPerSlot: bool = false; pub const MaxAuthorities: u32 = 32; // Grandpa // Can be 0, as equivocation handling is not enabled (HandleEquivocation = ()) pub const MaxSetIdSessionEntries: u32 = 0; + pub const MaxNominators: u32 = 0; } parameter_types! { @@ -120,23 +122,20 @@ parameter_types! { pub const CouncilMaxMembers: u32 = 100; pub const CouncilMaxProposals: u32 = 100; pub const CouncilMotionDuration: BlockNumber = 7 * BLOCKS_PER_DAY; + pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; pub const TechnicalCommitteeMaxMembers: u32 = 100; pub const TechnicalCommitteeMaxProposals: u32 = 64; pub const TechnicalCommitteeMotionDuration: BlockNumber = 7 * BLOCKS_PER_DAY; // Contracts - pub const ContractsDeletionQueueDepth: u32 = 128; - pub ContractsDeletionWeightLimit: Weight = Perbill::from_percent(10) - * RuntimeBlockWeights::get() - .per_class - .get(DispatchClass::Normal) - .max_total - .unwrap_or(RuntimeBlockWeights::get().max_block); + pub const ContractsCodeHashLockupDepositPercent: Perbill = Perbill::from_percent(10); + pub const ContractsDefaultDepositLimit: Balance = deposit(16, 16 * 1024); pub const ContractsDepositPerByte: Balance = deposit(0,1); pub const ContractsDepositPerItem: Balance = deposit(1,0); pub const ContractsMaxCodeLen: u32 = 123 * 1024; pub const ContractsMaxStorageKeyLen: u32 = 128; pub const ContractsMaxDebugBufferLen: u32 = 2 * 1024 * 1024; + pub const ContractsMaxDelegateDependencies: u32 = 32; pub const ContractsUnsafeUnstableInterface: bool = false; pub ContractsSchedule: pallet_contracts::Schedule = Default::default(); diff --git a/runtime/zeitgeist/src/xcm_config/asset_registry.rs b/runtime/zeitgeist/src/xcm_config/asset_registry.rs index 9deb85aa0..ab6c618a4 100644 --- a/runtime/zeitgeist/src/xcm_config/asset_registry.rs +++ b/runtime/zeitgeist/src/xcm_config/asset_registry.rs @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . -use crate::{Balance, XcmAsset}; +use crate::{AssetRegistryStringLimit, Balance, XcmAsset}; use orml_traits::asset_registry::{AssetMetadata, AssetProcessor}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; @@ -29,11 +29,16 @@ use zeitgeist_primitives::types::CustomMetadata; /// Only pre check is to ensure an asset id was passed. pub struct CustomAssetProcessor; -impl AssetProcessor> for CustomAssetProcessor { +impl AssetProcessor> + for CustomAssetProcessor +{ fn pre_register( id: Option, - metadata: AssetMetadata, - ) -> Result<(XcmAsset, AssetMetadata), DispatchError> { + metadata: AssetMetadata, + ) -> Result< + (XcmAsset, AssetMetadata), + DispatchError, + > { match id { Some(id) => Ok((id, metadata)), None => Err(DispatchError::Other("asset-registry: AssetId is required")), @@ -42,7 +47,7 @@ impl AssetProcessor> for Custom fn post_register( _id: XcmAsset, - _asset_metadata: AssetMetadata, + _asset_metadata: AssetMetadata, ) -> Result<(), DispatchError> { Ok(()) } diff --git a/runtime/zeitgeist/src/xcm_config/config.rs b/runtime/zeitgeist/src/xcm_config/config.rs index 27d6c1e54..4dd3acfff 100644 --- a/runtime/zeitgeist/src/xcm_config/config.rs +++ b/runtime/zeitgeist/src/xcm_config/config.rs @@ -36,8 +36,8 @@ use orml_xcm_support::{ DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset, }; use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; -use sp_runtime::traits::Convert; +use polkadot_parachain_primitives::primitives::Sibling; +use sp_runtime::traits::{ConstU32, Convert, MaybeEquivalence}; use xcm::{ latest::{ prelude::{AccountId32, AssetId, Concrete, GeneralKey, MultiAsset, XcmContext, X1, X2}, @@ -50,9 +50,9 @@ use xcm_builder::{ AllowTopLevelPaidExecutionFrom, FixedRateOfFungible, FixedWeightBounds, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeRevenue, - TakeWeightCredit, + TakeWeightCredit, WithComputedOrigin, }; -use xcm_executor::{traits::TransactAsset, Assets as ExecutorAssets, Config}; +use xcm_executor::{traits::TransactAsset, Assets as ExecutorAssets}; use zeitgeist_primitives::{constants::BalanceFractionalDecimals, types::XcmAsset}; pub mod zeitgeist { @@ -66,7 +66,10 @@ pub struct XcmConfig; /// The main XCM config /// This is where we configure the core of our XCM integrations: how tokens are transferred, /// how fees are calculated, what barriers we impose on incoming XCM messages, etc. -impl Config for XcmConfig { +impl xcm_executor::Config for XcmConfig { + /// A list of (Origin, Target) pairs allowing a given Origin to be substituted with its + /// corresponding Target pair. + type Aliasers = Nothing; /// Handler for exchanging assets. type AssetExchanger = (); /// The handler for when there is an instruction to claim assets. @@ -124,12 +127,18 @@ impl Config for XcmConfig { pub type Barrier = ( // Execution barrier that just takes max_weight from weight_credit TakeWeightCredit, - // Ensures that execution time is bought with BuyExecution instruction - AllowTopLevelPaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ); /// The means of purchasing weight credit for XCM execution. @@ -153,11 +162,10 @@ pub struct ToTreasury; impl TakeRevenue for ToTreasury { fn take_revenue(revenue: MultiAsset) { use orml_traits::MultiCurrency; - use xcm_executor::traits::Convert; if let MultiAsset { id: Concrete(location), fun: Fungible(_amount) } = revenue { - if let Ok(asset_id) = - >::convert(location) + if let Some(asset_id) = + >::convert(&location) { let adj_am = AlignedFractionalMultiAssetTransactor::adjust_fractional_places(&revenue).fun; @@ -348,88 +356,96 @@ pub struct AssetConvert; /// handle it on their side. impl Convert> for AssetConvert { fn convert(id: Assets) -> Option { - match id { - Assets::Ztg => Some(MultiLocation::new( - 1, - X2( - Junction::Parachain(ParachainInfo::parachain_id().into()), - general_key(zeitgeist::KEY), - ), - )), - Assets::ForeignAsset(_) => { - let asset = XcmAsset::try_from(id).ok()?; - AssetRegistry::multilocation(&asset).ok()? - } - _ => None, - } + >::convert_back(&id) + } +} + +impl Convert> for AssetConvert { + fn convert(location: MultiLocation) -> Option { + >::convert(&location) } } impl Convert> for AssetConvert { fn convert(id: XcmAsset) -> Option { - >>::convert(id.into()) + >::convert_back(&id) } } /// Convert an incoming `MultiLocation` into a `Asset` if possible. /// Here we need to know the canonical representation of all the tokens we handle in order to /// correctly convert their `MultiLocation` representation into our internal `Asset` type. -impl xcm_executor::traits::Convert for AssetConvert { - fn convert(location: MultiLocation) -> Result { +impl MaybeEquivalence for AssetConvert { + fn convert(location: &MultiLocation) -> Option { match location { MultiLocation { parents: 0, interior: X1(GeneralKey { data, length }) } => { - let key = &data[..data.len().min(length as usize)]; + let key = &data[..data.len().min(*length as usize)]; if key == zeitgeist::KEY { - return Ok(Assets::Ztg); + return Some(Assets::Ztg); } - Err(location) + None } MultiLocation { parents: 1, interior: X2(Junction::Parachain(para_id), GeneralKey { data, length }), } => { - let key = &data[..data.len().min(length as usize)]; + let key = &data[..data.len().min(*length as usize)]; - if para_id == u32::from(ParachainInfo::parachain_id()) { + if *para_id == u32::from(ParachainInfo::parachain_id()) { if key == zeitgeist::KEY { - return Ok(Assets::Ztg); + return Some(Assets::Ztg); } - return Err(location); + return None; } - AssetRegistry::location_to_asset_id(location).ok_or(location).map(|a| a.into()) + AssetRegistry::location_to_asset_id(location).map(|a| a.into()) + } + _ => AssetRegistry::location_to_asset_id(location).map(|a| a.into()), + } + } + + fn convert_back(id: &Assets) -> Option { + match id { + Assets::Ztg => Some(MultiLocation::new( + 1, + X2( + Junction::Parachain(ParachainInfo::parachain_id().into()), + general_key(zeitgeist::KEY), + ), + )), + Assets::ForeignAsset(_) => { + let asset = XcmAsset::try_from(*id).ok()?; + AssetRegistry::multilocation(&asset).ok()? } - _ => AssetRegistry::location_to_asset_id(location).ok_or(location).map(|a| a.into()), + _ => None, } } } -impl xcm_executor::traits::Convert for AssetConvert { - fn convert(location: MultiLocation) -> Result { - >::convert(location) - .and_then(|asset| asset.try_into().map_err(|_| location)) +impl MaybeEquivalence for AssetConvert { + fn convert(location: &MultiLocation) -> Option { + >::convert(&location) + .and_then(|asset| asset.try_into().ok()) + } + + fn convert_back(id: &XcmAsset) -> Option { + >::convert_back(&Assets::from(*id)) } } impl Convert> for AssetConvert { fn convert(asset: MultiAsset) -> Option { if let MultiAsset { id: Concrete(location), .. } = asset { - >::convert(location).ok() + >::convert(&location) } else { None } } } -impl Convert> for AssetConvert { - fn convert(location: MultiLocation) -> Option { - >::convert(location).ok() - } -} - pub struct AccountIdToMultiLocation; impl Convert for AccountIdToMultiLocation { diff --git a/zrml/asset-router/Cargo.toml b/zrml/asset-router/Cargo.toml index 3a264a4d2..c37c1f494 100644 --- a/zrml/asset-router/Cargo.toml +++ b/zrml/asset-router/Cargo.toml @@ -34,6 +34,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-asset-router" version = "0.4.1" diff --git a/zrml/asset-router/src/pallet_impl/balanced.rs b/zrml/asset-router/src/pallet_impl/balanced.rs new file mode 100644 index 000000000..2a55f30bc --- /dev/null +++ b/zrml/asset-router/src/pallet_impl/balanced.rs @@ -0,0 +1,24 @@ +// Copyright 2024 Forecasting Technologies LTD. +// +// This file is part of Zeitgeist. +// +// Zeitgeist 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. +// +// Zeitgeist 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 Zeitgeist. If not, see . + +use crate::pallet::*; +use frame_support::traits::tokens::fungibles::{Balanced, DecreaseIssuance, IncreaseIssuance}; + +impl Balanced for Pallet { + type OnDropCredit = DecreaseIssuance; + type OnDropDebt = IncreaseIssuance; +} diff --git a/zrml/asset-router/src/pallet_impl/mod.rs b/zrml/asset-router/src/pallet_impl/mod.rs index d0a94a1c7..6e6928d8c 100644 --- a/zrml/asset-router/src/pallet_impl/mod.rs +++ b/zrml/asset-router/src/pallet_impl/mod.rs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . +pub mod balanced; pub mod create; pub mod destroy; pub mod inspect; diff --git a/zrml/authorized/Cargo.toml b/zrml/authorized/Cargo.toml index c25afbea9..aa6655625 100644 --- a/zrml/authorized/Cargo.toml +++ b/zrml/authorized/Cargo.toml @@ -37,6 +37,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-authorized" version = "0.5.2" diff --git a/zrml/court/Cargo.toml b/zrml/court/Cargo.toml index e1a278cad..cc79a5433 100644 --- a/zrml/court/Cargo.toml +++ b/zrml/court/Cargo.toml @@ -47,6 +47,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-court" version = "0.5.2" diff --git a/zrml/global-disputes/Cargo.toml b/zrml/global-disputes/Cargo.toml index e93b1153f..b828dc30e 100644 --- a/zrml/global-disputes/Cargo.toml +++ b/zrml/global-disputes/Cargo.toml @@ -45,6 +45,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-global-disputes" version = "0.5.2" diff --git a/zrml/hybrid-router/Cargo.toml b/zrml/hybrid-router/Cargo.toml index 6cafcae80..07d238d0d 100644 --- a/zrml/hybrid-router/Cargo.toml +++ b/zrml/hybrid-router/Cargo.toml @@ -97,6 +97,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-hybrid-router" version = "0.5.2" diff --git a/zrml/hybrid-router/src/benchmarking.rs b/zrml/hybrid-router/src/benchmarking.rs index 24e7f5c7d..694958ec4 100644 --- a/zrml/hybrid-router/src/benchmarking.rs +++ b/zrml/hybrid-router/src/benchmarking.rs @@ -25,6 +25,7 @@ use crate::Pallet as HybridRouter; use crate::*; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v2::*; use frame_support::{ assert_ok, diff --git a/zrml/liquidity-mining/Cargo.toml b/zrml/liquidity-mining/Cargo.toml index 75783bf67..9f6886add 100644 --- a/zrml/liquidity-mining/Cargo.toml +++ b/zrml/liquidity-mining/Cargo.toml @@ -40,6 +40,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-liquidity-mining" version = "0.5.2" diff --git a/zrml/liquidity-mining/src/lib.rs b/zrml/liquidity-mining/src/lib.rs index bf20f998b..549b30764 100644 --- a/zrml/liquidity-mining/src/lib.rs +++ b/zrml/liquidity-mining/src/lib.rs @@ -51,8 +51,6 @@ mod pallet { }; use alloc::vec::Vec; use core::marker::PhantomData; - #[cfg(feature = "std")] - use frame_support::traits::BuildGenesisConfig; use frame_support::{ dispatch::DispatchResult, storage::{ @@ -60,7 +58,8 @@ mod pallet { with_transaction, }, traits::{ - Currency, ExistenceRequirement, Get, Hooks, IsType, StorageVersion, WithdrawReasons, + BuildGenesisConfig, Currency, ExistenceRequirement, Get, Hooks, IsType, StorageVersion, + WithdrawReasons, }, Blake2_128Concat, PalletId, Twox64Concat, }; diff --git a/zrml/market-commons/Cargo.toml b/zrml/market-commons/Cargo.toml index cc72f8c11..5ce9fd31d 100644 --- a/zrml/market-commons/Cargo.toml +++ b/zrml/market-commons/Cargo.toml @@ -32,6 +32,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-market-commons" version = "0.5.2" diff --git a/zrml/neo-swaps/Cargo.toml b/zrml/neo-swaps/Cargo.toml index 33e4a2b79..241e008fd 100644 --- a/zrml/neo-swaps/Cargo.toml +++ b/zrml/neo-swaps/Cargo.toml @@ -107,6 +107,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-neo-swaps" version = "0.5.2" diff --git a/zrml/neo-swaps/src/benchmarking.rs b/zrml/neo-swaps/src/benchmarking.rs index 0854e2e57..075fc85db 100644 --- a/zrml/neo-swaps/src/benchmarking.rs +++ b/zrml/neo-swaps/src/benchmarking.rs @@ -23,6 +23,7 @@ use crate::{ traits::{liquidity_shares_manager::LiquiditySharesManager, pool_operations::PoolOperations}, AssetOf, BalanceOf, MarketIdOf, Pallet as NeoSwaps, Pools, MIN_SPOT_PRICE, }; +use alloc::{vec, vec::Vec}; use core::{cell::Cell, iter, marker::PhantomData}; use frame_benchmarking::v2::*; use frame_support::{ diff --git a/zrml/orderbook/Cargo.toml b/zrml/orderbook/Cargo.toml index 0fe4dcc09..300476788 100644 --- a/zrml/orderbook/Cargo.toml +++ b/zrml/orderbook/Cargo.toml @@ -61,6 +61,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-orderbook" version = "0.5.2" diff --git a/zrml/orderbook/fuzz/Cargo.toml b/zrml/orderbook/fuzz/Cargo.toml index 4daed00cc..9c5071779 100644 --- a/zrml/orderbook/fuzz/Cargo.toml +++ b/zrml/orderbook/fuzz/Cargo.toml @@ -13,7 +13,7 @@ zrml-orderbook = { workspace = true, features = ["default", "mock"] } [package] authors = ["Automatically generated"] -edition = "2021" +edition.workspace = true name = "zrml-orderbook-fuzz" publish = false version = "0.0.0" diff --git a/zrml/parimutuel/Cargo.toml b/zrml/parimutuel/Cargo.toml index c41b92679..548f0d880 100644 --- a/zrml/parimutuel/Cargo.toml +++ b/zrml/parimutuel/Cargo.toml @@ -49,6 +49,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-parimutuel" version = "0.5.2" diff --git a/zrml/parimutuel/src/benchmarking.rs b/zrml/parimutuel/src/benchmarking.rs index a33561ec3..097d7ebc6 100644 --- a/zrml/parimutuel/src/benchmarking.rs +++ b/zrml/parimutuel/src/benchmarking.rs @@ -60,6 +60,7 @@ fn buy_asset( #[benchmarks] mod benchmarks { use super::*; + use alloc::vec; #[benchmark] fn buy() { diff --git a/zrml/prediction-markets/Cargo.toml b/zrml/prediction-markets/Cargo.toml index 61e4bef75..170205d39 100644 --- a/zrml/prediction-markets/Cargo.toml +++ b/zrml/prediction-markets/Cargo.toml @@ -98,6 +98,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-prediction-markets" version = "0.5.2" diff --git a/zrml/prediction-markets/fuzz/Cargo.toml b/zrml/prediction-markets/fuzz/Cargo.toml index 4f88a31d2..703a2f229 100644 --- a/zrml/prediction-markets/fuzz/Cargo.toml +++ b/zrml/prediction-markets/fuzz/Cargo.toml @@ -15,7 +15,7 @@ zrml-simple-disputes = { workspace = true, features = ["default"] } [package] authors = ["Automatically generated"] -edition = "2021" +edition.workspace = true name = "zrml-prediction-markets-fuzz" publish = false version = "0.0.0" diff --git a/zrml/prediction-markets/runtime-api/Cargo.toml b/zrml/prediction-markets/runtime-api/Cargo.toml index 16d8f1b48..4e914db2e 100644 --- a/zrml/prediction-markets/runtime-api/Cargo.toml +++ b/zrml/prediction-markets/runtime-api/Cargo.toml @@ -13,6 +13,6 @@ std = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-prediction-markets-runtime-api" version = "0.5.2" diff --git a/zrml/rikiddo/Cargo.toml b/zrml/rikiddo/Cargo.toml index 64947e298..f6187b517 100644 --- a/zrml/rikiddo/Cargo.toml +++ b/zrml/rikiddo/Cargo.toml @@ -42,6 +42,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-rikiddo" version = "0.5.2" diff --git a/zrml/rikiddo/fuzz/Cargo.toml b/zrml/rikiddo/fuzz/Cargo.toml index 0f9f597bc..aa397bbac 100644 --- a/zrml/rikiddo/fuzz/Cargo.toml +++ b/zrml/rikiddo/fuzz/Cargo.toml @@ -80,7 +80,7 @@ zrml-rikiddo = { workspace = true, features = ["arbitrary", "mock", "default"] } [package] authors = ["Automatically generated"] -edition = "2021" +edition.workspace = true name = "zrml-rikiddo-fuzz" publish = false version = "0.0.0" diff --git a/zrml/simple-disputes/Cargo.toml b/zrml/simple-disputes/Cargo.toml index ee72953df..271a019f4 100644 --- a/zrml/simple-disputes/Cargo.toml +++ b/zrml/simple-disputes/Cargo.toml @@ -40,6 +40,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-simple-disputes" version = "0.5.2" diff --git a/zrml/styx/Cargo.toml b/zrml/styx/Cargo.toml index 75cb13431..f2c45f4c2 100644 --- a/zrml/styx/Cargo.toml +++ b/zrml/styx/Cargo.toml @@ -35,6 +35,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-styx" version = "0.5.2" diff --git a/zrml/swaps/Cargo.toml b/zrml/swaps/Cargo.toml index 2437f503c..a92d3b7df 100644 --- a/zrml/swaps/Cargo.toml +++ b/zrml/swaps/Cargo.toml @@ -63,6 +63,6 @@ try-runtime = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-swaps" version = "0.5.2" diff --git a/zrml/swaps/fuzz/Cargo.toml b/zrml/swaps/fuzz/Cargo.toml index 9490975ad..a7819b250 100644 --- a/zrml/swaps/fuzz/Cargo.toml +++ b/zrml/swaps/fuzz/Cargo.toml @@ -64,7 +64,7 @@ zrml-swaps = { workspace = true, features = ["mock", "default"] } [package] authors = ["Automatically generated"] -edition = "2021" +edition.workspace = true name = "zrml-swaps-fuzz" publish = false version = "0.0.0" diff --git a/zrml/swaps/rpc/Cargo.toml b/zrml/swaps/rpc/Cargo.toml index 178f5ddd5..ec05f2a59 100644 --- a/zrml/swaps/rpc/Cargo.toml +++ b/zrml/swaps/rpc/Cargo.toml @@ -9,6 +9,6 @@ zrml-swaps-runtime-api = { workspace = true, features = ["default"] } [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-swaps-rpc" version = "0.5.2" diff --git a/zrml/swaps/runtime-api/Cargo.toml b/zrml/swaps/runtime-api/Cargo.toml index cd99f4a9d..2e102db34 100644 --- a/zrml/swaps/runtime-api/Cargo.toml +++ b/zrml/swaps/runtime-api/Cargo.toml @@ -16,6 +16,6 @@ std = [ [package] authors = ["Zeitgeist PM "] -edition = "2021" +edition.workspace = true name = "zrml-swaps-runtime-api" version = "0.5.2" From 4b57af777beaca129c5126216f9a497b1d30745b Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sat, 27 Apr 2024 14:06:47 +0200 Subject: [PATCH 02/12] WIP Integrate new xcm-emulator environment --- Cargo.lock | 107 +++++++-- Cargo.toml | 6 +- runtime/battery-station/Cargo.toml | 6 +- .../src/integration_tests/xcm/genesis/mod.rs | 19 ++ .../integration_tests/xcm/genesis/rococo.rs | 204 ++++++++++++++++++ .../xcm/genesis/zeitgeist.rs | 95 ++++++++ .../src/integration_tests/xcm/mod.rs | 5 +- .../src/integration_tests/xcm/setup.rs | 77 ------- .../src/integration_tests/xcm/test_net.rs | 45 ++-- .../xcm/tests/currency_id_convert.rs | 1 - .../integration_tests/xcm/tests/transfers.rs | 4 +- runtime/zeitgeist/Cargo.toml | 2 +- .../src/integration_tests/xcm/test_net.rs | 2 +- .../xcm/tests/currency_id_convert.rs | 2 +- .../integration_tests/xcm/tests/transfers.rs | 2 +- 15 files changed, 459 insertions(+), 118 deletions(-) create mode 100644 runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs create mode 100644 runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs create mode 100644 runtime/battery-station/src/integration_tests/xcm/genesis/zeitgeist.rs diff --git a/Cargo.lock b/Cargo.lock index a0b7d23b3..d52d0da78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -854,11 +854,15 @@ dependencies = [ "polkadot-primitives", "polkadot-runtime-parachains", "rococo-runtime", + "rococo-runtime-constants", "scale-info", "session-keys-primitives", "sp-api", + "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", + "sp-consensus-babe", + "sp-consensus-beefy", "sp-consensus-grandpa", "sp-core", "sp-debug-derive", @@ -876,7 +880,7 @@ dependencies = [ "substrate-fixed", "substrate-wasm-builder", "test-case", - "xcm-simulator", + "xcm-emulator", "zeitgeist-primitives", "zrml-asset-router", "zrml-authorized", @@ -6392,6 +6396,25 @@ dependencies = [ "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", ] +[[package]] +name = "pallet-collator-selection" +version = "3.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "rand 0.8.5", + "scale-info", + "sp-runtime", + "sp-staking", + "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", +] + [[package]] name = "pallet-collective" version = "4.0.0-dev" @@ -7299,6 +7322,42 @@ dependencies = [ "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", ] +[[package]] +name = "parachains-common" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" +dependencies = [ + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-support", + "frame-system", + "kusama-runtime-constants", + "log", + "num-traits", + "pallet-asset-tx-payment", + "pallet-assets", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-primitives", + "polkadot-runtime-constants", + "rococo-runtime-constants", + "scale-info", + "smallvec", + "sp-consensus-aura", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", + "westend-runtime-constants", +] + [[package]] name = "parity-db" version = "0.4.13" @@ -14684,34 +14743,48 @@ dependencies = [ ] [[package]] -name = "xcm-procedural" -version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" -dependencies = [ - "Inflector", - "proc-macro2", - "quote", - "syn 2.0.60", -] - -[[package]] -name = "xcm-simulator" -version = "1.0.0" +name = "xcm-emulator" +version = "0.1.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ + "cumulus-pallet-parachain-system", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-test-relay-sproof-builder", "frame-support", + "frame-system", + "impl-trait-for-tuples", + "lazy_static", + "log", + "pallet-balances", + "pallet-message-queue", + "parachains-common", "parity-scale-codec", "paste", - "polkadot-core-primitives", "polkadot-parachain-primitives", + "polkadot-primitives", "polkadot-runtime-parachains", + "sp-arithmetic 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", + "sp-core", "sp-io", + "sp-runtime", "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", + "sp-tracing", "staging-xcm", - "staging-xcm-builder", "staging-xcm-executor", ] +[[package]] +name = "xcm-procedural" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "yamux" version = "0.10.2" @@ -14944,7 +15017,7 @@ dependencies = [ "substrate-fixed", "substrate-wasm-builder", "test-case", - "xcm-simulator", + "xcm-emulator", "zeitgeist-primitives", "zrml-asset-router", "zrml-authorized", diff --git a/Cargo.toml b/Cargo.toml index 3d05054d1..1784e796a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -165,7 +165,6 @@ substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } try-runtime-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } -xcm-simulator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } # Substrate (wasm) frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } @@ -203,8 +202,11 @@ parity-scale-codec = { version = "3.6.9", default-features = false } scale-info = { version = "2.11.1", default-features = false } sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +sp-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +sp-consensus-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +sp-consensus-beefy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } sp-debug-derive = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } @@ -222,6 +224,7 @@ substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", defaul polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } polkadot-test-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } +xcm-emulator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } # Polkadot / XCM (wasm) pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } @@ -231,6 +234,7 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", bran polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +rococo-runtime-constants = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } diff --git a/runtime/battery-station/Cargo.toml b/runtime/battery-station/Cargo.toml index cf6c27557..252acc380 100644 --- a/runtime/battery-station/Cargo.toml +++ b/runtime/battery-station/Cargo.toml @@ -129,9 +129,13 @@ zrml-swaps-runtime-api = { workspace = true } [dev-dependencies] env_logger = { workspace = true } +rococo-runtime-constants = { workspace = true, features = ["default"] } +sp-authority-discovery = { workspace = true, features = ["default"] } +sp-consensus-babe = { workspace = true, features = ["default"] } +sp-consensus-beefy = { workspace = true, features = ["default"] } sp-io = { workspace = true, features = ["default"] } test-case = { workspace = true } -xcm-simulator = { workspace = true } +xcm-emulator = { workspace = true } [features] default = ["std"] diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs new file mode 100644 index 000000000..b28407cd5 --- /dev/null +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs @@ -0,0 +1,19 @@ +// Copyright 2024 Forecasting Technologies LTD. +// +// This file is part of Zeitgeist. +// +// Zeitgeist 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. +// +// Zeitgeist 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 Zeitgeist. If not, see . + +mod rococo; +mod zeitgeist; \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs new file mode 100644 index 000000000..e982c09f2 --- /dev/null +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs @@ -0,0 +1,204 @@ +// Copyright 2024 Forecasting Technologies LTD. +// Copyright (C) Parity Technologies (UK) Ltd. +// +// This file is part of Zeitgeist. +// +// Zeitgeist 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. +// +// Zeitgeist 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 Zeitgeist. If not, see . + +// TODO: Replace with crate "rococo-emulated-chain" from Cumulus starting from polkadot-v1.4.0 + +// Substrate +use crate::Balance; +use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; +use sp_consensus_babe::AuthorityId as BabeId; +use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; +use sp_consensus_grandpa::AuthorityId as GrandpaId; +use sp_core::{sr25519, storage::Storage}; + +// Polkadot +use polkadot_primitives::{AssignmentId, ValidatorId}; + +// Cumulus + +use rococo_runtime_constants::currency::UNITS as ROC; + +pub const ED: Balance = rococo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; +const ENDOWMENT: u128 = 1_000_000 * ROC; + +/// Helper function to generate a crypto pair from seed +pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Helper function to generate an account ID from seed. +pub fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +pub fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + hrmp_sender_deposit: 0, + hrmp_recipient_deposit: 0, + hrmp_channel_max_capacity: 1000, + hrmp_channel_max_message_size: 102400, + hrmp_channel_max_total_size: 102400, + hrmp_max_parachain_outbound_channels: 30, + hrmp_max_parachain_inbound_channels: 30, + ..Default::default() + } +} + +/// Helper function used in tests to build the genesis storage using given RuntimeGenesisConfig and +/// code Used in `legacy_vs_json_check` submods to verify storage building with JSON patch against +/// building with RuntimeGenesisConfig struct. +pub fn build_genesis_storage(builder: &dyn BuildStorage, code: &[u8]) -> Storage { + let mut storage = builder.build_storage().unwrap(); + storage + .top + .insert(sp_core::storage::well_known_keys::CODE.to_vec(), code.into()); + storage +} + +fn session_keys( + babe: BabeId, + grandpa: GrandpaId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + beefy: BeefyId, +) -> rococo_runtime::SessionKeys { + rococo_runtime::SessionKeys { + babe, + grandpa, + para_validator, + para_assignment, + authority_discovery, + beefy, + } +} + +mod accounts { + use super::*; + pub const ALICE: &str = "Alice"; + pub const BOB: &str = "Bob"; + pub const CHARLIE: &str = "Charlie"; + pub const DAVE: &str = "Dave"; + pub const EVE: &str = "Eve"; + pub const FERDIE: &str = "Ferdie"; + pub const ALICE_STASH: &str = "Alice//stash"; + pub const BOB_STASH: &str = "Bob//stash"; + pub const CHARLIE_STASH: &str = "Charlie//stash"; + pub const DAVE_STASH: &str = "Dave//stash"; + pub const EVE_STASH: &str = "Eve//stash"; + pub const FERDIE_STASH: &str = "Ferdie//stash"; + pub const FERDIE_BEEFY: &str = "Ferdie//stash"; + + pub fn init_balances() -> Vec { + vec![ + get_account_id_from_seed::(ALICE), + get_account_id_from_seed::(BOB), + get_account_id_from_seed::(CHARLIE), + get_account_id_from_seed::(DAVE), + get_account_id_from_seed::(EVE), + get_account_id_from_seed::(FERDIE), + get_account_id_from_seed::(ALICE_STASH), + get_account_id_from_seed::(BOB_STASH), + get_account_id_from_seed::(CHARLIE_STASH), + get_account_id_from_seed::(DAVE_STASH), + get_account_id_from_seed::(EVE_STASH), + get_account_id_from_seed::(FERDIE_STASH), + ] + } +} + +mod validators { + use super::*; + + pub fn initial_authorities() -> Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + BeefyId, + )> { + let seed = "Alice"; + vec![( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + )] + } +} + +pub(crate) fn genesis() -> Storage { + let genesis_config = rococo_runtime::RuntimeGenesisConfig { + system: rococo_runtime::SystemConfig::default(), + balances: rococo_runtime::BalancesConfig { + balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(), + }, + session: rococo_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + babe: rococo_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: rococo_runtime::BABE_GENESIS_EPOCH_CONFIG, + ..Default::default() + }, + sudo: rococo_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + configuration: rococo_runtime::ConfigurationConfig { config: get_host_config() }, + registrar: rococo_runtime::RegistrarConfig { + next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, + ..Default::default() + }, + ..Default::default() + }; + + build_genesis_storage(&genesis_config, rococo_runtime::WASM_BINARY.unwrap()) +} \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/zeitgeist.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/zeitgeist.rs new file mode 100644 index 000000000..a81d8e55f --- /dev/null +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/zeitgeist.rs @@ -0,0 +1,95 @@ +// Copyright 2024 Forecasting Technologies LTD. +// +// This file is part of Zeitgeist. +// +// Zeitgeist 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. +// +// Zeitgeist 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 Zeitgeist. If not, see . + +/* +pub(super) struct ExtBuilder { + balances: Vec<(AccountId, Assets, Balance)>, + parachain_id: u32, + safe_xcm_version: Option, +} + +impl Default for ExtBuilder { + fn default() -> Self { + Self { balances: vec![], parachain_id: battery_station::ID, safe_xcm_version: None } + } +} + +impl ExtBuilder { + pub fn set_balances(mut self, balances: Vec<(AccountId, Assets, Balance)>) -> Self { + self.balances = balances; + self + } + + pub fn set_parachain_id(mut self, parachain_id: u32) -> Self { + self.parachain_id = parachain_id; + self + } + + pub fn with_safe_xcm_version(mut self, safe_xcm_version: u32) -> Self { + self.safe_xcm_version = Some(safe_xcm_version); + self + } + + pub fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + let native_currency_id = Assets::Ztg; + + pallet_balances::GenesisConfig:: { + balances: self + .balances + .clone() + .into_iter() + .filter(|(_, currency_id, _)| *currency_id == native_currency_id) + .map(|(account_id, _, initial_balance)| (account_id, initial_balance)) + .collect::>(), + } + .assimilate_storage(&mut t) + .unwrap(); + + orml_tokens::GenesisConfig:: { + balances: self + .balances + .into_iter() + .filter(|(_, currency_id, _)| *currency_id != native_currency_id) + .map(|(account_id, currency_id, initial_balance)| { + (account_id, currency_id.try_into().unwrap(), initial_balance) + }) + .collect::>(), + } + .assimilate_storage(&mut t) + .unwrap(); + + parachain_info::GenesisConfig:: { + _config: Default::default(), + parachain_id: self.parachain_id.into(), + } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_xcm::GenesisConfig:: { + _config: Default::default(), + safe_xcm_version: self.safe_xcm_version, + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} +*/ \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/mod.rs b/runtime/battery-station/src/integration_tests/xcm/mod.rs index d37a62036..930c1b2ce 100644 --- a/runtime/battery-station/src/integration_tests/xcm/mod.rs +++ b/runtime/battery-station/src/integration_tests/xcm/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Forecasting Technologies LTD. +// Copyright 2022-2024 Forecasting Technologies LTD. // // This file is part of Zeitgeist. // @@ -17,6 +17,7 @@ #![cfg(all(feature = "parachain", test))] +mod genesis; mod setup; mod test_net; -mod tests; +mod tests; \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/setup.rs b/runtime/battery-station/src/integration_tests/xcm/setup.rs index 7e033b5c3..7a7919a6a 100644 --- a/runtime/battery-station/src/integration_tests/xcm/setup.rs +++ b/runtime/battery-station/src/integration_tests/xcm/setup.rs @@ -30,83 +30,6 @@ use xcm::{ }; use zeitgeist_primitives::types::{CustomMetadata, XcmAsset}; -pub(super) struct ExtBuilder { - balances: Vec<(AccountId, Assets, Balance)>, - parachain_id: u32, - safe_xcm_version: Option, -} - -impl Default for ExtBuilder { - fn default() -> Self { - Self { balances: vec![], parachain_id: battery_station::ID, safe_xcm_version: None } - } -} - -impl ExtBuilder { - pub fn set_balances(mut self, balances: Vec<(AccountId, Assets, Balance)>) -> Self { - self.balances = balances; - self - } - - pub fn set_parachain_id(mut self, parachain_id: u32) -> Self { - self.parachain_id = parachain_id; - self - } - - pub fn with_safe_xcm_version(mut self, safe_xcm_version: u32) -> Self { - self.safe_xcm_version = Some(safe_xcm_version); - self - } - - pub fn build(self) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - let native_currency_id = Assets::Ztg; - - pallet_balances::GenesisConfig:: { - balances: self - .balances - .clone() - .into_iter() - .filter(|(_, currency_id, _)| *currency_id == native_currency_id) - .map(|(account_id, _, initial_balance)| (account_id, initial_balance)) - .collect::>(), - } - .assimilate_storage(&mut t) - .unwrap(); - - orml_tokens::GenesisConfig:: { - balances: self - .balances - .into_iter() - .filter(|(_, currency_id, _)| *currency_id != native_currency_id) - .map(|(account_id, currency_id, initial_balance)| { - (account_id, currency_id.try_into().unwrap(), initial_balance) - }) - .collect::>(), - } - .assimilate_storage(&mut t) - .unwrap(); - - parachain_info::GenesisConfig:: { - _config: Default::default(), - parachain_id: self.parachain_id.into(), - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_xcm::GenesisConfig:: { - _config: Default::default(), - safe_xcm_version: self.safe_xcm_version, - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} - /// Accounts pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); pub const BOB: AccountId32 = AccountId32::new([1u8; 32]); diff --git a/runtime/battery-station/src/integration_tests/xcm/test_net.rs b/runtime/battery-station/src/integration_tests/xcm/test_net.rs index 358110eb1..58345dec3 100644 --- a/runtime/battery-station/src/integration_tests/xcm/test_net.rs +++ b/runtime/battery-station/src/integration_tests/xcm/test_net.rs @@ -22,22 +22,34 @@ use crate::{ }; use polkadot_runtime_parachains::configuration::HostConfiguration; use sp_runtime::BuildStorage; -use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; - -use super::setup::{roc, ztg, ExtBuilder, ALICE, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; - -decl_test_relay_chain! { - pub struct RococoNet { - Runtime = rococo_runtime::Runtime, - RuntimeCall = rococo_runtime::RuntimeCall, - RuntimeEvent = rococo_runtime::RuntimeEvent, - XcmConfig = rococo_runtime::XcmConfig, - MessageQueue = rococo_runtime::MessageQueue, - System = rococo_runtime::System, - new_ext = relay_ext(), - } +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt}; + +use super::setup::{roc, ztg, ALICE, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; + +decl_test_relay_chains! { + #[api_version(11)] + pub struct Rococo { + genesis = genesis::genesis(), + on_init = (), + runtime = rococo_runtime, + core = { + MessageProcessor: TODO + SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, + }, + pallets = { + XcmPallet: rococo_runtime::XcmPallet, + Sudo: rococo_runtime::Sudo, + Balances: rococo_runtime::Balances, + Hrmp: rococo_runtime::Hrmp, + Identity: rococo_runtime::Identity, + IdentityMigrator: rococo_runtime::IdentityMigrator, + Treasury: rococo_runtime::Treasury, + AssetRate: rococo_runtime::AssetRate, + } + }, } +/* decl_test_parachain! { pub struct Zeitgeist { Runtime = Runtime, @@ -90,6 +102,10 @@ pub(super) fn relay_ext() -> sp_io::TestExternalities { .assimilate_storage(&mut t) .unwrap(); + polkadot-runtime-parachains::paras::GenesisConfig:: { + + } + let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); ext @@ -121,3 +137,4 @@ pub fn mock_relay_config() -> HostConfiguration(expected: T) where diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs index a2d62dc11..c508bed75 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs @@ -33,12 +33,13 @@ use crate::{ use frame_support::{assert_ok, traits::tokens::fungible::Mutate}; use orml_traits::MultiCurrency; use xcm::latest::{Junction, Junction::*, Junctions::*, MultiLocation, WeightLimit}; -use xcm_simulator::TestExt; +use xcm_emulator::TestExt; use zeitgeist_primitives::{ constants::{BalanceFractionalDecimals, BASE}, types::{CustomMetadata, XcmAsset, XcmMetadata}, }; +/* #[test] fn transfer_ztg_to_sibling() { TestNet::reset(); @@ -474,3 +475,4 @@ const fn calc_fee(fee_per_second: Balance) -> Balance { // NOTE: it is possible that in different machines this value may differ. We shall see. fee_per_second / 10_000 * 8 } +*/ \ No newline at end of file diff --git a/runtime/zeitgeist/Cargo.toml b/runtime/zeitgeist/Cargo.toml index c53c48831..c2890b157 100644 --- a/runtime/zeitgeist/Cargo.toml +++ b/runtime/zeitgeist/Cargo.toml @@ -130,7 +130,7 @@ zrml-swaps-runtime-api = { workspace = true } env_logger = { workspace = true } sp-io = { workspace = true, features = ["default"] } test-case = { workspace = true } -xcm-simulator = { workspace = true } +xcm-emulator = { workspace = true } [features] default = ["std"] diff --git a/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs b/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs index 6558aa0da..200726372 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs @@ -22,7 +22,7 @@ use crate::{ }; use polkadot_runtime_parachains::configuration::HostConfiguration; use sp_runtime::BuildStorage; -use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; +use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; use super::setup::{dot, ztg, ExtBuilder, ALICE, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; diff --git a/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs b/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs index 27f8c94fa..dbe2b68be 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs @@ -32,7 +32,7 @@ use core::fmt::Debug; use sp_runtime::traits::{Convert, MaybeEquivalence}; use test_case::test_case; use xcm::latest::{Junction::*, Junctions::*, MultiLocation}; -use xcm_simulator::TestExt; +use xcm_emulator::TestExt; fn convert_common_native(expected: T) where diff --git a/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs b/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs index 13fca9797..8a996016d 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs @@ -33,7 +33,7 @@ use crate::{ use frame_support::{assert_ok, traits::tokens::fungible::Mutate}; use orml_traits::MultiCurrency; use xcm::latest::{Junction, Junction::*, Junctions::*, MultiLocation, WeightLimit}; -use xcm_simulator::TestExt; +use xcm_emulator::TestExt; use zeitgeist_primitives::{ constants::{BalanceFractionalDecimals, BASE}, types::{CustomMetadata, XcmAsset, XcmMetadata}, From 9787eda4a5ae52b106be6e56b84f9b3acf146558 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sat, 27 Apr 2024 18:06:23 +0200 Subject: [PATCH 03/12] Utilize new xcm-emulator interfaces --- Cargo.lock | 1 + Cargo.toml | 1 + runtime/battery-station/Cargo.toml | 5 +- .../src/integration_tests/xcm/genesis/mod.rs | 4 +- .../integration_tests/xcm/genesis/rococo.rs | 133 ++++++------------ .../xcm/genesis/zeitgeist.rs | 95 ------------- .../src/integration_tests/xcm/setup.rs | 37 ++++- .../src/integration_tests/xcm/test_net.rs | 118 +++++----------- .../xcm/tests/currency_id_convert.rs | 3 +- .../integration_tests/xcm/tests/transfers.rs | 3 +- 10 files changed, 122 insertions(+), 278 deletions(-) delete mode 100644 runtime/battery-station/src/integration_tests/xcm/genesis/zeitgeist.rs diff --git a/Cargo.lock b/Cargo.lock index d52d0da78..8aa33f598 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -832,6 +832,7 @@ dependencies = [ "pallet-democracy", "pallet-grandpa", "pallet-identity", + "pallet-im-online", "pallet-insecure-randomness-collective-flip", "pallet-membership", "pallet-message-queue", diff --git a/Cargo.toml b/Cargo.toml index 1784e796a..2d09ea2c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -185,6 +185,7 @@ pallet-contracts-primitives = { git = "https://github.com/paritytech/polkadot-sd pallet-democracy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +pallet-im-online = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } pallet-insecure-randomness-collective-flip = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } pallet-membership = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } diff --git a/runtime/battery-station/Cargo.toml b/runtime/battery-station/Cargo.toml index 252acc380..534f81f4f 100644 --- a/runtime/battery-station/Cargo.toml +++ b/runtime/battery-station/Cargo.toml @@ -102,6 +102,7 @@ pallet-message-queue = { workspace = true, optional = true } pallet-xcm = { workspace = true, optional = true } polkadot-runtime-parachains = { workspace = true, optional = true } rococo-runtime = { workspace = true, optional = true } +rococo-runtime-constants = { workspace = true, optional = true } xcm = { workspace = true, optional = true } xcm-builder = { workspace = true, optional = true } xcm-executor = { workspace = true, optional = true } @@ -129,7 +130,7 @@ zrml-swaps-runtime-api = { workspace = true } [dev-dependencies] env_logger = { workspace = true } -rococo-runtime-constants = { workspace = true, features = ["default"] } +pallet-im-online = { workspace = true, features = ["default"] } sp-authority-discovery = { workspace = true, features = ["default"] } sp-consensus-babe = { workspace = true, features = ["default"] } sp-consensus-beefy = { workspace = true, features = ["default"] } @@ -172,6 +173,7 @@ parachain = [ "pallet-xcm", "polkadot-runtime-parachains", "rococo-runtime", + "rococo-runtime-constants", "xcm-builder", "xcm-executor", "xcm", @@ -330,6 +332,7 @@ std = [ "pallet-xcm?/std", "polkadot-runtime-parachains?/std", "rococo-runtime?/std", + "rococo-runtime-constants?/std", "xcm-builder?/std", "xcm-executor?/std", "xcm?/std", diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs index b28407cd5..3a3d4864b 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs @@ -15,5 +15,5 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . -mod rococo; -mod zeitgeist; \ No newline at end of file +pub(super) mod rococo; +pub(super) mod battery_station; \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs index e982c09f2..d75a64ea5 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs @@ -18,40 +18,52 @@ // TODO: Replace with crate "rococo-emulated-chain" from Cumulus starting from polkadot-v1.4.0 -// Substrate use crate::Balance; +use crate::integration_tests::xcm::setup::accounts; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_consensus_grandpa::AuthorityId as GrandpaId; -use sp_core::{sr25519, storage::Storage}; - -// Polkadot -use polkadot_primitives::{AssignmentId, ValidatorId}; - -// Cumulus - -use rococo_runtime_constants::currency::UNITS as ROC; +use sp_core::{storage::Storage, Pair, Public}; +use sp_runtime::BuildStorage; +use polkadot_primitives::{AccountId, BlockNumber, AssignmentId, ValidatorId}; +use polkadot_runtime_parachains::configuration::HostConfiguration; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +use crate::integration_tests::xcm::setup::roc; +use xcm_emulator::helpers::get_account_id_from_seed; +use sp_core::sr25519; pub const ED: Balance = rococo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; -const ENDOWMENT: u128 = 1_000_000 * ROC; +const ENDOWMENT: u128 = roc(1_000_000); + +fn session_keys( + grandpa: GrandpaId, + babe: BabeId, + im_online: ImOnlineId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + beefy: BeefyId, +) -> rococo_runtime::SessionKeys { + rococo_runtime::SessionKeys { + grandpa, + babe, + im_online, + para_validator, + para_assignment, + authority_discovery, + beefy, + } +} /// Helper function to generate a crypto pair from seed -pub fn get_from_seed(seed: &str) -> ::Public { +fn get_from_seed(seed: &str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None) .expect("static values are valid; qed") .public() } -/// Helper function to generate an account ID from seed. -pub fn get_account_id_from_seed(seed: &str) -> AccountId -where - AccountPublic: From<::Public>, -{ - AccountPublic::from(get_from_seed::(seed)).into_account() -} - -pub fn get_host_config() -> HostConfiguration { +fn get_host_config() -> HostConfiguration { HostConfiguration { max_upward_queue_count: 10, max_upward_queue_size: 51200, @@ -69,77 +81,15 @@ pub fn get_host_config() -> HostConfiguration { } } -/// Helper function used in tests to build the genesis storage using given RuntimeGenesisConfig and -/// code Used in `legacy_vs_json_check` submods to verify storage building with JSON patch against -/// building with RuntimeGenesisConfig struct. -pub fn build_genesis_storage(builder: &dyn BuildStorage, code: &[u8]) -> Storage { - let mut storage = builder.build_storage().unwrap(); - storage - .top - .insert(sp_core::storage::well_known_keys::CODE.to_vec(), code.into()); - storage -} - -fn session_keys( - babe: BabeId, - grandpa: GrandpaId, - para_validator: ValidatorId, - para_assignment: AssignmentId, - authority_discovery: AuthorityDiscoveryId, - beefy: BeefyId, -) -> rococo_runtime::SessionKeys { - rococo_runtime::SessionKeys { - babe, - grandpa, - para_validator, - para_assignment, - authority_discovery, - beefy, - } -} - -mod accounts { - use super::*; - pub const ALICE: &str = "Alice"; - pub const BOB: &str = "Bob"; - pub const CHARLIE: &str = "Charlie"; - pub const DAVE: &str = "Dave"; - pub const EVE: &str = "Eve"; - pub const FERDIE: &str = "Ferdie"; - pub const ALICE_STASH: &str = "Alice//stash"; - pub const BOB_STASH: &str = "Bob//stash"; - pub const CHARLIE_STASH: &str = "Charlie//stash"; - pub const DAVE_STASH: &str = "Dave//stash"; - pub const EVE_STASH: &str = "Eve//stash"; - pub const FERDIE_STASH: &str = "Ferdie//stash"; - pub const FERDIE_BEEFY: &str = "Ferdie//stash"; - - pub fn init_balances() -> Vec { - vec![ - get_account_id_from_seed::(ALICE), - get_account_id_from_seed::(BOB), - get_account_id_from_seed::(CHARLIE), - get_account_id_from_seed::(DAVE), - get_account_id_from_seed::(EVE), - get_account_id_from_seed::(FERDIE), - get_account_id_from_seed::(ALICE_STASH), - get_account_id_from_seed::(BOB_STASH), - get_account_id_from_seed::(CHARLIE_STASH), - get_account_id_from_seed::(DAVE_STASH), - get_account_id_from_seed::(EVE_STASH), - get_account_id_from_seed::(FERDIE_STASH), - ] - } -} - mod validators { use super::*; pub fn initial_authorities() -> Vec<( AccountId, AccountId, - BabeId, GrandpaId, + BabeId, + ImOnlineId, ValidatorId, AssignmentId, AuthorityDiscoveryId, @@ -149,8 +99,9 @@ mod validators { vec![( get_account_id_from_seed::(&format!("{}//stash", seed)), get_account_id_from_seed::(seed), - get_from_seed::(seed), get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), get_from_seed::(seed), get_from_seed::(seed), get_from_seed::(seed), @@ -161,7 +112,10 @@ mod validators { pub(crate) fn genesis() -> Storage { let genesis_config = rococo_runtime::RuntimeGenesisConfig { - system: rococo_runtime::SystemConfig::default(), + system: rococo_runtime::SystemConfig { + code: rococo_runtime::WASM_BINARY.unwrap().to_vec(), + ..Default::default() + }, balances: rococo_runtime::BalancesConfig { balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(), }, @@ -179,6 +133,7 @@ pub(crate) fn genesis() -> Storage { x.5.clone(), x.6.clone(), x.7.clone(), + x.8.clone(), ), ) }) @@ -186,7 +141,7 @@ pub(crate) fn genesis() -> Storage { }, babe: rococo_runtime::BabeConfig { authorities: Default::default(), - epoch_config: rococo_runtime::BABE_GENESIS_EPOCH_CONFIG, + epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), ..Default::default() }, sudo: rococo_runtime::SudoConfig { @@ -200,5 +155,5 @@ pub(crate) fn genesis() -> Storage { ..Default::default() }; - build_genesis_storage(&genesis_config, rococo_runtime::WASM_BINARY.unwrap()) -} \ No newline at end of file + genesis_config.build_storage().unwrap() +} diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/zeitgeist.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/zeitgeist.rs deleted file mode 100644 index a81d8e55f..000000000 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/zeitgeist.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2024 Forecasting Technologies LTD. -// -// This file is part of Zeitgeist. -// -// Zeitgeist 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. -// -// Zeitgeist 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 Zeitgeist. If not, see . - -/* -pub(super) struct ExtBuilder { - balances: Vec<(AccountId, Assets, Balance)>, - parachain_id: u32, - safe_xcm_version: Option, -} - -impl Default for ExtBuilder { - fn default() -> Self { - Self { balances: vec![], parachain_id: battery_station::ID, safe_xcm_version: None } - } -} - -impl ExtBuilder { - pub fn set_balances(mut self, balances: Vec<(AccountId, Assets, Balance)>) -> Self { - self.balances = balances; - self - } - - pub fn set_parachain_id(mut self, parachain_id: u32) -> Self { - self.parachain_id = parachain_id; - self - } - - pub fn with_safe_xcm_version(mut self, safe_xcm_version: u32) -> Self { - self.safe_xcm_version = Some(safe_xcm_version); - self - } - - pub fn build(self) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - let native_currency_id = Assets::Ztg; - - pallet_balances::GenesisConfig:: { - balances: self - .balances - .clone() - .into_iter() - .filter(|(_, currency_id, _)| *currency_id == native_currency_id) - .map(|(account_id, _, initial_balance)| (account_id, initial_balance)) - .collect::>(), - } - .assimilate_storage(&mut t) - .unwrap(); - - orml_tokens::GenesisConfig:: { - balances: self - .balances - .into_iter() - .filter(|(_, currency_id, _)| *currency_id != native_currency_id) - .map(|(account_id, currency_id, initial_balance)| { - (account_id, currency_id.try_into().unwrap(), initial_balance) - }) - .collect::>(), - } - .assimilate_storage(&mut t) - .unwrap(); - - parachain_info::GenesisConfig:: { - _config: Default::default(), - parachain_id: self.parachain_id.into(), - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_xcm::GenesisConfig:: { - _config: Default::default(), - safe_xcm_version: self.safe_xcm_version, - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} -*/ \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/setup.rs b/runtime/battery-station/src/integration_tests/xcm/setup.rs index 7a7919a6a..1521405f6 100644 --- a/runtime/battery-station/src/integration_tests/xcm/setup.rs +++ b/runtime/battery-station/src/integration_tests/xcm/setup.rs @@ -21,6 +21,7 @@ use crate::{ AccountId, AssetRegistry, AssetRegistryStringLimit, Assets, Balance, ExistentialDeposit, Runtime, RuntimeOrigin, System, }; +use sp_core::sr25519; use frame_support::assert_ok; use orml_traits::asset_registry::AssetMetadata; use sp_runtime::{AccountId32, BuildStorage}; @@ -29,10 +30,42 @@ use xcm::{ VersionedMultiLocation, }; use zeitgeist_primitives::types::{CustomMetadata, XcmAsset}; +use xcm_emulator::helpers::get_account_id_from_seed; /// Accounts -pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); -pub const BOB: AccountId32 = AccountId32::new([1u8; 32]); +pub(super) mod accounts { + use super::*; + pub const ALICE: &str = "Alice"; + pub const BOB: &str = "Bob"; + pub const CHARLIE: &str = "Charlie"; + pub const DAVE: &str = "Dave"; + pub const EVE: &str = "Eve"; + pub const FERDIE: &str = "Ferdie"; + pub const ALICE_STASH: &str = "Alice//stash"; + pub const BOB_STASH: &str = "Bob//stash"; + pub const CHARLIE_STASH: &str = "Charlie//stash"; + pub const DAVE_STASH: &str = "Dave//stash"; + pub const EVE_STASH: &str = "Eve//stash"; + pub const FERDIE_STASH: &str = "Ferdie//stash"; + pub const FERDIE_BEEFY: &str = "Ferdie//stash"; + + pub fn init_balances() -> Vec { + vec![ + get_account_id_from_seed::(ALICE), + get_account_id_from_seed::(BOB), + get_account_id_from_seed::(CHARLIE), + get_account_id_from_seed::(DAVE), + get_account_id_from_seed::(EVE), + get_account_id_from_seed::(FERDIE), + get_account_id_from_seed::(ALICE_STASH), + get_account_id_from_seed::(BOB_STASH), + get_account_id_from_seed::(CHARLIE_STASH), + get_account_id_from_seed::(DAVE_STASH), + get_account_id_from_seed::(EVE_STASH), + get_account_id_from_seed::(FERDIE_STASH), + ] + } +} /// A PARA ID used for a sibling parachain. /// It must be one that doesn't collide with any other in use. diff --git a/runtime/battery-station/src/integration_tests/xcm/test_net.rs b/runtime/battery-station/src/integration_tests/xcm/test_net.rs index 58345dec3..2da3b1cc0 100644 --- a/runtime/battery-station/src/integration_tests/xcm/test_net.rs +++ b/runtime/battery-station/src/integration_tests/xcm/test_net.rs @@ -17,48 +17,54 @@ // along with Zeitgeist. If not, see . use crate::{ - parameters::ZeitgeistTreasuryAccount, xcm_config::config::battery_station, Assets, DmpQueue, - XcmpQueue, + parameters::ZeitgeistTreasuryAccount, xcm_config::config::{LocationToAccountId}, battery_station, Assets, DmpQueue, + XcmpQueue, ParachainInfo, PolkadotXcm, AssetManager, Balances, XTokens }; use polkadot_runtime_parachains::configuration::HostConfiguration; use sp_runtime::BuildStorage; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, DefaultMessageProcessor}; -use super::setup::{roc, ztg, ALICE, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; +use super::setup::{roc, ztg, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; decl_test_relay_chains! { - #[api_version(11)] + #[api_version(5)] pub struct Rococo { - genesis = genesis::genesis(), + genesis = crate::integration_tests::xcm::genesis::rococo::genesis(), on_init = (), runtime = rococo_runtime, core = { - MessageProcessor: TODO + MessageProcessor: DefaultMessageProcessor, SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, }, pallets = { XcmPallet: rococo_runtime::XcmPallet, Sudo: rococo_runtime::Sudo, Balances: rococo_runtime::Balances, - Hrmp: rococo_runtime::Hrmp, - Identity: rococo_runtime::Identity, - IdentityMigrator: rococo_runtime::IdentityMigrator, - Treasury: rococo_runtime::Treasury, - AssetRate: rococo_runtime::AssetRate, } }, } -/* -decl_test_parachain! { - pub struct Zeitgeist { - Runtime = Runtime, - XcmpMessageHandler = XcmpQueue, - DmpMessageHandler = DmpQueue, - new_ext = para_ext(battery_station::ID), - } +decl_test_parachains! { + pub struct BatteryStation { + genesis = crate::integration_tests::xcm::genesis::battery_station::genesis(), + on_init = (), + runtime = crate, + core = { + XcmpMessageHandler: XcmpQueue, + DmpMessageHandler: DmpQueue, + LocationToAccountId: LocationToAccountId, + ParachainInfo: ParachainInfo, + }, + pallets = { + PolkadotXcm: PolkadotXcm, + AssetManager: AssetManager, + Balances: Balances, + XTokens: XTokens, + } + }, } +/* decl_test_parachain! { pub struct Sibling { Runtime = Runtime, @@ -67,74 +73,14 @@ decl_test_parachain! { new_ext = para_ext(PARA_ID_SIBLING), } } +*/ -decl_test_network! { +decl_test_networks! { pub struct TestNet { - relay_chain = RococoNet, + relay_chain = Rococo, parachains = vec![ - // N.B: Ideally, we could use the defined para id constants but doing so - // fails with: "error: arbitrary expressions aren't allowed in patterns" - - // Be sure to use `xcm_config::config::battery_station::ID` - (2101, Zeitgeist), - // Be sure to use `PARA_ID_SIBLING` - (3000, Sibling), + BatteryStation, ], + bridge = () } -} - -pub(super) fn relay_ext() -> sp_io::TestExternalities { - use rococo_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - - pallet_balances::GenesisConfig:: { balances: vec![(ALICE, roc(2002))] } - .assimilate_storage(&mut t) - .unwrap(); - - polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: mock_relay_config(), - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_xcm::GenesisConfig:: { _config: Default::default(), safe_xcm_version: Some(2) } - .assimilate_storage(&mut t) - .unwrap(); - - polkadot-runtime-parachains::paras::GenesisConfig:: { - - } - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext -} - -pub(super) fn para_ext(parachain_id: u32) -> sp_io::TestExternalities { - let _ = env_logger::builder().is_test(true).try_init(); - - ExtBuilder::default() - .set_balances(vec![ - (ALICE, Assets::Ztg, ztg(10)), - (ALICE, FOREIGN_PARENT_ID.into(), roc(10)), - (ZeitgeistTreasuryAccount::get(), FOREIGN_PARENT_ID.into(), roc(1)), - ]) - .set_parachain_id(parachain_id) - .with_safe_xcm_version(2) - .build() -} - -pub fn mock_relay_config() -> HostConfiguration { - HostConfiguration:: { - hrmp_channel_max_capacity: u32::MAX, - hrmp_channel_max_total_size: u32::MAX, - hrmp_max_parachain_inbound_channels: 10, - hrmp_max_parachain_outbound_channels: 10, - hrmp_channel_max_message_size: u32::MAX, - // Changed to avoid aritmetic errors within hrmp_close - max_downward_message_size: 100_000u32, - ..Default::default() - } -} -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs index d9149f9e2..f006b9a81 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs @@ -23,7 +23,6 @@ use crate::{ register_foreign_parent, register_foreign_sibling, FOREIGN_PARENT_ID, FOREIGN_SIBLING_ID, }, - test_net::Zeitgeist, }, xcm_config::config::{battery_station, general_key, AssetConvert}, Assets, CustomMetadata, ScalarPosition, XcmAsset, @@ -33,6 +32,7 @@ use sp_runtime::traits::{Convert, MaybeEquivalence}; use test_case::test_case; use xcm::latest::{Junction::*, Junctions::*, MultiLocation}; +/* fn convert_common_native(expected: T) where T: Copy + Debug + PartialEq, @@ -176,3 +176,4 @@ where { Zeitgeist::execute_with(|| assert_eq!(>::convert(asset), None)); } +*/ \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs index c508bed75..e370b6f63 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs @@ -20,10 +20,9 @@ use crate::{ integration_tests::xcm::{ setup::{ adjusted_balance, btc, register_btc, register_foreign_parent, register_foreign_ztg, - roc, sibling_parachain_account, zeitgeist_parachain_account, ztg, ALICE, BOB, BTC_ID, + roc, sibling_parachain_account, zeitgeist_parachain_account, ztg, BTC_ID, FOREIGN_PARENT_ID, FOREIGN_ZTG_ID, PARA_ID_SIBLING, }, - test_net::{RococoNet, Sibling, TestNet, Zeitgeist}, }, xcm_config::{config::battery_station, fees::default_per_second}, AssetManager, AssetRegistry, Balance, Balances, RuntimeOrigin, XTokens, From a2b71582aaa153913a6379c12ffa697a45106f05 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sat, 27 Apr 2024 18:52:18 +0200 Subject: [PATCH 04/12] Spawn relay-para network using patched xcm-emulator --- Cargo.lock | 2 +- Cargo.toml | 4 + .../xcm/genesis/battery_station.rs | 96 +++++++++++++++++++ .../src/integration_tests/xcm/test_net.rs | 2 + 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs diff --git a/Cargo.lock b/Cargo.lock index 8aa33f598..90d502cb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14746,7 +14746,7 @@ dependencies = [ [[package]] name = "xcm-emulator" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" +source = "git+https://github.com/zeitgeistpm/polkadot-sdk?branch=release-polkadot-v1.1.0-xcm-emulator-type-fix#84163279ce450f608de56b9d5151e65fe4bec51a" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", diff --git a/Cargo.toml b/Cargo.toml index 2d09ea2c4..cd241b418 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -357,6 +357,10 @@ panic = "unwind" # Commits: # - cb803be8cdc52d020890308a2076d752a8c4ce5c pallet-assets = { git = "https://github.com/zeitgeistpm/polkadot-sdk", branch = "zeitgeist-polkadot-v1.1.0" } +# xcm-emulator incompatible block number type fixed +# Commits: +# - +xcm-emulator = { git = "https://github.com/zeitgeistpm/polkadot-sdk", branch = "release-polkadot-v1.1.0-xcm-emulator-type-fix" } [patch."https://github.com/galacticcouncil/HydraDX-node"] # Ensure same Substrate dependencies are used everywhere diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs new file mode 100644 index 000000000..289a614e1 --- /dev/null +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs @@ -0,0 +1,96 @@ +// Copyright 2024 Forecasting Technologies LTD. +// +// This file is part of Zeitgeist. +// +// Zeitgeist 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. +// +// Zeitgeist 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 Zeitgeist. If not, see . + +use crate::parameters::ZeitgeistTreasuryAccount; +use crate::integration_tests::xcm::setup::accounts; +use crate::xcm_config::config::battery_station::ID as parachain_id; +use crate::integration_tests::xcm::setup::ztg; +use crate::integration_tests::xcm::setup::roc; +use crate::integration_tests::xcm::setup::FOREIGN_PARENT_ID; +use sp_core::storage::Storage; +use sp_runtime::BuildStorage; +use crate::Asset; + +const ENDOWMENT_ZTG: u128 = ztg(1_000_000); +const ENDOWMENT_ROC: u128 = roc(1_000_000); +const SAFE_XCM_VERSION: u32 = 2; + +pub(crate) fn genesis() -> Storage { + let genesis_config = crate::RuntimeGenesisConfig { + system: crate::SystemConfig { + code: crate::WASM_BINARY.unwrap().to_vec(), + ..Default::default() + }, + + /* + asset_registry: crate::AssetRegistryConfig { + + } + + author_mapping: $runtime::AuthorMappingConfig { + mappings: acs + .candidates + .iter() + .cloned() + .map(|(account_id, author_id, _)| (author_id, account_id)) + .collect(), + }, + + parachain_staking: $runtime::ParachainStakingConfig { + blocks_per_round: acs.blocks_per_round, + candidates: acs + .candidates + .iter() + .cloned() + .map(|(account, _, bond)| (account, bond)) + .collect(), + collator_commission: acs.collator_commission, + inflation_config: acs.inflation_info, + delegations: acs.nominations, + parachain_bond_reserve_percent: acs.parachain_bond_reserve_percent, + num_selected_candidates: acs.num_selected_candidates, + }, + */ + + balances: crate::BalancesConfig { + balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT_ZTG)).collect(), + }, + + tokens: crate::TokensConfig { + balances: accounts::init_balances(). + iter() + .chain( + vec![(ZeitgeistTreasuryAccount::get())].iter() + ) + .map(|k| (k.clone(), Asset::from(FOREIGN_PARENT_ID).try_into().unwrap(), ENDOWMENT_ROC)) + .collect::>() + }, + + parachain_info: crate::ParachainInfoConfig { + parachain_id: parachain_id.into(), + ..Default::default() + }, + + polkadot_xcm: crate::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() + }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() +} diff --git a/runtime/battery-station/src/integration_tests/xcm/test_net.rs b/runtime/battery-station/src/integration_tests/xcm/test_net.rs index 2da3b1cc0..a5c66641e 100644 --- a/runtime/battery-station/src/integration_tests/xcm/test_net.rs +++ b/runtime/battery-station/src/integration_tests/xcm/test_net.rs @@ -64,6 +64,8 @@ decl_test_parachains! { }, } +type BlockNumber = u64; + /* decl_test_parachain! { pub struct Sibling { From d4a7a79a03a3b2716cbc2d1773dc4cfaea6596bd Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sat, 27 Apr 2024 19:19:17 +0200 Subject: [PATCH 05/12] Use proper collator genesis config --- .../xcm/genesis/battery_station.rs | 68 ++++++------------- .../integration_tests/xcm/genesis/rococo.rs | 8 +-- .../src/integration_tests/xcm/setup.rs | 14 +++- .../src/integration_tests/xcm/test_net.rs | 38 ++++++----- 4 files changed, 57 insertions(+), 71 deletions(-) diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs index 289a614e1..bd36849d8 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs @@ -16,60 +16,44 @@ // along with Zeitgeist. If not, see . use crate::parameters::ZeitgeistTreasuryAccount; +use crate::parachain_params::MinCandidateStk; use crate::integration_tests::xcm::setup::accounts; -use crate::xcm_config::config::battery_station::ID as parachain_id; use crate::integration_tests::xcm::setup::ztg; use crate::integration_tests::xcm::setup::roc; use crate::integration_tests::xcm::setup::FOREIGN_PARENT_ID; use sp_core::storage::Storage; use sp_runtime::BuildStorage; use crate::Asset; +use nimbus_primitives::NimbusId; const ENDOWMENT_ZTG: u128 = ztg(1_000_000); const ENDOWMENT_ROC: u128 = roc(1_000_000); const SAFE_XCM_VERSION: u32 = 2; -pub(crate) fn genesis() -> Storage { +pub(crate) fn genesis(parachain_id: u32) -> Storage { let genesis_config = crate::RuntimeGenesisConfig { - system: crate::SystemConfig { - code: crate::WASM_BINARY.unwrap().to_vec(), - ..Default::default() + author_mapping: crate::AuthorMappingConfig { + mappings: vec![(accounts::get_from_seed::(accounts::ALICE), accounts::alice())] + }, + balances: crate::BalancesConfig { + balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT_ZTG)).collect() }, - - /* - asset_registry: crate::AssetRegistryConfig { - - } - - author_mapping: $runtime::AuthorMappingConfig { - mappings: acs - .candidates - .iter() - .cloned() - .map(|(account_id, author_id, _)| (author_id, account_id)) - .collect(), + parachain_info: crate::ParachainInfoConfig { + parachain_id: parachain_id.into(), + ..Default::default() }, - - parachain_staking: $runtime::ParachainStakingConfig { - blocks_per_round: acs.blocks_per_round, - candidates: acs - .candidates - .iter() - .cloned() - .map(|(account, _, bond)| (account, bond)) - .collect(), - collator_commission: acs.collator_commission, - inflation_config: acs.inflation_info, - delegations: acs.nominations, - parachain_bond_reserve_percent: acs.parachain_bond_reserve_percent, - num_selected_candidates: acs.num_selected_candidates, + parachain_staking: crate::ParachainStakingConfig { + candidates: vec![(accounts::alice(), MinCandidateStk::get())], + ..Default::default() }, - */ - - balances: crate::BalancesConfig { - balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT_ZTG)).collect(), + polkadot_xcm: crate::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() + }, + system: crate::SystemConfig { + code: crate::WASM_BINARY.unwrap().to_vec(), + ..Default::default() }, - tokens: crate::TokensConfig { balances: accounts::init_balances(). iter() @@ -79,16 +63,6 @@ pub(crate) fn genesis() -> Storage { .map(|k| (k.clone(), Asset::from(FOREIGN_PARENT_ID).try_into().unwrap(), ENDOWMENT_ROC)) .collect::>() }, - - parachain_info: crate::ParachainInfoConfig { - parachain_id: parachain_id.into(), - ..Default::default() - }, - - polkadot_xcm: crate::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - ..Default::default() - }, ..Default::default() }; diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs index d75a64ea5..937eb99e4 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs @@ -31,6 +31,7 @@ use polkadot_runtime_parachains::configuration::HostConfiguration; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use crate::integration_tests::xcm::setup::roc; use xcm_emulator::helpers::get_account_id_from_seed; +use crate::integration_tests::xcm::setup::accounts::get_from_seed; use sp_core::sr25519; pub const ED: Balance = rococo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; @@ -56,13 +57,6 @@ fn session_keys( } } -/// Helper function to generate a crypto pair from seed -fn get_from_seed(seed: &str) -> ::Public { - TPublic::Pair::from_string(&format!("//{}", seed), None) - .expect("static values are valid; qed") - .public() -} - fn get_host_config() -> HostConfiguration { HostConfiguration { max_upward_queue_count: 10, diff --git a/runtime/battery-station/src/integration_tests/xcm/setup.rs b/runtime/battery-station/src/integration_tests/xcm/setup.rs index 1521405f6..4a892146b 100644 --- a/runtime/battery-station/src/integration_tests/xcm/setup.rs +++ b/runtime/battery-station/src/integration_tests/xcm/setup.rs @@ -21,7 +21,7 @@ use crate::{ AccountId, AssetRegistry, AssetRegistryStringLimit, Assets, Balance, ExistentialDeposit, Runtime, RuntimeOrigin, System, }; -use sp_core::sr25519; +use sp_core::{Public, Pair, sr25519}; use frame_support::assert_ok; use orml_traits::asset_registry::AssetMetadata; use sp_runtime::{AccountId32, BuildStorage}; @@ -65,11 +65,23 @@ pub(super) mod accounts { get_account_id_from_seed::(FERDIE_STASH), ] } + + pub fn alice() -> AccountId { + get_account_id_from_seed::(ALICE) + } + + /// Helper function to generate a crypto pair from seed + pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() + } } /// A PARA ID used for a sibling parachain. /// It must be one that doesn't collide with any other in use. pub const PARA_ID_SIBLING: u32 = 3000; +pub const PARA_ID_BATTERY_STATION: u32 = battery_station::ID; /// IDs that are used to represent tokens from other chains pub const FOREIGN_ZTG_ID: XcmAsset = XcmAsset::ForeignAsset(0); diff --git a/runtime/battery-station/src/integration_tests/xcm/test_net.rs b/runtime/battery-station/src/integration_tests/xcm/test_net.rs index a5c66641e..b1ee8243b 100644 --- a/runtime/battery-station/src/integration_tests/xcm/test_net.rs +++ b/runtime/battery-station/src/integration_tests/xcm/test_net.rs @@ -24,12 +24,13 @@ use polkadot_runtime_parachains::configuration::HostConfiguration; use sp_runtime::BuildStorage; use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, DefaultMessageProcessor}; -use super::setup::{roc, ztg, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; +use super::setup::{roc, ztg, FOREIGN_PARENT_ID, PARA_ID_SIBLING, PARA_ID_BATTERY_STATION}; +use super::genesis::{battery_station as battery_station_genesis, rococo}; decl_test_relay_chains! { #[api_version(5)] pub struct Rococo { - genesis = crate::integration_tests::xcm::genesis::rococo::genesis(), + genesis = rococo::genesis(), on_init = (), runtime = rococo_runtime, core = { @@ -46,7 +47,24 @@ decl_test_relay_chains! { decl_test_parachains! { pub struct BatteryStation { - genesis = crate::integration_tests::xcm::genesis::battery_station::genesis(), + genesis = battery_station_genesis::genesis(PARA_ID_BATTERY_STATION), + on_init = (), + runtime = crate, + core = { + XcmpMessageHandler: XcmpQueue, + DmpMessageHandler: DmpQueue, + LocationToAccountId: LocationToAccountId, + ParachainInfo: ParachainInfo, + }, + pallets = { + PolkadotXcm: PolkadotXcm, + AssetManager: AssetManager, + Balances: Balances, + XTokens: XTokens, + } + }, + pub struct Sibling { + genesis = battery_station_genesis::genesis(PARA_ID_SIBLING), on_init = (), runtime = crate, core = { @@ -64,24 +82,12 @@ decl_test_parachains! { }, } -type BlockNumber = u64; - -/* -decl_test_parachain! { - pub struct Sibling { - Runtime = Runtime, - XcmpMessageHandler = XcmpQueue, - DmpMessageHandler = DmpQueue, - new_ext = para_ext(PARA_ID_SIBLING), - } -} -*/ - decl_test_networks! { pub struct TestNet { relay_chain = Rococo, parachains = vec![ BatteryStation, + Sibling, ], bridge = () } From 0ecf8e8af935d2515f66859485366375bfeb2e5b Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sat, 27 Apr 2024 21:02:24 +0200 Subject: [PATCH 06/12] Fix Rococo tests --- .../src/integration_tests/xcm/setup.rs | 5 +- .../src/integration_tests/xcm/test_net.rs | 1 - .../xcm/tests/currency_id_convert.rs | 18 +- .../integration_tests/xcm/tests/transfers.rs | 159 ++++++++++-------- 4 files changed, 98 insertions(+), 85 deletions(-) diff --git a/runtime/battery-station/src/integration_tests/xcm/setup.rs b/runtime/battery-station/src/integration_tests/xcm/setup.rs index 4a892146b..aa37a1505 100644 --- a/runtime/battery-station/src/integration_tests/xcm/setup.rs +++ b/runtime/battery-station/src/integration_tests/xcm/setup.rs @@ -1,5 +1,4 @@ // Copyright 2022-2024 Forecasting Technologies LTD. -// Copyright 2021 Centrifuge Foundation (centrifuge.io). // // This file is part of Zeitgeist. // @@ -70,6 +69,10 @@ pub(super) mod accounts { get_account_id_from_seed::(ALICE) } + pub fn bob() -> AccountId { + get_account_id_from_seed::(BOB) + } + /// Helper function to generate a crypto pair from seed pub fn get_from_seed(seed: &str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None) diff --git a/runtime/battery-station/src/integration_tests/xcm/test_net.rs b/runtime/battery-station/src/integration_tests/xcm/test_net.rs index b1ee8243b..07e9a2ae0 100644 --- a/runtime/battery-station/src/integration_tests/xcm/test_net.rs +++ b/runtime/battery-station/src/integration_tests/xcm/test_net.rs @@ -1,5 +1,4 @@ // Copyright 2022-2024 Forecasting Technologies LTD. -// Copyright 2021-2022 Centrifuge GmbH (centrifuge.io). // // This file is part of Zeitgeist. // diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs index f006b9a81..c7b67fee5 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs @@ -23,6 +23,7 @@ use crate::{ register_foreign_parent, register_foreign_sibling, FOREIGN_PARENT_ID, FOREIGN_SIBLING_ID, }, + test_net::BatteryStation }, xcm_config::config::{battery_station, general_key, AssetConvert}, Assets, CustomMetadata, ScalarPosition, XcmAsset, @@ -31,8 +32,8 @@ use core::fmt::Debug; use sp_runtime::traits::{Convert, MaybeEquivalence}; use test_case::test_case; use xcm::latest::{Junction::*, Junctions::*, MultiLocation}; +use xcm_emulator::TestExt; -/* fn convert_common_native(expected: T) where T: Copy + Debug + PartialEq, @@ -40,7 +41,7 @@ where { assert_eq!(battery_station::KEY.to_vec(), vec![0, 1]); - // The way Ztg is represented relative within the Zeitgeist runtime + // The way Ztg is represented relative within the Battery Station runtime let ztg_location_inner: MultiLocation = MultiLocation::new(0, X1(general_key(battery_station::KEY))); @@ -50,7 +51,7 @@ where ); // The canonical way Ztg is represented out in the wild - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { assert_eq!( >::convert(expected), Some(foreign_ztg_multilocation()) @@ -66,10 +67,10 @@ fn convert_common_non_native( T: Copy + Debug + PartialEq, AssetConvert: MaybeEquivalence + Convert>, { - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { assert_eq!(>::convert(&multilocation), None); assert_eq!(>::convert(expected), None); - // Register parent as foreign asset in the Zeitgeist parachain + // Register parent as foreign asset in the BatteryStation parachain register(None); assert_eq!( >::convert(&multilocation), @@ -130,7 +131,7 @@ fn convert_unkown_multilocation() { let unknown_location: MultiLocation = MultiLocation::new(1, X2(Parachain(battery_station::ID), general_key(&[42]))); - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { assert!( >::convert(&unknown_location).is_none() ); @@ -174,6 +175,5 @@ where T: Copy + Debug + PartialEq, AssetConvert: Convert>, { - Zeitgeist::execute_with(|| assert_eq!(>::convert(asset), None)); -} -*/ \ No newline at end of file + BatteryStation::execute_with(|| assert_eq!(>::convert(asset), None)); +} \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs index e370b6f63..97d75bf16 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs @@ -20,9 +20,10 @@ use crate::{ integration_tests::xcm::{ setup::{ adjusted_balance, btc, register_btc, register_foreign_parent, register_foreign_ztg, - roc, sibling_parachain_account, zeitgeist_parachain_account, ztg, BTC_ID, - FOREIGN_PARENT_ID, FOREIGN_ZTG_ID, PARA_ID_SIBLING, + roc, sibling_parachain_account, zeitgeist_parachain_account, ztg, BTC_ID, PARA_ID_BATTERY_STATION, + FOREIGN_PARENT_ID, FOREIGN_ZTG_ID, PARA_ID_SIBLING, accounts::{alice, bob} }, + test_net::{BatteryStation, Rococo} }, xcm_config::{config::battery_station, fees::default_per_second}, AssetManager, AssetRegistry, Balance, Balances, RuntimeOrigin, XTokens, @@ -37,6 +38,7 @@ use zeitgeist_primitives::{ constants::{BalanceFractionalDecimals, BASE}, types::{CustomMetadata, XcmAsset, XcmMetadata}, }; +use xcm_emulator::RelayChain; /* #[test] @@ -50,15 +52,15 @@ fn transfer_ztg_to_sibling() { Sibling::execute_with(|| { treasury_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB), 0); + assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), 0); register_foreign_ztg(None); }); - Zeitgeist::execute_with(|| { - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance); + BatteryStation::execute_with(|| { + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance); assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), XcmAsset::Ztg, transfer_amount, Box::new( @@ -66,7 +68,7 @@ fn transfer_ztg_to_sibling() { 1, X2( Parachain(PARA_ID_SIBLING), - Junction::AccountId32 { network: None, id: BOB.into() } + Junction::AccountId32 { network: None, id: bob().into() } ) ) .into() @@ -75,16 +77,16 @@ fn transfer_ztg_to_sibling() { )); // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance - transfer_amount); + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); // Verify that the amount transferred is now part of the sibling account here assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); }); Sibling::execute_with(|| { - let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB); + let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); - // Verify that BOB now has (amount transferred - fee) + // Verify that bob() now has (amount transferred - fee) assert_eq!(current_balance, transfer_amount - ztg_fee()); // Verify that fees (of foreign currency) have been put into treasury @@ -99,8 +101,8 @@ fn transfer_ztg_to_sibling() { fn transfer_ztg_sibling_to_zeitgeist() { TestNet::reset(); - // In order to be able to transfer ZTG from Sibling to Zeitgeist, we need to first send - // ZTG from Zeitgeist to Sibling, or else it fails since it'd be like Sibling had minted + // In order to be able to transfer ZTG from Sibling to BatteryStation, we need to first send + // ZTG from BatteryStation to Sibling, or else it fails since it'd be like Sibling had minted // ZTG on their side. transfer_ztg_to_sibling(); @@ -111,10 +113,10 @@ fn transfer_ztg_sibling_to_zeitgeist() { let transfer_amount = ztg(1); // Note: This asset was registered in `transfer_ztg_to_sibling` - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { treasury_initial_balance = Balances::free_balance(ZeitgeistTreasuryAccount::get()); - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance); + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance); assert_eq!( Balances::free_balance(sibling_parachain_account()), sibling_sovereign_initial_balance @@ -123,9 +125,9 @@ fn transfer_ztg_sibling_to_zeitgeist() { Sibling::execute_with(|| { assert_eq!(Balances::free_balance(zeitgeist_parachain_account()), 0); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB), bob_initial_balance); + assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), bob_initial_balance); assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(BOB), + RuntimeOrigin::signed(bob()), FOREIGN_ZTG_ID, transfer_amount, Box::new( @@ -133,7 +135,7 @@ fn transfer_ztg_sibling_to_zeitgeist() { 1, X2( Parachain(battery_station::ID), - Junction::AccountId32 { network: None, id: ALICE.into() } + Junction::AccountId32 { network: None, id: alice().into() } ) ) .into() @@ -143,15 +145,15 @@ fn transfer_ztg_sibling_to_zeitgeist() { // Confirm that Bobs's balance is initial balance - amount transferred assert_eq!( - AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB), + AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), bob_initial_balance - transfer_amount ); }); - Zeitgeist::execute_with(|| { - // Verify that ALICE now has initial balance + amount transferred - fee + BatteryStation::execute_with(|| { + // Verify that alice() now has initial balance + amount transferred - fee assert_eq!( - Balances::free_balance(&ALICE), + Balances::free_balance(&alice()), alice_initial_balance + transfer_amount - ztg_fee(), ); @@ -179,25 +181,25 @@ fn transfer_btc_sibling_to_zeitgeist() { let transfer_amount = btc(100); let mut treasury_initial_balance = 0; - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { register_btc(None); treasury_initial_balance = AssetManager::free_balance(BTC_ID.into(), &ZeitgeistTreasuryAccount::get()); assert_eq!( - AssetManager::free_balance(BTC_ID.into(), &ALICE), + AssetManager::free_balance(BTC_ID.into(), &alice()), zeitgeist_alice_initial_balance, ); }); Sibling::execute_with(|| { - assert_eq!(Balances::free_balance(&ALICE), sibling_alice_initial_balance); + assert_eq!(Balances::free_balance(&alice()), sibling_alice_initial_balance); // Set the sovereign balance such that it is not subject to dust collection assert_eq!( Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), initial_sovereign_balance ); assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), // Target chain will interpret XcmAsset::Ztg as BTC in this context. XcmAsset::Ztg, transfer_amount, @@ -206,7 +208,7 @@ fn transfer_btc_sibling_to_zeitgeist() { 1, X2( Parachain(battery_station::ID), - Junction::AccountId32 { network: None, id: ALICE.into() } + Junction::AccountId32 { network: None, id: alice().into() } ) ) .into() @@ -215,7 +217,7 @@ fn transfer_btc_sibling_to_zeitgeist() { )); // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&ALICE), sibling_alice_initial_balance - transfer_amount); + assert_eq!(Balances::free_balance(&alice()), sibling_alice_initial_balance - transfer_amount); // Verify that the amount transferred is now part of the zeitgeist account here assert_eq!( @@ -224,13 +226,13 @@ fn transfer_btc_sibling_to_zeitgeist() { ); }); - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { let expected = transfer_amount - btc_fee(); let expected_adjusted = adjusted_balance(btc(1), expected); // Verify that remote Alice now has initial balance + amount transferred - fee assert_eq!( - AssetManager::free_balance(BTC_ID.into(), &ALICE), + AssetManager::free_balance(BTC_ID.into(), &alice()), zeitgeist_alice_initial_balance + expected_adjusted, ); @@ -254,12 +256,12 @@ fn transfer_btc_zeitgeist_to_sibling() { transfer_btc_sibling_to_zeitgeist(); Sibling::execute_with(|| { - assert_eq!(AssetManager::free_balance(BTC_ID.into(), &BOB), sibling_bob_initial_balance,); + assert_eq!(AssetManager::free_balance(BTC_ID.into(), &bob()), sibling_bob_initial_balance,); }); - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), BTC_ID, transfer_amount, Box::new( @@ -267,7 +269,7 @@ fn transfer_btc_zeitgeist_to_sibling() { 1, X2( Parachain(PARA_ID_SIBLING), - Junction::AccountId32 { network: None, id: BOB.into() } + Junction::AccountId32 { network: None, id: bob().into() } ) ) .into() @@ -276,7 +278,7 @@ fn transfer_btc_zeitgeist_to_sibling() { )); // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(AssetManager::free_balance(BTC_ID.into(), &ALICE), 0); + assert_eq!(AssetManager::free_balance(BTC_ID.into(), &alice()), 0); }); Sibling::execute_with(|| { @@ -284,7 +286,7 @@ fn transfer_btc_zeitgeist_to_sibling() { let expected = transfer_amount - fee_adjusted; // Verify that Bob now has initial balance + amount transferred - fee - assert_eq!(Balances::free_balance(&BOB), sibling_bob_initial_balance + expected,); + assert_eq!(Balances::free_balance(&bob()), sibling_bob_initial_balance + expected,); // Verify that the amount transferred is now subtracted from the zeitgeist account at sibling assert_eq!( @@ -293,80 +295,91 @@ fn transfer_btc_zeitgeist_to_sibling() { ); }); } +*/ #[test] fn transfer_roc_from_relay_chain() { - TestNet::reset(); - let transfer_amount: Balance = roc(1); let mut treasury_initial_balance = 0; + let mut bob_initial_balance = 0; - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { register_foreign_parent(None); treasury_initial_balance = AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ZeitgeistTreasuryAccount::get()); + bob_initial_balance = + AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &bob()); }); - RococoNet::execute_with(|| { - let initial_balance = rococo_runtime::Balances::free_balance(&ALICE); + Rococo::execute_with(|| { + let initial_balance = rococo_runtime::Balances::free_balance(&alice()); assert!(initial_balance >= transfer_amount); assert_ok!(rococo_runtime::XcmPallet::reserve_transfer_assets( - rococo_runtime::RuntimeOrigin::signed(ALICE), + rococo_runtime::RuntimeOrigin::signed(alice()), Box::new(Parachain(battery_station::ID).into()), - Box::new(Junction::AccountId32 { network: None, id: BOB.into() }.into()), + Box::new(Junction::AccountId32 { network: None, id: bob().into() }.into()), Box::new((Here, transfer_amount).into()), 0 )); }); - Zeitgeist::execute_with(|| { + BatteryStation::execute_with(|| { let expected = transfer_amount - roc_fee(); - let expected_adjusted = adjusted_balance(roc(1), expected); - assert_eq!(AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &BOB), expected_adjusted); + let bob_expected = bob_initial_balance + adjusted_balance(roc(1), expected); + let treasury_expected = treasury_initial_balance + adjusted_balance(roc(1), roc_fee()); + + assert_eq!(AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &bob()), bob_expected); // Verify that fees (of foreign currency) have been put into treasury assert_eq!( AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ZeitgeistTreasuryAccount::get()), - // Align decimal fractional places - treasury_initial_balance + adjusted_balance(roc(1), roc_fee()) + treasury_expected ) }); } #[test] fn transfer_roc_to_relay_chain() { - TestNet::reset(); - let transfer_amount: Balance = roc(1); let transfer_amount_local: Balance = adjusted_balance(roc(1), transfer_amount); - transfer_roc_from_relay_chain(); + let mut initial_balance_bob = 0; - Zeitgeist::execute_with(|| { - let initial_balance = AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ALICE); - assert!(initial_balance >= transfer_amount); + Rococo::execute_with(|| { + initial_balance_bob = rococo_runtime::Balances::free_balance(&bob()); + let bs_acc = Rococo::sovereign_account_id_of_child_para(PARA_ID_BATTERY_STATION.into()); + rococo_runtime::Balances::set_balance(&bs_acc, transfer_amount); + }); + + BatteryStation::execute_with(|| { + register_foreign_parent(None); + let initial_balance = AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &alice()); + assert!(initial_balance >= transfer_amount_local); assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), FOREIGN_PARENT_ID, transfer_amount, Box::new( - MultiLocation::new(1, X1(Junction::AccountId32 { id: BOB.into(), network: None })) + MultiLocation::new(1, X1(Junction::AccountId32 { id: bob().into(), network: None })) .into() ), WeightLimit::Limited(4_000_000_000.into()) )); assert_eq!( - AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ALICE), + AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &alice()), initial_balance - transfer_amount_local ) }); - RococoNet::execute_with(|| { - assert_eq!(rococo_runtime::Balances::free_balance(&BOB), 999_990_415_728); + Rococo::execute_with(|| { + let expected_fee = 10_454_619; + let expected_balance_bob = initial_balance_bob + transfer_amount - expected_fee; + assert_eq!(rococo_runtime::Balances::free_balance(&bob()), expected_balance_bob); }); } +/* #[test] fn transfer_ztg_to_sibling_with_custom_fee() { TestNet::reset(); @@ -380,7 +393,7 @@ fn transfer_ztg_to_sibling_with_custom_fee() { Sibling::execute_with(|| { treasury_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB), 0); + assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), 0); register_foreign_ztg(None); let custom_metadata = CustomMetadata { @@ -398,11 +411,11 @@ fn transfer_ztg_to_sibling_with_custom_fee() { )); }); - Zeitgeist::execute_with(|| { - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance); + BatteryStation::execute_with(|| { + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance); assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), XcmAsset::Ztg, transfer_amount, Box::new( @@ -410,7 +423,7 @@ fn transfer_ztg_to_sibling_with_custom_fee() { 1, X2( Parachain(PARA_ID_SIBLING), - Junction::AccountId32 { network: None, id: BOB.into() } + Junction::AccountId32 { network: None, id: bob().into() } ) ) .into() @@ -419,17 +432,17 @@ fn transfer_ztg_to_sibling_with_custom_fee() { )); // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance - transfer_amount); + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); // Verify that the amount transferred is now part of the sibling account here assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); }); Sibling::execute_with(|| { - let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB); + let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); let custom_fee = calc_fee(default_per_second(10) * 10); - // Verify that BOB now has (amount transferred - fee) + // Verify that bob() now has (amount transferred - fee) assert_eq!(current_balance, transfer_amount - ztg_fee() * fee_factor / BASE); // Verify that fees (of foreign currency) have been put into treasury @@ -439,11 +452,12 @@ fn transfer_ztg_to_sibling_with_custom_fee() { ) }); } +*/ #[test] fn test_total_fee() { - assert_eq!(ztg_fee(), 64_296_000); - assert_eq!(roc_fee(), 6_429_600_000); + assert_eq!(ztg_fee(), 80_370_000); + assert_eq!(roc_fee(), 8_037_000_000); } #[inline] @@ -469,9 +483,6 @@ fn btc_fee() -> Balance { #[inline] const fn calc_fee(fee_per_second: Balance) -> Balance { - // We divide the fee to align its unit and multiply by 8 as that seems to be the unit of - // time the tests take. - // NOTE: it is possible that in different machines this value may differ. We shall see. - fee_per_second / 10_000 * 8 -} -*/ \ No newline at end of file + // Adjust fee per second to actual test execution time + fee_per_second / 1_000 +} \ No newline at end of file From 81cc031485c008074bf60abda642b0d02a94e512 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sat, 27 Apr 2024 23:00:16 +0200 Subject: [PATCH 07/12] Fix all XCM tests on Battery Station --- .../xcm/genesis/battery_station.rs | 25 +-- .../integration_tests/xcm/genesis/rococo.rs | 4 +- .../src/integration_tests/xcm/setup.rs | 10 +- .../src/integration_tests/xcm/test_net.rs | 13 +- .../xcm/tests/currency_id_convert.rs | 4 +- .../integration_tests/xcm/tests/transfers.rs | 163 +++++++----------- 6 files changed, 92 insertions(+), 127 deletions(-) diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs index bd36849d8..05ff48abb 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs @@ -19,15 +19,16 @@ use crate::parameters::ZeitgeistTreasuryAccount; use crate::parachain_params::MinCandidateStk; use crate::integration_tests::xcm::setup::accounts; use crate::integration_tests::xcm::setup::ztg; -use crate::integration_tests::xcm::setup::roc; use crate::integration_tests::xcm::setup::FOREIGN_PARENT_ID; use sp_core::storage::Storage; use sp_runtime::BuildStorage; use crate::Asset; use nimbus_primitives::NimbusId; +use crate::integration_tests::xcm::setup::BTC_ID; +use crate::integration_tests::xcm::setup::FOREIGN_SIBLING_ID; +use crate::integration_tests::xcm::setup::FOREIGN_ZTG_ID; -const ENDOWMENT_ZTG: u128 = ztg(1_000_000); -const ENDOWMENT_ROC: u128 = roc(1_000_000); +const ENDOWMENT: u128 = ztg(1_000_000); const SAFE_XCM_VERSION: u32 = 2; pub(crate) fn genesis(parachain_id: u32) -> Storage { @@ -36,7 +37,7 @@ pub(crate) fn genesis(parachain_id: u32) -> Storage { mappings: vec![(accounts::get_from_seed::(accounts::ALICE), accounts::alice())] }, balances: crate::BalancesConfig { - balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT_ZTG)).collect() + balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect() }, parachain_info: crate::ParachainInfoConfig { parachain_id: parachain_id.into(), @@ -55,12 +56,16 @@ pub(crate) fn genesis(parachain_id: u32) -> Storage { ..Default::default() }, tokens: crate::TokensConfig { - balances: accounts::init_balances(). - iter() - .chain( - vec![(ZeitgeistTreasuryAccount::get())].iter() - ) - .map(|k| (k.clone(), Asset::from(FOREIGN_PARENT_ID).try_into().unwrap(), ENDOWMENT_ROC)) + balances: accounts::init_balances() + .iter() + .chain(vec![(ZeitgeistTreasuryAccount::get())].iter()) + .map(|k| vec![ + (k.clone(), Asset::from(FOREIGN_PARENT_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(FOREIGN_SIBLING_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(FOREIGN_ZTG_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(BTC_ID).try_into().unwrap(), ENDOWMENT) + ]) + .flatten() .collect::>() }, ..Default::default() diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs index 937eb99e4..d4f590813 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs @@ -18,13 +18,12 @@ // TODO: Replace with crate "rococo-emulated-chain" from Cumulus starting from polkadot-v1.4.0 -use crate::Balance; use crate::integration_tests::xcm::setup::accounts; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_consensus_grandpa::AuthorityId as GrandpaId; -use sp_core::{storage::Storage, Pair, Public}; +use sp_core::{storage::Storage}; use sp_runtime::BuildStorage; use polkadot_primitives::{AccountId, BlockNumber, AssignmentId, ValidatorId}; use polkadot_runtime_parachains::configuration::HostConfiguration; @@ -34,7 +33,6 @@ use xcm_emulator::helpers::get_account_id_from_seed; use crate::integration_tests::xcm::setup::accounts::get_from_seed; use sp_core::sr25519; -pub const ED: Balance = rococo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; const ENDOWMENT: u128 = roc(1_000_000); fn session_keys( diff --git a/runtime/battery-station/src/integration_tests/xcm/setup.rs b/runtime/battery-station/src/integration_tests/xcm/setup.rs index aa37a1505..a9c587e92 100644 --- a/runtime/battery-station/src/integration_tests/xcm/setup.rs +++ b/runtime/battery-station/src/integration_tests/xcm/setup.rs @@ -17,13 +17,12 @@ use crate::{ xcm_config::config::{battery_station, general_key}, - AccountId, AssetRegistry, AssetRegistryStringLimit, Assets, Balance, ExistentialDeposit, - Runtime, RuntimeOrigin, System, + AccountId, AssetRegistry, AssetRegistryStringLimit, Balance, ExistentialDeposit, + RuntimeOrigin, }; use sp_core::{Public, Pair, sr25519}; use frame_support::assert_ok; use orml_traits::asset_registry::AssetMetadata; -use sp_runtime::{AccountId32, BuildStorage}; use xcm::{ latest::{Junction::Parachain, Junctions::X2, MultiLocation}, VersionedMultiLocation, @@ -46,7 +45,6 @@ pub(super) mod accounts { pub const DAVE_STASH: &str = "Dave//stash"; pub const EVE_STASH: &str = "Eve//stash"; pub const FERDIE_STASH: &str = "Ferdie//stash"; - pub const FERDIE_BEEFY: &str = "Ferdie//stash"; pub fn init_balances() -> Vec { vec![ @@ -129,7 +127,7 @@ pub(super) const fn adjusted_balance(foreign_base: Balance, amount: Balance) -> // Multilocations that are used to represent tokens from other chains #[inline] pub(super) fn foreign_ztg_multilocation() -> MultiLocation { - MultiLocation::new(1, X2(Parachain(battery_station::ID), general_key(battery_station::KEY))) + MultiLocation::new(1, X2(Parachain(PARA_ID_BATTERY_STATION), general_key(battery_station::KEY))) } #[inline] @@ -208,7 +206,7 @@ pub(super) fn sibling_parachain_account() -> AccountId { #[inline] pub(super) fn zeitgeist_parachain_account() -> AccountId { - parachain_account(battery_station::ID) + parachain_account(PARA_ID_BATTERY_STATION) } #[inline] diff --git a/runtime/battery-station/src/integration_tests/xcm/test_net.rs b/runtime/battery-station/src/integration_tests/xcm/test_net.rs index 07e9a2ae0..432adee4d 100644 --- a/runtime/battery-station/src/integration_tests/xcm/test_net.rs +++ b/runtime/battery-station/src/integration_tests/xcm/test_net.rs @@ -16,15 +16,12 @@ // along with Zeitgeist. If not, see . use crate::{ - parameters::ZeitgeistTreasuryAccount, xcm_config::config::{LocationToAccountId}, battery_station, Assets, DmpQueue, + xcm_config::config::{LocationToAccountId}, DmpQueue, XcmpQueue, ParachainInfo, PolkadotXcm, AssetManager, Balances, XTokens }; -use polkadot_runtime_parachains::configuration::HostConfiguration; -use sp_runtime::BuildStorage; use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, DefaultMessageProcessor}; - -use super::setup::{roc, ztg, FOREIGN_PARENT_ID, PARA_ID_SIBLING, PARA_ID_BATTERY_STATION}; -use super::genesis::{battery_station as battery_station_genesis, rococo}; +use super::setup::{PARA_ID_SIBLING, PARA_ID_BATTERY_STATION}; +use super::genesis::{battery_station, rococo}; decl_test_relay_chains! { #[api_version(5)] @@ -46,7 +43,7 @@ decl_test_relay_chains! { decl_test_parachains! { pub struct BatteryStation { - genesis = battery_station_genesis::genesis(PARA_ID_BATTERY_STATION), + genesis = battery_station::genesis(PARA_ID_BATTERY_STATION), on_init = (), runtime = crate, core = { @@ -63,7 +60,7 @@ decl_test_parachains! { } }, pub struct Sibling { - genesis = battery_station_genesis::genesis(PARA_ID_SIBLING), + genesis = battery_station::genesis(PARA_ID_SIBLING), on_init = (), runtime = crate, core = { diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs index c7b67fee5..1ca7c5ae9 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs @@ -21,7 +21,7 @@ use crate::{ setup::{ foreign_parent_multilocation, foreign_sibling_multilocation, foreign_ztg_multilocation, register_foreign_parent, register_foreign_sibling, FOREIGN_PARENT_ID, - FOREIGN_SIBLING_ID, + FOREIGN_SIBLING_ID, PARA_ID_BATTERY_STATION, }, test_net::BatteryStation }, @@ -129,7 +129,7 @@ fn convert_any_registered_sibling_multilocation_xcm_assets() { #[test] fn convert_unkown_multilocation() { let unknown_location: MultiLocation = - MultiLocation::new(1, X2(Parachain(battery_station::ID), general_key(&[42]))); + MultiLocation::new(1, X2(Parachain(PARA_ID_BATTERY_STATION), general_key(&[42]))); BatteryStation::execute_with(|| { assert!( diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs index 97d75bf16..d7cbe609d 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs @@ -23,10 +23,10 @@ use crate::{ roc, sibling_parachain_account, zeitgeist_parachain_account, ztg, BTC_ID, PARA_ID_BATTERY_STATION, FOREIGN_PARENT_ID, FOREIGN_ZTG_ID, PARA_ID_SIBLING, accounts::{alice, bob} }, - test_net::{BatteryStation, Rococo} + test_net::{BatteryStation, Rococo, Sibling} }, xcm_config::{config::battery_station, fees::default_per_second}, - AssetManager, AssetRegistry, Balance, Balances, RuntimeOrigin, XTokens, + AssetManager, Balance, Balances, RuntimeOrigin, XTokens, ZeitgeistTreasuryAccount, }; @@ -40,24 +40,22 @@ use zeitgeist_primitives::{ }; use xcm_emulator::RelayChain; -/* #[test] fn transfer_ztg_to_sibling() { - TestNet::reset(); - - let alice_initial_balance = ztg(10); + let mut alice_initial_balance = 0; + let mut bob_initial_balance = 0; let transfer_amount = ztg(5); let mut treasury_initial_balance = 0; Sibling::execute_with(|| { treasury_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), 0); + bob_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); register_foreign_ztg(None); }); BatteryStation::execute_with(|| { - assert_eq!(Balances::free_balance(&alice()), alice_initial_balance); + alice_initial_balance = Balances::free_balance(&alice()); assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); assert_ok!(XTokens::transfer( RuntimeOrigin::signed(alice()), @@ -78,54 +76,43 @@ fn transfer_ztg_to_sibling() { // Confirm that Alice's balance is initial_balance - amount_transferred assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); - // Verify that the amount transferred is now part of the sibling account here assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); }); Sibling::execute_with(|| { let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); + let bob_expected = bob_initial_balance + transfer_amount - ztg_fee(); + let treasury_expected = treasury_initial_balance + ztg_fee(); // Verify that bob() now has (amount transferred - fee) - assert_eq!(current_balance, transfer_amount - ztg_fee()); - + assert_eq!(current_balance, bob_expected); // Verify that fees (of foreign currency) have been put into treasury assert_eq!( AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()), - treasury_initial_balance + ztg_fee() + treasury_expected ) }); } + #[test] fn transfer_ztg_sibling_to_zeitgeist() { - TestNet::reset(); - - // In order to be able to transfer ZTG from Sibling to BatteryStation, we need to first send - // ZTG from BatteryStation to Sibling, or else it fails since it'd be like Sibling had minted - // ZTG on their side. - transfer_ztg_to_sibling(); - - let alice_initial_balance = ztg(5); - let bob_initial_balance = ztg(5) - ztg_fee(); + let mut alice_initial_balance = 0; let mut treasury_initial_balance = 0; - let sibling_sovereign_initial_balance = ztg(5); let transfer_amount = ztg(1); - // Note: This asset was registered in `transfer_ztg_to_sibling` + let sibling_initial_balance = transfer_amount; BatteryStation::execute_with(|| { treasury_initial_balance = Balances::free_balance(ZeitgeistTreasuryAccount::get()); - - assert_eq!(Balances::free_balance(&alice()), alice_initial_balance); - assert_eq!( - Balances::free_balance(sibling_parachain_account()), - sibling_sovereign_initial_balance - ); + alice_initial_balance = Balances::free_balance(&alice()); + assert_eq!(Balances::set_balance(&sibling_parachain_account(), sibling_initial_balance), sibling_initial_balance); }); Sibling::execute_with(|| { - assert_eq!(Balances::free_balance(zeitgeist_parachain_account()), 0); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), bob_initial_balance); + register_foreign_ztg(None); + let bob_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); + assert_ok!(XTokens::transfer( RuntimeOrigin::signed(bob()), FOREIGN_ZTG_ID, @@ -142,7 +129,6 @@ fn transfer_ztg_sibling_to_zeitgeist() { ), WeightLimit::Limited(4_000_000_000.into()), )); - // Confirm that Bobs's balance is initial balance - amount transferred assert_eq!( AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), @@ -156,13 +142,11 @@ fn transfer_ztg_sibling_to_zeitgeist() { Balances::free_balance(&alice()), alice_initial_balance + transfer_amount - ztg_fee(), ); - // Verify that the reserve has been adjusted properly assert_eq!( Balances::free_balance(sibling_parachain_account()), - sibling_sovereign_initial_balance - transfer_amount + sibling_initial_balance - transfer_amount ); - // Verify that fees (of native currency) have been put into treasury assert_eq!( Balances::free_balance(ZeitgeistTreasuryAccount::get()), @@ -173,11 +157,7 @@ fn transfer_ztg_sibling_to_zeitgeist() { #[test] fn transfer_btc_sibling_to_zeitgeist() { - TestNet::reset(); - - let sibling_alice_initial_balance = ztg(10); - let zeitgeist_alice_initial_balance = btc(0); - let initial_sovereign_balance = btc(100); + let mut zeitgeist_alice_initial_balance = 0; let transfer_amount = btc(100); let mut treasury_initial_balance = 0; @@ -185,14 +165,13 @@ fn transfer_btc_sibling_to_zeitgeist() { register_btc(None); treasury_initial_balance = AssetManager::free_balance(BTC_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!( - AssetManager::free_balance(BTC_ID.into(), &alice()), - zeitgeist_alice_initial_balance, - ); + zeitgeist_alice_initial_balance = AssetManager::free_balance(BTC_ID.into(), &alice()); }); Sibling::execute_with(|| { - assert_eq!(Balances::free_balance(&alice()), sibling_alice_initial_balance); + let alice_initial_balance = Balances::free_balance(&alice()); + let initial_sovereign_balance = transfer_amount; + // Set the sovereign balance such that it is not subject to dust collection assert_eq!( Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), @@ -215,10 +194,8 @@ fn transfer_btc_sibling_to_zeitgeist() { ), WeightLimit::Limited(4_000_000_000.into()), )); - // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&alice()), sibling_alice_initial_balance - transfer_amount); - + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); // Verify that the amount transferred is now part of the zeitgeist account here assert_eq!( Balances::free_balance(zeitgeist_parachain_account()), @@ -229,37 +206,41 @@ fn transfer_btc_sibling_to_zeitgeist() { BatteryStation::execute_with(|| { let expected = transfer_amount - btc_fee(); let expected_adjusted = adjusted_balance(btc(1), expected); + let expected_treasury = treasury_initial_balance + adjusted_balance(btc(1), btc_fee()); // Verify that remote Alice now has initial balance + amount transferred - fee assert_eq!( AssetManager::free_balance(BTC_ID.into(), &alice()), zeitgeist_alice_initial_balance + expected_adjusted, ); - // Verify that fees (of foreign currency) have been put into treasury assert_eq!( AssetManager::free_balance(BTC_ID.into(), &ZeitgeistTreasuryAccount::get()), // Align decimal fractional places - treasury_initial_balance + adjusted_balance(btc(1), btc_fee()) + expected_treasury ) }); } #[test] fn transfer_btc_zeitgeist_to_sibling() { - TestNet::reset(); - - let transfer_amount = btc(100) - btc_fee(); - let initial_sovereign_balance = 2 * btc(100); - let sibling_bob_initial_balance = btc(0); - - transfer_btc_sibling_to_zeitgeist(); + let transfer_amount = btc(100); + let initial_sovereign_balance = transfer_amount; + let mut bob_initial_balance = 0; Sibling::execute_with(|| { - assert_eq!(AssetManager::free_balance(BTC_ID.into(), &bob()), sibling_bob_initial_balance,); + bob_initial_balance = Balances::free_balance(&bob()); + // Set the sovereign balance such that it is not subject to dust collection + assert_eq!( + Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), + initial_sovereign_balance + ); }); BatteryStation::execute_with(|| { + register_btc(None); + let alice_initial_balance = AssetManager::free_balance(BTC_ID.into(), &alice()); + assert_ok!(XTokens::transfer( RuntimeOrigin::signed(alice()), BTC_ID, @@ -278,24 +259,24 @@ fn transfer_btc_zeitgeist_to_sibling() { )); // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(AssetManager::free_balance(BTC_ID.into(), &alice()), 0); + let alice_balance = AssetManager::free_balance(BTC_ID.into(), &alice()); + let alice_expected = alice_initial_balance - adjusted_balance(btc(1), transfer_amount); + assert_eq!(alice_balance, alice_expected); }); Sibling::execute_with(|| { - let fee_adjusted = adjusted_balance(btc(1), btc_fee()); - let expected = transfer_amount - fee_adjusted; + let expected = bob_initial_balance + transfer_amount - adjusted_balance(btc(1), btc_fee()); + let expected_sovereign = initial_sovereign_balance - transfer_amount; // Verify that Bob now has initial balance + amount transferred - fee - assert_eq!(Balances::free_balance(&bob()), sibling_bob_initial_balance + expected,); - + assert_eq!(Balances::free_balance(&bob()), expected); // Verify that the amount transferred is now subtracted from the zeitgeist account at sibling assert_eq!( Balances::free_balance(zeitgeist_parachain_account()), - initial_sovereign_balance - transfer_amount + expected_sovereign ); }); } -*/ #[test] fn transfer_roc_from_relay_chain() { @@ -347,7 +328,7 @@ fn transfer_roc_to_relay_chain() { Rococo::execute_with(|| { initial_balance_bob = rococo_runtime::Balances::free_balance(&bob()); let bs_acc = Rococo::sovereign_account_id_of_child_para(PARA_ID_BATTERY_STATION.into()); - rococo_runtime::Balances::set_balance(&bs_acc, transfer_amount); + assert_eq!(rococo_runtime::Balances::set_balance(&bs_acc, transfer_amount), transfer_amount); }); BatteryStation::execute_with(|| { @@ -379,40 +360,27 @@ fn transfer_roc_to_relay_chain() { }); } -/* #[test] fn transfer_ztg_to_sibling_with_custom_fee() { - TestNet::reset(); - - let alice_initial_balance = ztg(10); // 10x fee factor, so ZTG has 10x the worth of sibling currency. let fee_factor = 100_000_000_000; let transfer_amount = ztg(5); let mut treasury_initial_balance = 0; + let mut bob_initial_balance = 0; Sibling::execute_with(|| { treasury_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), 0); - - register_foreign_ztg(None); + bob_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); let custom_metadata = CustomMetadata { xcm: XcmMetadata { fee_factor: Some(fee_factor) }, ..Default::default() }; - assert_ok!(AssetRegistry::do_update_asset( - FOREIGN_ZTG_ID, - None, - None, - None, - None, - None, - Some(custom_metadata) - )); + register_foreign_ztg(Some(custom_metadata)); }); BatteryStation::execute_with(|| { - assert_eq!(Balances::free_balance(&alice()), alice_initial_balance); + let alice_initial_balance = Balances::free_balance(&alice()); assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); assert_ok!(XTokens::transfer( RuntimeOrigin::signed(alice()), @@ -430,59 +398,58 @@ fn transfer_ztg_to_sibling_with_custom_fee() { ), WeightLimit::Limited(4_000_000_000.into()), )); - // Confirm that Alice's balance is initial_balance - amount_transferred assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); - // Verify that the amount transferred is now part of the sibling account here assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); }); Sibling::execute_with(|| { let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); - let custom_fee = calc_fee(default_per_second(10) * 10); + let custom_fee = ztg_fee() * fee_factor / BASE; + let bob_expected = bob_initial_balance + transfer_amount - custom_fee; + let treasury_expected = treasury_initial_balance + custom_fee; // Verify that bob() now has (amount transferred - fee) - assert_eq!(current_balance, transfer_amount - ztg_fee() * fee_factor / BASE); - + assert_eq!(current_balance, bob_expected); // Verify that fees (of foreign currency) have been put into treasury assert_eq!( AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()), - treasury_initial_balance + custom_fee + treasury_expected ) }); } -*/ #[test] fn test_total_fee() { - assert_eq!(ztg_fee(), 80_370_000); + assert_eq!(btc_fee(), 642_960); assert_eq!(roc_fee(), 8_037_000_000); + assert_eq!(ztg_fee(), 64_296_000); } #[inline] fn ztg_fee() -> Balance { - fee(BalanceFractionalDecimals::get().into()) + fee(BalanceFractionalDecimals::get().into(), 8) } #[inline] -fn fee(decimals: u32) -> Balance { - calc_fee(default_per_second(decimals)) +fn fee(decimals: u32, multiplier: Balance) -> Balance { + calc_fee(default_per_second(decimals), multiplier) } // The fee associated with transferring roc tokens #[inline] fn roc_fee() -> Balance { - fee(12) + fee(12, 10) } #[inline] fn btc_fee() -> Balance { - fee(8) + fee(8, 8) } #[inline] -const fn calc_fee(fee_per_second: Balance) -> Balance { +const fn calc_fee(fee_per_second: Balance, multiplier: Balance) -> Balance { // Adjust fee per second to actual test execution time - fee_per_second / 1_000 + fee_per_second / 10_000 * multiplier } \ No newline at end of file From 60e97754d7ef7bea5a94e915f3d2216ec733f199 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sat, 27 Apr 2024 23:01:37 +0200 Subject: [PATCH 08/12] Format code --- .../xcm/genesis/battery_station.rs | 56 ++--- .../src/integration_tests/xcm/genesis/mod.rs | 2 +- .../integration_tests/xcm/genesis/rococo.rs | 213 +++++++++--------- .../src/integration_tests/xcm/mod.rs | 2 +- .../src/integration_tests/xcm/setup.rs | 67 +++--- .../src/integration_tests/xcm/test_net.rs | 110 ++++----- .../xcm/tests/currency_id_convert.rs | 8 +- .../integration_tests/xcm/tests/transfers.rs | 43 ++-- 8 files changed, 255 insertions(+), 246 deletions(-) diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs index 05ff48abb..79ede9c15 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/battery_station.rs @@ -15,30 +15,32 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . -use crate::parameters::ZeitgeistTreasuryAccount; -use crate::parachain_params::MinCandidateStk; -use crate::integration_tests::xcm::setup::accounts; -use crate::integration_tests::xcm::setup::ztg; -use crate::integration_tests::xcm::setup::FOREIGN_PARENT_ID; +use crate::{ + integration_tests::xcm::setup::{ + accounts, ztg, BTC_ID, FOREIGN_PARENT_ID, FOREIGN_SIBLING_ID, FOREIGN_ZTG_ID, + }, + parachain_params::MinCandidateStk, + parameters::ZeitgeistTreasuryAccount, + Asset, +}; +use nimbus_primitives::NimbusId; use sp_core::storage::Storage; use sp_runtime::BuildStorage; -use crate::Asset; -use nimbus_primitives::NimbusId; -use crate::integration_tests::xcm::setup::BTC_ID; -use crate::integration_tests::xcm::setup::FOREIGN_SIBLING_ID; -use crate::integration_tests::xcm::setup::FOREIGN_ZTG_ID; const ENDOWMENT: u128 = ztg(1_000_000); const SAFE_XCM_VERSION: u32 = 2; pub(crate) fn genesis(parachain_id: u32) -> Storage { - let genesis_config = crate::RuntimeGenesisConfig { + let genesis_config = crate::RuntimeGenesisConfig { author_mapping: crate::AuthorMappingConfig { - mappings: vec![(accounts::get_from_seed::(accounts::ALICE), accounts::alice())] + mappings: vec![( + accounts::get_from_seed::(accounts::ALICE), + accounts::alice(), + )], }, balances: crate::BalancesConfig { - balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect() - }, + balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(), + }, parachain_info: crate::ParachainInfoConfig { parachain_id: parachain_id.into(), ..Default::default() @@ -52,24 +54,26 @@ pub(crate) fn genesis(parachain_id: u32) -> Storage { ..Default::default() }, system: crate::SystemConfig { - code: crate::WASM_BINARY.unwrap().to_vec(), - ..Default::default() - }, + code: crate::WASM_BINARY.unwrap().to_vec(), + ..Default::default() + }, tokens: crate::TokensConfig { balances: accounts::init_balances() .iter() .chain(vec![(ZeitgeistTreasuryAccount::get())].iter()) - .map(|k| vec![ - (k.clone(), Asset::from(FOREIGN_PARENT_ID).try_into().unwrap(), ENDOWMENT), - (k.clone(), Asset::from(FOREIGN_SIBLING_ID).try_into().unwrap(), ENDOWMENT), - (k.clone(), Asset::from(FOREIGN_ZTG_ID).try_into().unwrap(), ENDOWMENT), - (k.clone(), Asset::from(BTC_ID).try_into().unwrap(), ENDOWMENT) - ]) + .map(|k| { + vec![ + (k.clone(), Asset::from(FOREIGN_PARENT_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(FOREIGN_SIBLING_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(FOREIGN_ZTG_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(BTC_ID).try_into().unwrap(), ENDOWMENT), + ] + }) .flatten() - .collect::>() + .collect::>(), }, ..Default::default() - }; + }; - genesis_config.build_storage().unwrap() + genesis_config.build_storage().unwrap() } diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs index 3a3d4864b..1f5a5cdbe 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/mod.rs @@ -15,5 +15,5 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . +pub(super) mod battery_station; pub(super) mod rococo; -pub(super) mod battery_station; \ No newline at end of file diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs index d4f590813..4e0ebaf8d 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs @@ -18,134 +18,131 @@ // TODO: Replace with crate "rococo-emulated-chain" from Cumulus starting from polkadot-v1.4.0 -use crate::integration_tests::xcm::setup::accounts; +use crate::integration_tests::xcm::setup::{accounts, accounts::get_from_seed, roc}; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +use polkadot_primitives::{AccountId, AssignmentId, BlockNumber, ValidatorId}; +use polkadot_runtime_parachains::configuration::HostConfiguration; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_consensus_grandpa::AuthorityId as GrandpaId; -use sp_core::{storage::Storage}; +use sp_core::{sr25519, storage::Storage}; use sp_runtime::BuildStorage; -use polkadot_primitives::{AccountId, BlockNumber, AssignmentId, ValidatorId}; -use polkadot_runtime_parachains::configuration::HostConfiguration; -use pallet_im_online::sr25519::AuthorityId as ImOnlineId; -use crate::integration_tests::xcm::setup::roc; use xcm_emulator::helpers::get_account_id_from_seed; -use crate::integration_tests::xcm::setup::accounts::get_from_seed; -use sp_core::sr25519; const ENDOWMENT: u128 = roc(1_000_000); fn session_keys( - grandpa: GrandpaId, - babe: BabeId, - im_online: ImOnlineId, - para_validator: ValidatorId, - para_assignment: AssignmentId, - authority_discovery: AuthorityDiscoveryId, - beefy: BeefyId, + grandpa: GrandpaId, + babe: BabeId, + im_online: ImOnlineId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + beefy: BeefyId, ) -> rococo_runtime::SessionKeys { - rococo_runtime::SessionKeys { - grandpa, - babe, - im_online, - para_validator, - para_assignment, - authority_discovery, - beefy, - } + rococo_runtime::SessionKeys { + grandpa, + babe, + im_online, + para_validator, + para_assignment, + authority_discovery, + beefy, + } } fn get_host_config() -> HostConfiguration { - HostConfiguration { - max_upward_queue_count: 10, - max_upward_queue_size: 51200, - max_upward_message_size: 51200, - max_upward_message_num_per_candidate: 10, - max_downward_message_size: 51200, - hrmp_sender_deposit: 0, - hrmp_recipient_deposit: 0, - hrmp_channel_max_capacity: 1000, - hrmp_channel_max_message_size: 102400, - hrmp_channel_max_total_size: 102400, - hrmp_max_parachain_outbound_channels: 30, - hrmp_max_parachain_inbound_channels: 30, - ..Default::default() - } + HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + hrmp_sender_deposit: 0, + hrmp_recipient_deposit: 0, + hrmp_channel_max_capacity: 1000, + hrmp_channel_max_message_size: 102400, + hrmp_channel_max_total_size: 102400, + hrmp_max_parachain_outbound_channels: 30, + hrmp_max_parachain_inbound_channels: 30, + ..Default::default() + } } mod validators { - use super::*; + use super::*; - pub fn initial_authorities() -> Vec<( - AccountId, - AccountId, - GrandpaId, - BabeId, - ImOnlineId, - ValidatorId, - AssignmentId, - AuthorityDiscoveryId, - BeefyId, - )> { - let seed = "Alice"; - vec![( - get_account_id_from_seed::(&format!("{}//stash", seed)), - get_account_id_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - get_from_seed::(seed), - )] - } + pub fn initial_authorities() -> Vec<( + AccountId, + AccountId, + GrandpaId, + BabeId, + ImOnlineId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + BeefyId, + )> { + let seed = "Alice"; + vec![( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + )] + } } pub(crate) fn genesis() -> Storage { - let genesis_config = rococo_runtime::RuntimeGenesisConfig { - system: rococo_runtime::SystemConfig { - code: rococo_runtime::WASM_BINARY.unwrap().to_vec(), - ..Default::default() - }, - balances: rococo_runtime::BalancesConfig { - balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(), - }, - session: rococo_runtime::SessionConfig { - keys: validators::initial_authorities() - .iter() - .map(|x| { - ( - x.0.clone(), - x.0.clone(), - session_keys( - x.2.clone(), - x.3.clone(), - x.4.clone(), - x.5.clone(), - x.6.clone(), - x.7.clone(), - x.8.clone(), - ), - ) - }) - .collect::>(), - }, - babe: rococo_runtime::BabeConfig { - authorities: Default::default(), - epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), - ..Default::default() - }, - sudo: rococo_runtime::SudoConfig { - key: Some(get_account_id_from_seed::("Alice")), - }, - configuration: rococo_runtime::ConfigurationConfig { config: get_host_config() }, - registrar: rococo_runtime::RegistrarConfig { - next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, - ..Default::default() - }, - ..Default::default() - }; + let genesis_config = rococo_runtime::RuntimeGenesisConfig { + system: rococo_runtime::SystemConfig { + code: rococo_runtime::WASM_BINARY.unwrap().to_vec(), + ..Default::default() + }, + balances: rococo_runtime::BalancesConfig { + balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(), + }, + session: rococo_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + x.8.clone(), + ), + ) + }) + .collect::>(), + }, + babe: rococo_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() + }, + sudo: rococo_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + configuration: rococo_runtime::ConfigurationConfig { config: get_host_config() }, + registrar: rococo_runtime::RegistrarConfig { + next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, + ..Default::default() + }, + ..Default::default() + }; - genesis_config.build_storage().unwrap() + genesis_config.build_storage().unwrap() } diff --git a/runtime/battery-station/src/integration_tests/xcm/mod.rs b/runtime/battery-station/src/integration_tests/xcm/mod.rs index 930c1b2ce..9ba9a1de3 100644 --- a/runtime/battery-station/src/integration_tests/xcm/mod.rs +++ b/runtime/battery-station/src/integration_tests/xcm/mod.rs @@ -20,4 +20,4 @@ mod genesis; mod setup; mod test_net; -mod tests; \ No newline at end of file +mod tests; diff --git a/runtime/battery-station/src/integration_tests/xcm/setup.rs b/runtime/battery-station/src/integration_tests/xcm/setup.rs index a9c587e92..fb7a56474 100644 --- a/runtime/battery-station/src/integration_tests/xcm/setup.rs +++ b/runtime/battery-station/src/integration_tests/xcm/setup.rs @@ -17,51 +17,50 @@ use crate::{ xcm_config::config::{battery_station, general_key}, - AccountId, AssetRegistry, AssetRegistryStringLimit, Balance, ExistentialDeposit, - RuntimeOrigin, + AccountId, AssetRegistry, AssetRegistryStringLimit, Balance, ExistentialDeposit, RuntimeOrigin, }; -use sp_core::{Public, Pair, sr25519}; use frame_support::assert_ok; use orml_traits::asset_registry::AssetMetadata; +use sp_core::{sr25519, Pair, Public}; use xcm::{ latest::{Junction::Parachain, Junctions::X2, MultiLocation}, VersionedMultiLocation, }; -use zeitgeist_primitives::types::{CustomMetadata, XcmAsset}; use xcm_emulator::helpers::get_account_id_from_seed; +use zeitgeist_primitives::types::{CustomMetadata, XcmAsset}; /// Accounts pub(super) mod accounts { - use super::*; - pub const ALICE: &str = "Alice"; - pub const BOB: &str = "Bob"; - pub const CHARLIE: &str = "Charlie"; - pub const DAVE: &str = "Dave"; - pub const EVE: &str = "Eve"; - pub const FERDIE: &str = "Ferdie"; - pub const ALICE_STASH: &str = "Alice//stash"; - pub const BOB_STASH: &str = "Bob//stash"; - pub const CHARLIE_STASH: &str = "Charlie//stash"; - pub const DAVE_STASH: &str = "Dave//stash"; - pub const EVE_STASH: &str = "Eve//stash"; - pub const FERDIE_STASH: &str = "Ferdie//stash"; - - pub fn init_balances() -> Vec { - vec![ - get_account_id_from_seed::(ALICE), - get_account_id_from_seed::(BOB), - get_account_id_from_seed::(CHARLIE), - get_account_id_from_seed::(DAVE), - get_account_id_from_seed::(EVE), - get_account_id_from_seed::(FERDIE), - get_account_id_from_seed::(ALICE_STASH), - get_account_id_from_seed::(BOB_STASH), - get_account_id_from_seed::(CHARLIE_STASH), - get_account_id_from_seed::(DAVE_STASH), - get_account_id_from_seed::(EVE_STASH), - get_account_id_from_seed::(FERDIE_STASH), - ] - } + use super::*; + pub const ALICE: &str = "Alice"; + pub const BOB: &str = "Bob"; + pub const CHARLIE: &str = "Charlie"; + pub const DAVE: &str = "Dave"; + pub const EVE: &str = "Eve"; + pub const FERDIE: &str = "Ferdie"; + pub const ALICE_STASH: &str = "Alice//stash"; + pub const BOB_STASH: &str = "Bob//stash"; + pub const CHARLIE_STASH: &str = "Charlie//stash"; + pub const DAVE_STASH: &str = "Dave//stash"; + pub const EVE_STASH: &str = "Eve//stash"; + pub const FERDIE_STASH: &str = "Ferdie//stash"; + + pub fn init_balances() -> Vec { + vec![ + get_account_id_from_seed::(ALICE), + get_account_id_from_seed::(BOB), + get_account_id_from_seed::(CHARLIE), + get_account_id_from_seed::(DAVE), + get_account_id_from_seed::(EVE), + get_account_id_from_seed::(FERDIE), + get_account_id_from_seed::(ALICE_STASH), + get_account_id_from_seed::(BOB_STASH), + get_account_id_from_seed::(CHARLIE_STASH), + get_account_id_from_seed::(DAVE_STASH), + get_account_id_from_seed::(EVE_STASH), + get_account_id_from_seed::(FERDIE_STASH), + ] + } pub fn alice() -> AccountId { get_account_id_from_seed::(ALICE) diff --git a/runtime/battery-station/src/integration_tests/xcm/test_net.rs b/runtime/battery-station/src/integration_tests/xcm/test_net.rs index 432adee4d..8b11bc5ef 100644 --- a/runtime/battery-station/src/integration_tests/xcm/test_net.rs +++ b/runtime/battery-station/src/integration_tests/xcm/test_net.rs @@ -15,67 +15,71 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . +use super::{ + genesis::{battery_station, rococo}, + setup::{PARA_ID_BATTERY_STATION, PARA_ID_SIBLING}, +}; use crate::{ - xcm_config::config::{LocationToAccountId}, DmpQueue, - XcmpQueue, ParachainInfo, PolkadotXcm, AssetManager, Balances, XTokens + xcm_config::config::LocationToAccountId, AssetManager, Balances, DmpQueue, ParachainInfo, + PolkadotXcm, XTokens, XcmpQueue, +}; +use xcm_emulator::{ + decl_test_networks, decl_test_parachains, decl_test_relay_chains, DefaultMessageProcessor, }; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, DefaultMessageProcessor}; -use super::setup::{PARA_ID_SIBLING, PARA_ID_BATTERY_STATION}; -use super::genesis::{battery_station, rococo}; decl_test_relay_chains! { - #[api_version(5)] - pub struct Rococo { - genesis = rococo::genesis(), - on_init = (), - runtime = rococo_runtime, - core = { + #[api_version(5)] + pub struct Rococo { + genesis = rococo::genesis(), + on_init = (), + runtime = rococo_runtime, + core = { MessageProcessor: DefaultMessageProcessor, - SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, - }, - pallets = { - XcmPallet: rococo_runtime::XcmPallet, - Sudo: rococo_runtime::Sudo, - Balances: rococo_runtime::Balances, - } - }, + SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, + }, + pallets = { + XcmPallet: rococo_runtime::XcmPallet, + Sudo: rococo_runtime::Sudo, + Balances: rococo_runtime::Balances, + } + }, } decl_test_parachains! { - pub struct BatteryStation { - genesis = battery_station::genesis(PARA_ID_BATTERY_STATION), - on_init = (), - runtime = crate, - core = { - XcmpMessageHandler: XcmpQueue, - DmpMessageHandler: DmpQueue, - LocationToAccountId: LocationToAccountId, - ParachainInfo: ParachainInfo, - }, - pallets = { - PolkadotXcm: PolkadotXcm, - AssetManager: AssetManager, - Balances: Balances, + pub struct BatteryStation { + genesis = battery_station::genesis(PARA_ID_BATTERY_STATION), + on_init = (), + runtime = crate, + core = { + XcmpMessageHandler: XcmpQueue, + DmpMessageHandler: DmpQueue, + LocationToAccountId: LocationToAccountId, + ParachainInfo: ParachainInfo, + }, + pallets = { + PolkadotXcm: PolkadotXcm, + AssetManager: AssetManager, + Balances: Balances, XTokens: XTokens, - } - }, - pub struct Sibling { - genesis = battery_station::genesis(PARA_ID_SIBLING), - on_init = (), - runtime = crate, - core = { - XcmpMessageHandler: XcmpQueue, - DmpMessageHandler: DmpQueue, - LocationToAccountId: LocationToAccountId, - ParachainInfo: ParachainInfo, - }, - pallets = { - PolkadotXcm: PolkadotXcm, - AssetManager: AssetManager, - Balances: Balances, + } + }, + pub struct Sibling { + genesis = battery_station::genesis(PARA_ID_SIBLING), + on_init = (), + runtime = crate, + core = { + XcmpMessageHandler: XcmpQueue, + DmpMessageHandler: DmpQueue, + LocationToAccountId: LocationToAccountId, + ParachainInfo: ParachainInfo, + }, + pallets = { + PolkadotXcm: PolkadotXcm, + AssetManager: AssetManager, + Balances: Balances, XTokens: XTokens, - } - }, + } + }, } decl_test_networks! { @@ -83,8 +87,8 @@ decl_test_networks! { relay_chain = Rococo, parachains = vec![ BatteryStation, - Sibling, + Sibling, ], bridge = () } -} \ No newline at end of file +} diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs index 1ca7c5ae9..c568b95a1 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/currency_id_convert.rs @@ -23,7 +23,7 @@ use crate::{ register_foreign_parent, register_foreign_sibling, FOREIGN_PARENT_ID, FOREIGN_SIBLING_ID, PARA_ID_BATTERY_STATION, }, - test_net::BatteryStation + test_net::BatteryStation, }, xcm_config::config::{battery_station, general_key, AssetConvert}, Assets, CustomMetadata, ScalarPosition, XcmAsset, @@ -175,5 +175,7 @@ where T: Copy + Debug + PartialEq, AssetConvert: Convert>, { - BatteryStation::execute_with(|| assert_eq!(>::convert(asset), None)); -} \ No newline at end of file + BatteryStation::execute_with(|| { + assert_eq!(>::convert(asset), None) + }); +} diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs index d7cbe609d..01488885e 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs @@ -19,26 +19,25 @@ use crate::{ integration_tests::xcm::{ setup::{ + accounts::{alice, bob}, adjusted_balance, btc, register_btc, register_foreign_parent, register_foreign_ztg, - roc, sibling_parachain_account, zeitgeist_parachain_account, ztg, BTC_ID, PARA_ID_BATTERY_STATION, - FOREIGN_PARENT_ID, FOREIGN_ZTG_ID, PARA_ID_SIBLING, accounts::{alice, bob} + roc, sibling_parachain_account, zeitgeist_parachain_account, ztg, BTC_ID, + FOREIGN_PARENT_ID, FOREIGN_ZTG_ID, PARA_ID_BATTERY_STATION, PARA_ID_SIBLING, }, - test_net::{BatteryStation, Rococo, Sibling} + test_net::{BatteryStation, Rococo, Sibling}, }, xcm_config::{config::battery_station, fees::default_per_second}, - AssetManager, Balance, Balances, RuntimeOrigin, XTokens, - ZeitgeistTreasuryAccount, + AssetManager, Balance, Balances, RuntimeOrigin, XTokens, ZeitgeistTreasuryAccount, }; use frame_support::{assert_ok, traits::tokens::fungible::Mutate}; use orml_traits::MultiCurrency; use xcm::latest::{Junction, Junction::*, Junctions::*, MultiLocation, WeightLimit}; -use xcm_emulator::TestExt; +use xcm_emulator::{RelayChain, TestExt}; use zeitgeist_primitives::{ constants::{BalanceFractionalDecimals, BASE}, types::{CustomMetadata, XcmAsset, XcmMetadata}, }; -use xcm_emulator::RelayChain; #[test] fn transfer_ztg_to_sibling() { @@ -95,7 +94,6 @@ fn transfer_ztg_to_sibling() { }); } - #[test] fn transfer_ztg_sibling_to_zeitgeist() { let mut alice_initial_balance = 0; @@ -106,7 +104,10 @@ fn transfer_ztg_sibling_to_zeitgeist() { BatteryStation::execute_with(|| { treasury_initial_balance = Balances::free_balance(ZeitgeistTreasuryAccount::get()); alice_initial_balance = Balances::free_balance(&alice()); - assert_eq!(Balances::set_balance(&sibling_parachain_account(), sibling_initial_balance), sibling_initial_balance); + assert_eq!( + Balances::set_balance(&sibling_parachain_account(), sibling_initial_balance), + sibling_initial_balance + ); }); Sibling::execute_with(|| { @@ -271,10 +272,7 @@ fn transfer_btc_zeitgeist_to_sibling() { // Verify that Bob now has initial balance + amount transferred - fee assert_eq!(Balances::free_balance(&bob()), expected); // Verify that the amount transferred is now subtracted from the zeitgeist account at sibling - assert_eq!( - Balances::free_balance(zeitgeist_parachain_account()), - expected_sovereign - ); + assert_eq!(Balances::free_balance(zeitgeist_parachain_account()), expected_sovereign); }); } @@ -288,8 +286,7 @@ fn transfer_roc_from_relay_chain() { register_foreign_parent(None); treasury_initial_balance = AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ZeitgeistTreasuryAccount::get()); - bob_initial_balance = - AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &bob()); + bob_initial_balance = AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &bob()); }); Rococo::execute_with(|| { @@ -309,7 +306,7 @@ fn transfer_roc_from_relay_chain() { let expected = transfer_amount - roc_fee(); let bob_expected = bob_initial_balance + adjusted_balance(roc(1), expected); let treasury_expected = treasury_initial_balance + adjusted_balance(roc(1), roc_fee()); - + assert_eq!(AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &bob()), bob_expected); // Verify that fees (of foreign currency) have been put into treasury assert_eq!( @@ -328,7 +325,10 @@ fn transfer_roc_to_relay_chain() { Rococo::execute_with(|| { initial_balance_bob = rococo_runtime::Balances::free_balance(&bob()); let bs_acc = Rococo::sovereign_account_id_of_child_para(PARA_ID_BATTERY_STATION.into()); - assert_eq!(rococo_runtime::Balances::set_balance(&bs_acc, transfer_amount), transfer_amount); + assert_eq!( + rococo_runtime::Balances::set_balance(&bs_acc, transfer_amount), + transfer_amount + ); }); BatteryStation::execute_with(|| { @@ -341,8 +341,11 @@ fn transfer_roc_to_relay_chain() { FOREIGN_PARENT_ID, transfer_amount, Box::new( - MultiLocation::new(1, X1(Junction::AccountId32 { id: bob().into(), network: None })) - .into() + MultiLocation::new( + 1, + X1(Junction::AccountId32 { id: bob().into(), network: None }) + ) + .into() ), WeightLimit::Limited(4_000_000_000.into()) )); @@ -452,4 +455,4 @@ fn btc_fee() -> Balance { const fn calc_fee(fee_per_second: Balance, multiplier: Balance) -> Balance { // Adjust fee per second to actual test execution time fee_per_second / 10_000 * multiplier -} \ No newline at end of file +} From 70f50524bd358857ee89d29c861fd42641a81bb0 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sun, 28 Apr 2024 01:09:23 +0200 Subject: [PATCH 09/12] Finalize Battery Station XCM tests --- Cargo.lock | 1 - runtime/battery-station/Cargo.toml | 4 +--- .../src/integration_tests/xcm/genesis/rococo.rs | 2 +- .../src/integration_tests/xcm/tests/transfers.rs | 3 +++ runtime/battery-station/src/xcm_config/config.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 90d502cb6..e7240fd0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -855,7 +855,6 @@ dependencies = [ "polkadot-primitives", "polkadot-runtime-parachains", "rococo-runtime", - "rococo-runtime-constants", "scale-info", "session-keys-primitives", "sp-api", diff --git a/runtime/battery-station/Cargo.toml b/runtime/battery-station/Cargo.toml index 534f81f4f..417f6bd41 100644 --- a/runtime/battery-station/Cargo.toml +++ b/runtime/battery-station/Cargo.toml @@ -102,7 +102,6 @@ pallet-message-queue = { workspace = true, optional = true } pallet-xcm = { workspace = true, optional = true } polkadot-runtime-parachains = { workspace = true, optional = true } rococo-runtime = { workspace = true, optional = true } -rococo-runtime-constants = { workspace = true, optional = true } xcm = { workspace = true, optional = true } xcm-builder = { workspace = true, optional = true } xcm-executor = { workspace = true, optional = true } @@ -173,7 +172,6 @@ parachain = [ "pallet-xcm", "polkadot-runtime-parachains", "rococo-runtime", - "rococo-runtime-constants", "xcm-builder", "xcm-executor", "xcm", @@ -332,7 +330,6 @@ std = [ "pallet-xcm?/std", "polkadot-runtime-parachains?/std", "rococo-runtime?/std", - "rococo-runtime-constants?/std", "xcm-builder?/std", "xcm-executor?/std", "xcm?/std", @@ -340,6 +337,7 @@ std = [ # Zeitgeist "zeitgeist-primitives/std", + "zrml-asset-router/std", "zrml-authorized/std", "zrml-court/std", "zrml-hybrid-router/std", diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs index 4e0ebaf8d..dd5da8940 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . -// TODO: Replace with crate "rococo-emulated-chain" from Cumulus starting from polkadot-v1.4.0 +// TODO(#1325): Replace with crate "rococo-emulated-chain" from Cumulus starting from polkadot-v1.4.0 use crate::integration_tests::xcm::setup::{accounts, accounts::get_from_seed, roc}; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs index 01488885e..c737bc35e 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs @@ -356,6 +356,9 @@ fn transfer_roc_to_relay_chain() { ) }); + #[cfg(not(feature = "runtime-benchmarks"))] + // rococo-runtime does not process messages when runtime-benchmarks is enabled: + // https://github.com/paritytech/polkadot-sdk/blob/release-polkadot-v1.1.0/polkadot/runtime/rococo/src/lib.rs#L1078-L1080 Rococo::execute_with(|| { let expected_fee = 10_454_619; let expected_balance_bob = initial_balance_bob + transfer_amount - expected_fee; diff --git a/runtime/battery-station/src/xcm_config/config.rs b/runtime/battery-station/src/xcm_config/config.rs index fc97e70e2..7dffe666f 100644 --- a/runtime/battery-station/src/xcm_config/config.rs +++ b/runtime/battery-station/src/xcm_config/config.rs @@ -54,7 +54,7 @@ use xcm_executor::{traits::TransactAsset, Assets as ExecutorAssets}; use zeitgeist_primitives::{constants::BalanceFractionalDecimals, types::XcmAsset}; pub mod battery_station { - #[cfg(test)] + #[cfg(any(test, feature = "runtime-benchmarks"))] pub const ID: u32 = 2101; pub const KEY: &[u8] = &[0, 1]; } From 7ae1786c70ffd66f1987ffa2b5c857a6c850de5d Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sun, 28 Apr 2024 01:13:55 +0200 Subject: [PATCH 10/12] Update license --- .../battery-station/src/integration_tests/xcm/genesis/rococo.rs | 1 + runtime/battery-station/src/parachain_params.rs | 2 +- runtime/zeitgeist/src/parachain_params.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs index dd5da8940..6d37c8450 100644 --- a/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs +++ b/runtime/battery-station/src/integration_tests/xcm/genesis/rococo.rs @@ -1,4 +1,5 @@ // Copyright 2024 Forecasting Technologies LTD. +// // Copyright (C) Parity Technologies (UK) Ltd. // // This file is part of Zeitgeist. diff --git a/runtime/battery-station/src/parachain_params.rs b/runtime/battery-station/src/parachain_params.rs index d9affc3a2..7312994c4 100644 --- a/runtime/battery-station/src/parachain_params.rs +++ b/runtime/battery-station/src/parachain_params.rs @@ -1,4 +1,4 @@ -// Copyright 2022-2023 Forecasting Technologies LTD. +// Copyright 2022-2024 Forecasting Technologies LTD. // Copyright 2021-2022 Zeitgeist PM LLC. // // This file is part of Zeitgeist. diff --git a/runtime/zeitgeist/src/parachain_params.rs b/runtime/zeitgeist/src/parachain_params.rs index 598488d90..55bf67d07 100644 --- a/runtime/zeitgeist/src/parachain_params.rs +++ b/runtime/zeitgeist/src/parachain_params.rs @@ -1,4 +1,4 @@ -// Copyright 2022-2023 Forecasting Technologies LTD. +// Copyright 2022-2024 Forecasting Technologies LTD. // Copyright 2021-2022 Zeitgeist PM LLC. // // This file is part of Zeitgeist. From 56988736d23e49cf1289259a7f5d399584fe410c Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sun, 28 Apr 2024 10:23:03 +0200 Subject: [PATCH 11/12] Finalize Zeitgeist XCM tests --- Cargo.lock | 3 + .../src/integration_tests/xcm/setup.rs | 1 - .../integration_tests/xcm/tests/transfers.rs | 127 +++-- runtime/zeitgeist/Cargo.toml | 4 + .../src/integration_tests/xcm/genesis/mod.rs | 19 + .../integration_tests/xcm/genesis/polkadot.rs | 134 +++++ .../xcm/genesis/zeitgeist.rs | 83 ++++ .../src/integration_tests/xcm/mod.rs | 1 + .../src/integration_tests/xcm/setup.rs | 123 ++--- .../src/integration_tests/xcm/test_net.rs | 154 +++--- .../xcm/tests/currency_id_convert.rs | 4 +- .../integration_tests/xcm/tests/transfers.rs | 458 +++++++++--------- runtime/zeitgeist/src/xcm_config/config.rs | 2 +- 13 files changed, 637 insertions(+), 476 deletions(-) create mode 100644 runtime/zeitgeist/src/integration_tests/xcm/genesis/mod.rs create mode 100644 runtime/zeitgeist/src/integration_tests/xcm/genesis/polkadot.rs create mode 100644 runtime/zeitgeist/src/integration_tests/xcm/genesis/zeitgeist.rs diff --git a/Cargo.lock b/Cargo.lock index e7240fd0c..13f5eccad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14974,6 +14974,7 @@ dependencies = [ "pallet-democracy", "pallet-grandpa", "pallet-identity", + "pallet-im-online", "pallet-insecure-randomness-collective-flip", "pallet-membership", "pallet-message-queue", @@ -14998,8 +14999,10 @@ dependencies = [ "scale-info", "session-keys-primitives", "sp-api", + "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", + "sp-consensus-babe", "sp-consensus-grandpa", "sp-core", "sp-debug-derive", diff --git a/runtime/battery-station/src/integration_tests/xcm/setup.rs b/runtime/battery-station/src/integration_tests/xcm/setup.rs index fb7a56474..7c54fc5e5 100644 --- a/runtime/battery-station/src/integration_tests/xcm/setup.rs +++ b/runtime/battery-station/src/integration_tests/xcm/setup.rs @@ -29,7 +29,6 @@ use xcm::{ use xcm_emulator::helpers::get_account_id_from_seed; use zeitgeist_primitives::types::{CustomMetadata, XcmAsset}; -/// Accounts pub(super) mod accounts { use super::*; pub const ALICE: &str = "Alice"; diff --git a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs index c737bc35e..e22df751f 100644 --- a/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/battery-station/src/integration_tests/xcm/tests/transfers.rs @@ -94,6 +94,66 @@ fn transfer_ztg_to_sibling() { }); } +#[test] +fn transfer_ztg_to_sibling_with_custom_fee() { + // 10x fee factor, so ZTG has 10x the worth of sibling currency. + let fee_factor = 100_000_000_000; + let transfer_amount = ztg(5); + let mut treasury_initial_balance = 0; + let mut bob_initial_balance = 0; + + Sibling::execute_with(|| { + treasury_initial_balance = + AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); + bob_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); + let custom_metadata = CustomMetadata { + xcm: XcmMetadata { fee_factor: Some(fee_factor) }, + ..Default::default() + }; + register_foreign_ztg(Some(custom_metadata)); + }); + + BatteryStation::execute_with(|| { + let alice_initial_balance = Balances::free_balance(&alice()); + assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); + assert_ok!(XTokens::transfer( + RuntimeOrigin::signed(alice()), + XcmAsset::Ztg, + transfer_amount, + Box::new( + MultiLocation::new( + 1, + X2( + Parachain(PARA_ID_SIBLING), + Junction::AccountId32 { network: None, id: bob().into() } + ) + ) + .into() + ), + WeightLimit::Limited(4_000_000_000.into()), + )); + // Confirm that Alice's balance is initial_balance - amount_transferred + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); + // Verify that the amount transferred is now part of the sibling account here + assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); + }); + + Sibling::execute_with(|| { + let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); + let custom_fee = ztg_fee() * fee_factor / BASE; + let bob_expected = bob_initial_balance + transfer_amount - custom_fee; + let treasury_expected = treasury_initial_balance + custom_fee; + + // Verify that bob() now has (amount transferred - fee) + assert_eq!(current_balance, bob_expected); + // Verify that fees (of foreign currency) have been put into treasury + assert_eq!( + AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()), + treasury_expected + ) + }); +} + #[test] fn transfer_ztg_sibling_to_zeitgeist() { let mut alice_initial_balance = 0; @@ -122,7 +182,7 @@ fn transfer_ztg_sibling_to_zeitgeist() { MultiLocation::new( 1, X2( - Parachain(battery_station::ID), + Parachain(PARA_ID_BATTERY_STATION), Junction::AccountId32 { network: None, id: alice().into() } ) ) @@ -187,7 +247,7 @@ fn transfer_btc_sibling_to_zeitgeist() { MultiLocation::new( 1, X2( - Parachain(battery_station::ID), + Parachain(PARA_ID_BATTERY_STATION), Junction::AccountId32 { network: None, id: alice().into() } ) ) @@ -295,7 +355,7 @@ fn transfer_roc_from_relay_chain() { assert_ok!(rococo_runtime::XcmPallet::reserve_transfer_assets( rococo_runtime::RuntimeOrigin::signed(alice()), - Box::new(Parachain(battery_station::ID).into()), + Box::new(Parachain(PARA_ID_BATTERY_STATION).into()), Box::new(Junction::AccountId32 { network: None, id: bob().into() }.into()), Box::new((Here, transfer_amount).into()), 0 @@ -366,66 +426,6 @@ fn transfer_roc_to_relay_chain() { }); } -#[test] -fn transfer_ztg_to_sibling_with_custom_fee() { - // 10x fee factor, so ZTG has 10x the worth of sibling currency. - let fee_factor = 100_000_000_000; - let transfer_amount = ztg(5); - let mut treasury_initial_balance = 0; - let mut bob_initial_balance = 0; - - Sibling::execute_with(|| { - treasury_initial_balance = - AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); - bob_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); - let custom_metadata = CustomMetadata { - xcm: XcmMetadata { fee_factor: Some(fee_factor) }, - ..Default::default() - }; - register_foreign_ztg(Some(custom_metadata)); - }); - - BatteryStation::execute_with(|| { - let alice_initial_balance = Balances::free_balance(&alice()); - assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); - assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(alice()), - XcmAsset::Ztg, - transfer_amount, - Box::new( - MultiLocation::new( - 1, - X2( - Parachain(PARA_ID_SIBLING), - Junction::AccountId32 { network: None, id: bob().into() } - ) - ) - .into() - ), - WeightLimit::Limited(4_000_000_000.into()), - )); - // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); - // Verify that the amount transferred is now part of the sibling account here - assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); - }); - - Sibling::execute_with(|| { - let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); - let custom_fee = ztg_fee() * fee_factor / BASE; - let bob_expected = bob_initial_balance + transfer_amount - custom_fee; - let treasury_expected = treasury_initial_balance + custom_fee; - - // Verify that bob() now has (amount transferred - fee) - assert_eq!(current_balance, bob_expected); - // Verify that fees (of foreign currency) have been put into treasury - assert_eq!( - AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()), - treasury_expected - ) - }); -} - #[test] fn test_total_fee() { assert_eq!(btc_fee(), 642_960); @@ -443,7 +443,6 @@ fn fee(decimals: u32, multiplier: Balance) -> Balance { calc_fee(default_per_second(decimals), multiplier) } -// The fee associated with transferring roc tokens #[inline] fn roc_fee() -> Balance { fee(12, 10) diff --git a/runtime/zeitgeist/Cargo.toml b/runtime/zeitgeist/Cargo.toml index c2890b157..4a3b046f8 100644 --- a/runtime/zeitgeist/Cargo.toml +++ b/runtime/zeitgeist/Cargo.toml @@ -128,6 +128,9 @@ zrml-swaps-runtime-api = { workspace = true } [dev-dependencies] env_logger = { workspace = true } +pallet-im-online = { workspace = true, features = ["default"] } +sp-authority-discovery = { workspace = true, features = ["default"] } +sp-consensus-babe = { workspace = true, features = ["default"] } sp-io = { workspace = true, features = ["default"] } test-case = { workspace = true } xcm-emulator = { workspace = true } @@ -323,6 +326,7 @@ std = [ # Zeitgeist "zeitgeist-primitives/std", + "zrml-asset-router/std", "zrml-authorized/std", "zrml-court/std", "zrml-hybrid-router/std", diff --git a/runtime/zeitgeist/src/integration_tests/xcm/genesis/mod.rs b/runtime/zeitgeist/src/integration_tests/xcm/genesis/mod.rs new file mode 100644 index 000000000..5b5ed972a --- /dev/null +++ b/runtime/zeitgeist/src/integration_tests/xcm/genesis/mod.rs @@ -0,0 +1,19 @@ +// Copyright 2024 Forecasting Technologies LTD. +// +// This file is part of Zeitgeist. +// +// Zeitgeist 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. +// +// Zeitgeist 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 Zeitgeist. If not, see . + +pub(super) mod polkadot; +pub(super) mod zeitgeist; diff --git a/runtime/zeitgeist/src/integration_tests/xcm/genesis/polkadot.rs b/runtime/zeitgeist/src/integration_tests/xcm/genesis/polkadot.rs new file mode 100644 index 000000000..2ef8a7349 --- /dev/null +++ b/runtime/zeitgeist/src/integration_tests/xcm/genesis/polkadot.rs @@ -0,0 +1,134 @@ +// Copyright 2024 Forecasting Technologies LTD. +// +// Copyright (C) Parity Technologies (UK) Ltd. +// +// This file is part of Zeitgeist. +// +// Zeitgeist 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. +// +// Zeitgeist 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 Zeitgeist. If not, see . + +use crate::integration_tests::xcm::setup::{accounts, accounts::get_from_seed, dot}; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +use polkadot_primitives::{AccountId, AssignmentId, BlockNumber, ValidatorId}; +use polkadot_runtime_parachains::configuration::HostConfiguration; +use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; +use sp_consensus_babe::AuthorityId as BabeId; +use sp_consensus_grandpa::AuthorityId as GrandpaId; +use sp_core::{sr25519, storage::Storage}; +use sp_runtime::BuildStorage; +use xcm_emulator::helpers::get_account_id_from_seed; + +const ENDOWMENT: u128 = dot(1_000_000); + +fn session_keys( + grandpa: GrandpaId, + babe: BabeId, + im_online: ImOnlineId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, +) -> polkadot_runtime::SessionKeys { + polkadot_runtime::SessionKeys { + grandpa, + babe, + im_online, + para_validator, + para_assignment, + authority_discovery, + } +} + +fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + hrmp_sender_deposit: 0, + hrmp_recipient_deposit: 0, + hrmp_channel_max_capacity: 1000, + hrmp_channel_max_message_size: 102400, + hrmp_channel_max_total_size: 102400, + hrmp_max_parachain_outbound_channels: 30, + hrmp_max_parachain_inbound_channels: 30, + ..Default::default() + } +} + +mod validators { + use super::*; + + pub fn initial_authorities() -> Vec<( + AccountId, + AccountId, + GrandpaId, + BabeId, + ImOnlineId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + )> { + let seed = "Alice"; + vec![( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + )] + } +} + +pub(crate) fn genesis() -> Storage { + let genesis_config = polkadot_runtime::RuntimeGenesisConfig { + system: polkadot_runtime::SystemConfig { + code: polkadot_runtime::WASM_BINARY.unwrap().to_vec(), + ..Default::default() + }, + balances: polkadot_runtime::BalancesConfig { + balances: accounts::init_balances().iter().map(|k| (k.clone(), ENDOWMENT)).collect(), + }, + session: polkadot_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + babe: polkadot_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(polkadot_runtime::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() + }, + configuration: polkadot_runtime::ConfigurationConfig { config: get_host_config() }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() +} diff --git a/runtime/zeitgeist/src/integration_tests/xcm/genesis/zeitgeist.rs b/runtime/zeitgeist/src/integration_tests/xcm/genesis/zeitgeist.rs new file mode 100644 index 000000000..22e3fc162 --- /dev/null +++ b/runtime/zeitgeist/src/integration_tests/xcm/genesis/zeitgeist.rs @@ -0,0 +1,83 @@ +// Copyright 2024 Forecasting Technologies LTD. +// +// This file is part of Zeitgeist. +// +// Zeitgeist 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. +// +// Zeitgeist 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 Zeitgeist. If not, see . + +use crate::{ + integration_tests::xcm::setup::{ + accounts, ztg, BTC_ID, ETH_ID, FOREIGN_PARENT_ID, FOREIGN_SIBLING_ID, FOREIGN_ZTG_ID, + }, + parachain_params::MinCandidateStk, + parameters::ZeitgeistTreasuryAccount, + Asset, +}; +use nimbus_primitives::NimbusId; +use sp_core::storage::Storage; +use sp_runtime::BuildStorage; + +const ENDOWMENT: u128 = ztg(1_000_000_000_000_000); +const SAFE_XCM_VERSION: u32 = 2; + +pub(crate) fn genesis(parachain_id: u32) -> Storage { + let genesis_config = crate::RuntimeGenesisConfig { + author_mapping: crate::AuthorMappingConfig { + mappings: vec![( + accounts::get_from_seed::(accounts::ALICE), + accounts::alice(), + )], + }, + balances: crate::BalancesConfig { + balances: accounts::init_balances() + .iter() + .map(|k| (k.clone(), ztg(ENDOWMENT))) + .collect(), + }, + parachain_info: crate::ParachainInfoConfig { + parachain_id: parachain_id.into(), + ..Default::default() + }, + parachain_staking: crate::ParachainStakingConfig { + candidates: vec![(accounts::alice(), MinCandidateStk::get())], + ..Default::default() + }, + polkadot_xcm: crate::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() + }, + system: crate::SystemConfig { + code: crate::WASM_BINARY.unwrap().to_vec(), + ..Default::default() + }, + tokens: crate::TokensConfig { + balances: accounts::init_balances() + .iter() + .chain(vec![(ZeitgeistTreasuryAccount::get())].iter()) + .map(|k| { + vec![ + (k.clone(), Asset::from(FOREIGN_PARENT_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(FOREIGN_SIBLING_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(FOREIGN_ZTG_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(BTC_ID).try_into().unwrap(), ENDOWMENT), + (k.clone(), Asset::from(ETH_ID).try_into().unwrap(), ENDOWMENT), + ] + }) + .flatten() + .collect::>(), + }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() +} diff --git a/runtime/zeitgeist/src/integration_tests/xcm/mod.rs b/runtime/zeitgeist/src/integration_tests/xcm/mod.rs index d37a62036..6eaedfc32 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/mod.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/mod.rs @@ -17,6 +17,7 @@ #![cfg(all(feature = "parachain", test))] +mod genesis; mod setup; mod test_net; mod tests; diff --git a/runtime/zeitgeist/src/integration_tests/xcm/setup.rs b/runtime/zeitgeist/src/integration_tests/xcm/setup.rs index ba1433fef..3a35b1042 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/setup.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/setup.rs @@ -1,5 +1,4 @@ // Copyright 2022-2024 Forecasting Technologies LTD. -// Copyright 2021 Centrifuge Foundation (centrifuge.io). // // This file is part of Zeitgeist. // @@ -18,102 +17,70 @@ use crate::{ xcm_config::config::{general_key, zeitgeist}, - AccountId, AssetRegistry, AssetRegistryStringLimit, Assets, Balance, ExistentialDeposit, - Runtime, RuntimeOrigin, System, + AccountId, AssetRegistry, AssetRegistryStringLimit, Balance, ExistentialDeposit, RuntimeOrigin, }; use frame_support::assert_ok; use orml_traits::asset_registry::AssetMetadata; -use sp_runtime::{AccountId32, BuildStorage}; +use sp_core::{sr25519, Pair, Public}; use xcm::{ latest::{Junction::Parachain, Junctions::X2, MultiLocation}, VersionedMultiLocation, }; +use xcm_emulator::helpers::get_account_id_from_seed; use zeitgeist_primitives::types::{CustomMetadata, XcmAsset}; -pub(super) struct ExtBuilder { - balances: Vec<(AccountId, Assets, Balance)>, - parachain_id: u32, - safe_xcm_version: Option, -} - -impl Default for ExtBuilder { - fn default() -> Self { - Self { balances: vec![], parachain_id: zeitgeist::ID, safe_xcm_version: None } - } -} - -impl ExtBuilder { - pub fn set_balances(mut self, balances: Vec<(AccountId, Assets, Balance)>) -> Self { - self.balances = balances; - self +pub(super) mod accounts { + use super::*; + pub const ALICE: &str = "Alice"; + pub const BOB: &str = "Bob"; + pub const CHARLIE: &str = "Charlie"; + pub const DAVE: &str = "Dave"; + pub const EVE: &str = "Eve"; + pub const FERDIE: &str = "Ferdie"; + pub const ALICE_STASH: &str = "Alice//stash"; + pub const BOB_STASH: &str = "Bob//stash"; + pub const CHARLIE_STASH: &str = "Charlie//stash"; + pub const DAVE_STASH: &str = "Dave//stash"; + pub const EVE_STASH: &str = "Eve//stash"; + pub const FERDIE_STASH: &str = "Ferdie//stash"; + + pub fn init_balances() -> Vec { + vec![ + get_account_id_from_seed::(ALICE), + get_account_id_from_seed::(BOB), + get_account_id_from_seed::(CHARLIE), + get_account_id_from_seed::(DAVE), + get_account_id_from_seed::(EVE), + get_account_id_from_seed::(FERDIE), + get_account_id_from_seed::(ALICE_STASH), + get_account_id_from_seed::(BOB_STASH), + get_account_id_from_seed::(CHARLIE_STASH), + get_account_id_from_seed::(DAVE_STASH), + get_account_id_from_seed::(EVE_STASH), + get_account_id_from_seed::(FERDIE_STASH), + ] } - pub fn set_parachain_id(mut self, parachain_id: u32) -> Self { - self.parachain_id = parachain_id; - self + pub fn alice() -> AccountId { + get_account_id_from_seed::(ALICE) } - pub fn with_safe_xcm_version(mut self, safe_xcm_version: u32) -> Self { - self.safe_xcm_version = Some(safe_xcm_version); - self + pub fn bob() -> AccountId { + get_account_id_from_seed::(BOB) } - pub fn build(self) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - let native_currency_id = Assets::Ztg; - - pallet_balances::GenesisConfig:: { - balances: self - .balances - .clone() - .into_iter() - .filter(|(_, currency_id, _)| *currency_id == native_currency_id) - .map(|(account_id, _, initial_balance)| (account_id, initial_balance)) - .collect::>(), - } - .assimilate_storage(&mut t) - .unwrap(); - - orml_tokens::GenesisConfig:: { - balances: self - .balances - .into_iter() - .filter(|(_, currency_id, _)| *currency_id != native_currency_id) - .map(|(account_id, currency_id, initial_balance)| { - (account_id, currency_id.try_into().unwrap(), initial_balance) - }) - .collect::>(), - } - .assimilate_storage(&mut t) - .unwrap(); - - parachain_info::GenesisConfig:: { - _config: Default::default(), - parachain_id: self.parachain_id.into(), - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_xcm::GenesisConfig:: { - _config: Default::default(), - safe_xcm_version: self.safe_xcm_version, - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext + /// Helper function to generate a crypto pair from seed + pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() } } -/// Accounts -pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); -pub const BOB: AccountId32 = AccountId32::new([1u8; 32]); - /// A PARA ID used for a sibling parachain. /// It must be one that doesn't collide with any other in use. pub const PARA_ID_SIBLING: u32 = 3000; +pub const PARA_ID_ZEITGEIST: u32 = zeitgeist::ID; /// IDs that are used to represent tokens from other chains pub const FOREIGN_ZTG_ID: XcmAsset = XcmAsset::ForeignAsset(0); @@ -164,7 +131,7 @@ pub(super) const fn adjusted_balance(foreign_base: Balance, amount: Balance) -> // Multilocations that are used to represent tokens from other chains #[inline] pub(super) fn foreign_ztg_multilocation() -> MultiLocation { - MultiLocation::new(1, X2(Parachain(zeitgeist::ID), general_key(zeitgeist::KEY))) + MultiLocation::new(1, X2(Parachain(PARA_ID_ZEITGEIST), general_key(zeitgeist::KEY))) } #[inline] @@ -256,7 +223,7 @@ pub(super) fn sibling_parachain_account() -> AccountId { #[inline] pub(super) fn zeitgeist_parachain_account() -> AccountId { - parachain_account(zeitgeist::ID) + parachain_account(PARA_ID_ZEITGEIST) } #[inline] diff --git a/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs b/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs index 200726372..a70900558 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/test_net.rs @@ -1,5 +1,4 @@ // Copyright 2022-2024 Forecasting Technologies LTD. -// Copyright 2021-2022 Centrifuge GmbH (centrifuge.io). // // This file is part of Zeitgeist. // @@ -16,108 +15,79 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . +use super::{ + genesis::{polkadot, zeitgeist}, + setup::{PARA_ID_SIBLING, PARA_ID_ZEITGEIST}, +}; use crate::{ - parameters::ZeitgeistTreasuryAccount, xcm_config::config::zeitgeist, Assets, DmpQueue, - XcmpQueue, + xcm_config::config::LocationToAccountId, AssetManager, Balances, DmpQueue, ParachainInfo, + PolkadotXcm, XTokens, XcmpQueue, +}; +use xcm_emulator::{ + decl_test_networks, decl_test_parachains, decl_test_relay_chains, DefaultMessageProcessor, }; -use polkadot_runtime_parachains::configuration::HostConfiguration; -use sp_runtime::BuildStorage; -use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; - -use super::setup::{dot, ztg, ExtBuilder, ALICE, FOREIGN_PARENT_ID, PARA_ID_SIBLING}; -decl_test_relay_chain! { - pub struct PolkadotNet { - Runtime = polkadot_runtime::Runtime, - RuntimeCall = polkadot_runtime::RuntimeCall, - RuntimeEvent = polkadot_runtime::RuntimeEvent, - XcmConfig = polkadot_runtime::XcmConfig, - MessageQueue = polkadot_runtime::MessageQueue, - System = polkadot_runtime::System, - new_ext = relay_ext(), - } +decl_test_relay_chains! { + #[api_version(5)] + pub struct Polkadot { + genesis = polkadot::genesis(), + on_init = (), + runtime = polkadot_runtime, + core = { + MessageProcessor: DefaultMessageProcessor, + SovereignAccountOf: polkadot_runtime::xcm_config::SovereignAccountOf, + }, + pallets = { + XcmPallet: polkadot_runtime::XcmPallet, + Balances: polkadot_runtime::Balances, + } + }, } -decl_test_parachain! { +decl_test_parachains! { pub struct Zeitgeist { - Runtime = Runtime, - XcmpMessageHandler = XcmpQueue, - DmpMessageHandler = DmpQueue, - new_ext = para_ext(zeitgeist::ID), - } -} - -decl_test_parachain! { + genesis = zeitgeist::genesis(PARA_ID_ZEITGEIST), + on_init = (), + runtime = crate, + core = { + XcmpMessageHandler: XcmpQueue, + DmpMessageHandler: DmpQueue, + LocationToAccountId: LocationToAccountId, + ParachainInfo: ParachainInfo, + }, + pallets = { + PolkadotXcm: PolkadotXcm, + AssetManager: AssetManager, + Balances: Balances, + XTokens: XTokens, + } + }, pub struct Sibling { - Runtime = Runtime, - XcmpMessageHandler = XcmpQueue, - DmpMessageHandler = DmpQueue, - new_ext = para_ext(PARA_ID_SIBLING), - } + genesis = zeitgeist::genesis(PARA_ID_SIBLING), + on_init = (), + runtime = crate, + core = { + XcmpMessageHandler: XcmpQueue, + DmpMessageHandler: DmpQueue, + LocationToAccountId: LocationToAccountId, + ParachainInfo: ParachainInfo, + }, + pallets = { + PolkadotXcm: PolkadotXcm, + AssetManager: AssetManager, + Balances: Balances, + XTokens: XTokens, + } + }, } -decl_test_network! { +decl_test_networks! { pub struct TestNet { - relay_chain = PolkadotNet, + relay_chain = Polkadot, parachains = vec![ - // N.B: Ideally, we could use the defined para id constants but doing so - // fails with: "error: arbitrary expressions aren't allowed in patterns" - - // Be sure to use `xcm_config::config::zeitgeist::ID` - (2092, Zeitgeist), - // Be sure to use `PARA_ID_SIBLING` - (3000, Sibling), + Zeitgeist, + Sibling, ], - } -} - -pub(super) fn relay_ext() -> sp_io::TestExternalities { - use polkadot_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - - pallet_balances::GenesisConfig:: { balances: vec![(ALICE, dot(2002))] } - .assimilate_storage(&mut t) - .unwrap(); - - polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: mock_relay_config(), - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_xcm::GenesisConfig:: { _config: Default::default(), safe_xcm_version: Some(2) } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext -} - -pub(super) fn para_ext(parachain_id: u32) -> sp_io::TestExternalities { - let _ = env_logger::builder().is_test(true).try_init(); - - ExtBuilder::default() - .set_balances(vec![ - (ALICE, Assets::Ztg, ztg(10)), - (ALICE, FOREIGN_PARENT_ID.into(), dot(10)), - (ZeitgeistTreasuryAccount::get(), FOREIGN_PARENT_ID.into(), dot(10)), - ]) - .set_parachain_id(parachain_id) - .with_safe_xcm_version(2) - .build() -} - -pub fn mock_relay_config() -> HostConfiguration { - HostConfiguration:: { - hrmp_channel_max_capacity: u32::MAX, - hrmp_channel_max_total_size: u32::MAX, - hrmp_max_parachain_inbound_channels: 10, - hrmp_max_parachain_outbound_channels: 10, - hrmp_channel_max_message_size: u32::MAX, - // Changed to avoid aritmetic errors within hrmp_close - max_downward_message_size: 100_000u32, - ..Default::default() + bridge = () } } diff --git a/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs b/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs index dbe2b68be..38d443dee 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/tests/currency_id_convert.rs @@ -21,7 +21,7 @@ use crate::{ setup::{ foreign_parent_multilocation, foreign_sibling_multilocation, foreign_ztg_multilocation, register_foreign_parent, register_foreign_sibling, FOREIGN_PARENT_ID, - FOREIGN_SIBLING_ID, + FOREIGN_SIBLING_ID, PARA_ID_ZEITGEIST, }, test_net::Zeitgeist, }, @@ -128,7 +128,7 @@ fn convert_any_registered_sibling_multilocation_xcm_assets() { #[test] fn convert_unkown_multilocation() { let unknown_location: MultiLocation = - MultiLocation::new(1, X2(Parachain(zeitgeist::ID), general_key(&[42]))); + MultiLocation::new(1, X2(Parachain(PARA_ID_ZEITGEIST), general_key(&[42]))); Zeitgeist::execute_with(|| { assert!( diff --git a/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs b/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs index 8a996016d..72f5a6dac 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/tests/transfers.rs @@ -19,21 +19,21 @@ use crate::{ integration_tests::xcm::{ setup::{ + accounts::{alice, bob}, adjusted_balance, btc, dot, eth, register_btc, register_eth, register_foreign_parent, register_foreign_ztg, sibling_parachain_account, zeitgeist_parachain_account, ztg, - ALICE, BOB, BTC_ID, ETH_ID, FOREIGN_PARENT_ID, FOREIGN_ZTG_ID, PARA_ID_SIBLING, + BTC_ID, ETH_ID, FOREIGN_PARENT_ID, FOREIGN_ZTG_ID, PARA_ID_SIBLING, PARA_ID_ZEITGEIST, }, - test_net::{PolkadotNet, Sibling, TestNet, Zeitgeist}, + test_net::{Polkadot, Sibling, Zeitgeist}, }, - xcm_config::{config::zeitgeist, fees::default_per_second}, - AssetManager, AssetRegistry, Balance, Balances, RuntimeOrigin, XTokens, - ZeitgeistTreasuryAccount, + xcm_config::fees::default_per_second, + AssetManager, Balance, Balances, RuntimeOrigin, XTokens, ZeitgeistTreasuryAccount, }; use frame_support::{assert_ok, traits::tokens::fungible::Mutate}; use orml_traits::MultiCurrency; use xcm::latest::{Junction, Junction::*, Junctions::*, MultiLocation, WeightLimit}; -use xcm_emulator::TestExt; +use xcm_emulator::{RelayChain, TestExt}; use zeitgeist_primitives::{ constants::{BalanceFractionalDecimals, BASE}, types::{CustomMetadata, XcmAsset, XcmMetadata}, @@ -41,24 +41,23 @@ use zeitgeist_primitives::{ #[test] fn transfer_ztg_to_sibling() { - TestNet::reset(); - - let alice_initial_balance = ztg(10); + let mut alice_initial_balance = 0; + let mut bob_initial_balance = 0; let transfer_amount = ztg(5); let mut treasury_initial_balance = 0; Sibling::execute_with(|| { treasury_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB), 0); + bob_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); register_foreign_ztg(None); }); Zeitgeist::execute_with(|| { - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance); + alice_initial_balance = Balances::free_balance(&alice()); assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), XcmAsset::Ztg, transfer_amount, Box::new( @@ -66,7 +65,7 @@ fn transfer_ztg_to_sibling() { 1, X2( Parachain(PARA_ID_SIBLING), - Junction::AccountId32 { network: None, id: BOB.into() } + Junction::AccountId32 { network: None, id: bob().into() } ) ) .into() @@ -75,92 +74,140 @@ fn transfer_ztg_to_sibling() { )); // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance - transfer_amount); - + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); // Verify that the amount transferred is now part of the sibling account here assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); }); Sibling::execute_with(|| { - let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB); - - // Verify that BOB now has (amount transferred - fee) - assert_eq!(current_balance, transfer_amount - ztg_fee()); + let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); + let bob_expected = bob_initial_balance + transfer_amount - ztg_fee(); + let treasury_expected = treasury_initial_balance + ztg_fee(); + // Verify that bob() now has (amount transferred - fee) + assert_eq!(current_balance, bob_expected); // Verify that fees (of foreign currency) have been put into treasury assert_eq!( AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()), - treasury_initial_balance + ztg_fee() + treasury_expected ) }); } #[test] -fn transfer_ztg_sibling_to_zeitgeist() { - TestNet::reset(); +fn transfer_ztg_to_sibling_with_custom_fee() { + // 10x fee factor, so ZTG has 10x the worth of sibling currency. + let fee_factor = 100_000_000_000; + let transfer_amount = ztg(5); + let mut treasury_initial_balance = 0; + let mut bob_initial_balance = 0; + + Sibling::execute_with(|| { + treasury_initial_balance = + AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); + bob_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); + let custom_metadata = CustomMetadata { + xcm: XcmMetadata { fee_factor: Some(fee_factor) }, + ..Default::default() + }; + register_foreign_ztg(Some(custom_metadata)); + }); + + Zeitgeist::execute_with(|| { + let alice_initial_balance = Balances::free_balance(&alice()); + assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); + assert_ok!(XTokens::transfer( + RuntimeOrigin::signed(alice()), + XcmAsset::Ztg, + transfer_amount, + Box::new( + MultiLocation::new( + 1, + X2( + Parachain(PARA_ID_SIBLING), + Junction::AccountId32 { network: None, id: bob().into() } + ) + ) + .into() + ), + WeightLimit::Limited(4_000_000_000.into()), + )); + // Confirm that Alice's balance is initial_balance - amount_transferred + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); + // Verify that the amount transferred is now part of the sibling account here + assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); + }); + + Sibling::execute_with(|| { + let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); + let custom_fee = ztg_fee() * fee_factor / BASE; + let bob_expected = bob_initial_balance + transfer_amount - custom_fee; + let treasury_expected = treasury_initial_balance + custom_fee; - // In order to be able to transfer ZTG from Sibling to Zeitgeist, we need to first send - // ZTG from Zeitgeist to Sibling, or else it fails since it'd be like Sibling had minted - // ZTG on their side. - transfer_ztg_to_sibling(); + // Verify that bob() now has (amount transferred - fee) + assert_eq!(current_balance, bob_expected); + // Verify that fees (of foreign currency) have been put into treasury + assert_eq!( + AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()), + treasury_expected + ) + }); +} - let alice_initial_balance = ztg(5); - let bob_initial_balance = ztg(5) - ztg_fee(); +#[test] +fn transfer_ztg_sibling_to_zeitgeist() { + let mut alice_initial_balance = 0; let mut treasury_initial_balance = 0; - let sibling_sovereign_initial_balance = ztg(5); let transfer_amount = ztg(1); - // Note: This asset was registered in `transfer_ztg_to_sibling` + let sibling_initial_balance = transfer_amount; Zeitgeist::execute_with(|| { treasury_initial_balance = Balances::free_balance(ZeitgeistTreasuryAccount::get()); - - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance); + alice_initial_balance = Balances::free_balance(&alice()); assert_eq!( - Balances::free_balance(sibling_parachain_account()), - sibling_sovereign_initial_balance + Balances::set_balance(&sibling_parachain_account(), sibling_initial_balance), + sibling_initial_balance ); }); Sibling::execute_with(|| { - assert_eq!(Balances::free_balance(zeitgeist_parachain_account()), 0); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB), bob_initial_balance); + register_foreign_ztg(None); + let bob_initial_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()); + assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(BOB), + RuntimeOrigin::signed(bob()), FOREIGN_ZTG_ID, transfer_amount, Box::new( MultiLocation::new( 1, X2( - Parachain(zeitgeist::ID), - Junction::AccountId32 { network: None, id: ALICE.into() } + Parachain(PARA_ID_ZEITGEIST), + Junction::AccountId32 { network: None, id: alice().into() } ) ) .into() ), WeightLimit::Limited(4_000_000_000.into()), )); - // Confirm that Bobs's balance is initial balance - amount transferred assert_eq!( - AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB), + AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &bob()), bob_initial_balance - transfer_amount ); }); Zeitgeist::execute_with(|| { - // Verify that ALICE now has initial balance + amount transferred - fee + // Verify that alice() now has initial balance + amount transferred - fee assert_eq!( - Balances::free_balance(&ALICE), + Balances::free_balance(&alice()), alice_initial_balance + transfer_amount - ztg_fee(), ); - // Verify that the reserve has been adjusted properly assert_eq!( Balances::free_balance(sibling_parachain_account()), - sibling_sovereign_initial_balance - transfer_amount + sibling_initial_balance - transfer_amount ); - // Verify that fees (of native currency) have been put into treasury assert_eq!( Balances::free_balance(ZeitgeistTreasuryAccount::get()), @@ -171,11 +218,7 @@ fn transfer_ztg_sibling_to_zeitgeist() { #[test] fn transfer_btc_sibling_to_zeitgeist() { - TestNet::reset(); - - let sibling_alice_initial_balance = ztg(10); - let zeitgeist_alice_initial_balance = btc(0); - let initial_sovereign_balance = btc(100); + let mut zeitgeist_alice_initial_balance = 0; let transfer_amount = btc(100); let mut treasury_initial_balance = 0; @@ -183,21 +226,20 @@ fn transfer_btc_sibling_to_zeitgeist() { register_btc(None); treasury_initial_balance = AssetManager::free_balance(BTC_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!( - AssetManager::free_balance(BTC_ID.into(), &ALICE), - zeitgeist_alice_initial_balance, - ); + zeitgeist_alice_initial_balance = AssetManager::free_balance(BTC_ID.into(), &alice()); }); Sibling::execute_with(|| { - assert_eq!(Balances::free_balance(&ALICE), sibling_alice_initial_balance); + let alice_initial_balance = Balances::free_balance(&alice()); + let initial_sovereign_balance = transfer_amount; + // Set the sovereign balance such that it is not subject to dust collection assert_eq!( Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), initial_sovereign_balance ); assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), // Target chain will interpret XcmAsset::Ztg as BTC in this context. XcmAsset::Ztg, transfer_amount, @@ -205,18 +247,16 @@ fn transfer_btc_sibling_to_zeitgeist() { MultiLocation::new( 1, X2( - Parachain(zeitgeist::ID), - Junction::AccountId32 { network: None, id: ALICE.into() } + Parachain(PARA_ID_ZEITGEIST), + Junction::AccountId32 { network: None, id: alice().into() } ) ) .into() ), WeightLimit::Limited(4_000_000_000.into()), )); - // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&ALICE), sibling_alice_initial_balance - transfer_amount); - + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); // Verify that the amount transferred is now part of the zeitgeist account here assert_eq!( Balances::free_balance(zeitgeist_parachain_account()), @@ -227,39 +267,43 @@ fn transfer_btc_sibling_to_zeitgeist() { Zeitgeist::execute_with(|| { let expected = transfer_amount - btc_fee(); let expected_adjusted = adjusted_balance(btc(1), expected); + let expected_treasury = treasury_initial_balance + adjusted_balance(btc(1), btc_fee()); // Verify that remote Alice now has initial balance + amount transferred - fee assert_eq!( - AssetManager::free_balance(BTC_ID.into(), &ALICE), + AssetManager::free_balance(BTC_ID.into(), &alice()), zeitgeist_alice_initial_balance + expected_adjusted, ); - // Verify that fees (of foreign currency) have been put into treasury assert_eq!( AssetManager::free_balance(BTC_ID.into(), &ZeitgeistTreasuryAccount::get()), // Align decimal fractional places - treasury_initial_balance + adjusted_balance(btc(1), btc_fee()) + expected_treasury ) }); } #[test] fn transfer_btc_zeitgeist_to_sibling() { - TestNet::reset(); - - let transfer_amount = btc(100) - btc_fee(); - let initial_sovereign_balance = 2 * btc(100); - let sibling_bob_initial_balance = btc(0); - - transfer_btc_sibling_to_zeitgeist(); + let transfer_amount = btc(100); + let initial_sovereign_balance = transfer_amount; + let mut bob_initial_balance = 0; Sibling::execute_with(|| { - assert_eq!(AssetManager::free_balance(BTC_ID.into(), &BOB), sibling_bob_initial_balance,); + bob_initial_balance = Balances::free_balance(&bob()); + // Set the sovereign balance such that it is not subject to dust collection + assert_eq!( + Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), + initial_sovereign_balance + ); }); Zeitgeist::execute_with(|| { + register_btc(None); + let alice_initial_balance = AssetManager::free_balance(BTC_ID.into(), &alice()); + assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), BTC_ID, transfer_amount, Box::new( @@ -267,7 +311,7 @@ fn transfer_btc_zeitgeist_to_sibling() { 1, X2( Parachain(PARA_ID_SIBLING), - Junction::AccountId32 { network: None, id: BOB.into() } + Junction::AccountId32 { network: None, id: bob().into() } ) ) .into() @@ -276,57 +320,46 @@ fn transfer_btc_zeitgeist_to_sibling() { )); // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(AssetManager::free_balance(BTC_ID.into(), &ALICE), 0); + let alice_balance = AssetManager::free_balance(BTC_ID.into(), &alice()); + let alice_expected = alice_initial_balance - adjusted_balance(btc(1), transfer_amount); + assert_eq!(alice_balance, alice_expected); }); Sibling::execute_with(|| { - let fee_adjusted = adjusted_balance(btc(1), btc_fee()); - let expected = transfer_amount - fee_adjusted; + let expected = bob_initial_balance + transfer_amount - adjusted_balance(btc(1), btc_fee()); + let expected_sovereign = initial_sovereign_balance - transfer_amount; // Verify that Bob now has initial balance + amount transferred - fee - assert_eq!(Balances::free_balance(&BOB), sibling_bob_initial_balance + expected,); - + assert_eq!(Balances::free_balance(&bob()), expected); // Verify that the amount transferred is now subtracted from the zeitgeist account at sibling - assert_eq!( - Balances::free_balance(zeitgeist_parachain_account()), - initial_sovereign_balance - transfer_amount - ); + assert_eq!(Balances::free_balance(zeitgeist_parachain_account()), expected_sovereign); }); } #[test] fn transfer_eth_sibling_to_zeitgeist() { - TestNet::reset(); - - let sibling_alice_initial_balance = ztg(10) + eth(1); - let zeitgeist_alice_initial_balance = eth(0); - let initial_sovereign_balance = eth(1); - let transfer_amount = eth(1); + let mut zeitgeist_alice_initial_balance = 0; + let transfer_amount = eth(100); let mut treasury_initial_balance = 0; Zeitgeist::execute_with(|| { register_eth(None); treasury_initial_balance = AssetManager::free_balance(ETH_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!( - AssetManager::free_balance(ETH_ID.into(), &ALICE), - zeitgeist_alice_initial_balance, - ); + zeitgeist_alice_initial_balance = AssetManager::free_balance(ETH_ID.into(), &alice()); }); Sibling::execute_with(|| { + let alice_initial_balance = Balances::free_balance(&alice()); + let initial_sovereign_balance = transfer_amount; + // Set the sovereign balance such that it is not subject to dust collection assert_eq!( Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), initial_sovereign_balance ); - // Add 1 "fake" ETH to Alice's balance - assert_eq!( - Balances::set_balance(&ALICE, sibling_alice_initial_balance,), - sibling_alice_initial_balance - ); assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), // Target chain will interpret XcmAsset::Ztg as ETH in this context. XcmAsset::Ztg, transfer_amount, @@ -334,18 +367,16 @@ fn transfer_eth_sibling_to_zeitgeist() { MultiLocation::new( 1, X2( - Parachain(zeitgeist::ID), - Junction::AccountId32 { network: None, id: ALICE.into() } + Parachain(PARA_ID_ZEITGEIST), + Junction::AccountId32 { network: None, id: alice().into() } ) ) .into() ), WeightLimit::Limited(4_000_000_000.into()), )); - // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&ALICE), sibling_alice_initial_balance - transfer_amount); - + assert_eq!(Balances::free_balance(&alice()), alice_initial_balance - transfer_amount); // Verify that the amount transferred is now part of the zeitgeist account here assert_eq!( Balances::free_balance(zeitgeist_parachain_account()), @@ -356,39 +387,43 @@ fn transfer_eth_sibling_to_zeitgeist() { Zeitgeist::execute_with(|| { let expected = transfer_amount - eth_fee(); let expected_adjusted = adjusted_balance(eth(1), expected); + let expected_treasury = treasury_initial_balance + adjusted_balance(eth(1), eth_fee()); // Verify that remote Alice now has initial balance + amount transferred - fee assert_eq!( - AssetManager::free_balance(ETH_ID.into(), &ALICE), + AssetManager::free_balance(ETH_ID.into(), &alice()), zeitgeist_alice_initial_balance + expected_adjusted, ); - // Verify that fees (of foreign currency) have been put into treasury assert_eq!( AssetManager::free_balance(ETH_ID.into(), &ZeitgeistTreasuryAccount::get()), // Align decimal fractional places - treasury_initial_balance + adjusted_balance(eth(1), eth_fee()) + expected_treasury ) }); } #[test] fn transfer_eth_zeitgeist_to_sibling() { - TestNet::reset(); - - let transfer_amount = eth(1) - eth_fee(); - let initial_sovereign_balance = 2 * eth(1); - let sibling_bob_initial_balance = eth(0); - - transfer_eth_sibling_to_zeitgeist(); + let transfer_amount = eth(100); + let initial_sovereign_balance = transfer_amount; + let mut bob_initial_balance = 0; Sibling::execute_with(|| { - assert_eq!(AssetManager::free_balance(ETH_ID.into(), &BOB), sibling_bob_initial_balance,); + bob_initial_balance = Balances::free_balance(&bob()); + // Set the sovereign balance such that it is not subject to dust collection + assert_eq!( + Balances::set_balance(&zeitgeist_parachain_account(), initial_sovereign_balance,), + initial_sovereign_balance + ); }); Zeitgeist::execute_with(|| { + register_eth(None); + let alice_initial_balance = AssetManager::free_balance(ETH_ID.into(), &alice()); + assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), + RuntimeOrigin::signed(alice()), ETH_ID, transfer_amount, Box::new( @@ -396,7 +431,7 @@ fn transfer_eth_zeitgeist_to_sibling() { 1, X2( Parachain(PARA_ID_SIBLING), - Junction::AccountId32 { network: None, id: BOB.into() } + Junction::AccountId32 { network: None, id: bob().into() } ) ) .into() @@ -405,200 +440,147 @@ fn transfer_eth_zeitgeist_to_sibling() { )); // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(AssetManager::free_balance(ETH_ID.into(), &ALICE), 0); + let alice_balance = AssetManager::free_balance(ETH_ID.into(), &alice()); + let alice_expected = alice_initial_balance - adjusted_balance(eth(1), transfer_amount); + assert_eq!(alice_balance, alice_expected); }); Sibling::execute_with(|| { - let fee_adjusted = adjusted_balance(eth(1), eth_fee()); - let expected = transfer_amount - fee_adjusted; + let expected = bob_initial_balance + transfer_amount - adjusted_balance(eth(1), eth_fee()); + let expected_sovereign = initial_sovereign_balance - transfer_amount; // Verify that Bob now has initial balance + amount transferred - fee - assert_eq!(Balances::free_balance(&BOB), sibling_bob_initial_balance + expected,); - + assert_eq!(Balances::free_balance(&bob()), expected); // Verify that the amount transferred is now subtracted from the zeitgeist account at sibling - assert_eq!( - Balances::free_balance(zeitgeist_parachain_account()), - initial_sovereign_balance - transfer_amount - ); + assert_eq!(Balances::free_balance(zeitgeist_parachain_account()), expected_sovereign); }); } #[test] fn transfer_dot_from_relay_chain() { - TestNet::reset(); - - let transfer_amount: Balance = dot(2); + let transfer_amount: Balance = dot(1); + let mut treasury_initial_balance = 0; + let mut bob_initial_balance = 0; Zeitgeist::execute_with(|| { register_foreign_parent(None); + treasury_initial_balance = + AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ZeitgeistTreasuryAccount::get()); + bob_initial_balance = AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &bob()); }); - PolkadotNet::execute_with(|| { - let initial_balance = polkadot_runtime::Balances::free_balance(&ALICE); + Polkadot::execute_with(|| { + let initial_balance = polkadot_runtime::Balances::free_balance(&alice()); assert!(initial_balance >= transfer_amount); assert_ok!(polkadot_runtime::XcmPallet::reserve_transfer_assets( - polkadot_runtime::RuntimeOrigin::signed(ALICE), - Box::new(Parachain(zeitgeist::ID).into()), - Box::new(Junction::AccountId32 { network: None, id: BOB.into() }.into()), + polkadot_runtime::RuntimeOrigin::signed(alice()), + Box::new(Parachain(PARA_ID_ZEITGEIST).into()), + Box::new(Junction::AccountId32 { network: None, id: bob().into() }.into()), Box::new((Here, transfer_amount).into()), 0 )); }); Zeitgeist::execute_with(|| { - assert_eq!( - AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &BOB), - transfer_amount - dot_fee() - ); - }); -} - -#[test] -fn transfer_dot_to_relay_chain() { - TestNet::reset(); - - let transfer_amount: Balance = dot(2); - transfer_dot_from_relay_chain(); - - Zeitgeist::execute_with(|| { - let initial_balance = AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ALICE); - assert!(initial_balance >= transfer_amount); - - assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), - FOREIGN_PARENT_ID, - transfer_amount, - Box::new( - MultiLocation::new(1, X1(Junction::AccountId32 { id: BOB.into(), network: None })) - .into() - ), - WeightLimit::Unlimited, - )); + let expected = transfer_amount - dot_fee(); + let bob_expected = bob_initial_balance + adjusted_balance(dot(1), expected); + let treasury_expected = treasury_initial_balance + adjusted_balance(dot(1), dot_fee()); + assert_eq!(AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &bob()), bob_expected); + // Verify that fees (of foreign currency) have been put into treasury assert_eq!( - AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ALICE), - initial_balance - transfer_amount + AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &ZeitgeistTreasuryAccount::get()), + treasury_expected ) }); - - PolkadotNet::execute_with(|| { - assert_eq!(polkadot_runtime::Balances::free_balance(&BOB), 19_637_471_000); - }); } #[test] -fn transfer_ztg_to_sibling_with_custom_fee() { - TestNet::reset(); - - let alice_initial_balance = ztg(10); - // 10x fee factor, so ZTG has 10x the worth of sibling currency. - let fee_factor = 100_000_000_000; - let transfer_amount = ztg(5); - let mut treasury_initial_balance = 0; - - Sibling::execute_with(|| { - treasury_initial_balance = - AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()); - assert_eq!(AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB), 0); +fn transfer_dot_to_relay_chain() { + let transfer_amount: Balance = dot(1); + let transfer_amount_local: Balance = adjusted_balance(dot(1), transfer_amount); + let mut initial_balance_bob = 0; - register_foreign_ztg(None); - let custom_metadata = CustomMetadata { - xcm: XcmMetadata { fee_factor: Some(fee_factor) }, - ..Default::default() - }; - assert_ok!(AssetRegistry::do_update_asset( - FOREIGN_ZTG_ID, - None, - None, - None, - None, - None, - Some(custom_metadata) - )); + Polkadot::execute_with(|| { + initial_balance_bob = polkadot_runtime::Balances::free_balance(&bob()); + let bs_acc = Polkadot::sovereign_account_id_of_child_para(PARA_ID_ZEITGEIST.into()); + assert_eq!( + polkadot_runtime::Balances::set_balance(&bs_acc, transfer_amount), + transfer_amount + ); }); Zeitgeist::execute_with(|| { - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance); - assert_eq!(Balances::free_balance(sibling_parachain_account()), 0); + register_foreign_parent(None); + let initial_balance = AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &alice()); + assert!(initial_balance >= transfer_amount_local); + assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(ALICE), - XcmAsset::Ztg, + RuntimeOrigin::signed(alice()), + FOREIGN_PARENT_ID, transfer_amount, Box::new( MultiLocation::new( 1, - X2( - Parachain(PARA_ID_SIBLING), - Junction::AccountId32 { network: None, id: BOB.into() } - ) + X1(Junction::AccountId32 { id: bob().into(), network: None }) ) .into() ), - WeightLimit::Limited(4_000_000_000.into()), + WeightLimit::Limited(4_000_000_000.into()) )); - // Confirm that Alice's balance is initial_balance - amount_transferred - assert_eq!(Balances::free_balance(&ALICE), alice_initial_balance - transfer_amount); - - // Verify that the amount transferred is now part of the sibling account here - assert_eq!(Balances::free_balance(sibling_parachain_account()), transfer_amount); - }); - - Sibling::execute_with(|| { - let current_balance = AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &BOB); - let custom_fee = calc_fee(default_per_second(10) * 10); - - // Verify that BOB now has (amount transferred - fee) - assert_eq!(current_balance, transfer_amount - custom_fee); - - // Sanity check for the actual amount BOB ends up with - assert_eq!(current_balance, transfer_amount - ztg_fee() * fee_factor / BASE); - - // Verify that fees (of foreign currency) have been put into treasury assert_eq!( - AssetManager::free_balance(FOREIGN_ZTG_ID.into(), &ZeitgeistTreasuryAccount::get()), - treasury_initial_balance + custom_fee + AssetManager::free_balance(FOREIGN_PARENT_ID.into(), &alice()), + initial_balance - transfer_amount_local ) }); + + #[cfg(not(feature = "runtime-benchmarks"))] + // polkadot-runtime does not process messages when runtime-benchmarks is enabled: + // https://github.com/paritytech/polkadot-sdk/blob/release-polkadot-v1.1.0/polkadot/runtime/polkadot/src/lib.rs#L1138-L1140 + Polkadot::execute_with(|| { + let expected_fee = 21_062_795; + let expected_balance_bob = initial_balance_bob + transfer_amount - expected_fee; + assert_eq!(polkadot_runtime::Balances::free_balance(&bob()), expected_balance_bob); + }); } #[test] fn test_total_fee() { + assert_eq!(btc_fee(), 642_960); + assert_eq!(dot_fee(), 80_370_000); assert_eq!(ztg_fee(), 64_296_000); - assert_eq!(dot_fee(), ztg_fee()); + assert_eq!(eth_fee(), 6_429_600_000_000_000); } #[inline] fn ztg_fee() -> Balance { - fee(BalanceFractionalDecimals::get().into()) + fee(BalanceFractionalDecimals::get().into(), 8) } #[inline] -fn fee(decimals: u32) -> Balance { - calc_fee(default_per_second(decimals)) +fn fee(decimals: u32, multiplier: Balance) -> Balance { + calc_fee(default_per_second(decimals), multiplier) } -// The fee associated with transferring dot tokens #[inline] fn dot_fee() -> Balance { - fee(10) + fee(10, 10) } #[inline] fn btc_fee() -> Balance { - fee(8) + fee(8, 8) } #[inline] fn eth_fee() -> Balance { - fee(18) + fee(18, 8) } #[inline] -const fn calc_fee(fee_per_second: Balance) -> Balance { - // We divide the fee to align its unit and multiply by 8 as that seems to be the unit of - // time the tests take. - // NOTE: it is possible that in different machines this value may differ. We shall see. - fee_per_second / 10_000 * 8 +const fn calc_fee(fee_per_second: Balance, multiplier: Balance) -> Balance { + // Adjust fee per second to actual test execution time + fee_per_second / 10_000 * multiplier } diff --git a/runtime/zeitgeist/src/xcm_config/config.rs b/runtime/zeitgeist/src/xcm_config/config.rs index 4dd3acfff..fe1b0b03f 100644 --- a/runtime/zeitgeist/src/xcm_config/config.rs +++ b/runtime/zeitgeist/src/xcm_config/config.rs @@ -56,7 +56,7 @@ use xcm_executor::{traits::TransactAsset, Assets as ExecutorAssets}; use zeitgeist_primitives::{constants::BalanceFractionalDecimals, types::XcmAsset}; pub mod zeitgeist { - #[cfg(test)] + #[cfg(any(test, feature = "runtime-benchmarks"))] pub const ID: u32 = 2092; pub const KEY: &[u8] = &[0, 1]; } From 6fa6cc29f6c2a6f3e676efcce3b4f3d274477e56 Mon Sep 17 00:00:00 2001 From: Harald Heckmann Date: Sun, 28 Apr 2024 10:36:06 +0200 Subject: [PATCH 12/12] Update license --- runtime/zeitgeist/src/integration_tests/xcm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/zeitgeist/src/integration_tests/xcm/mod.rs b/runtime/zeitgeist/src/integration_tests/xcm/mod.rs index 6eaedfc32..9ba9a1de3 100644 --- a/runtime/zeitgeist/src/integration_tests/xcm/mod.rs +++ b/runtime/zeitgeist/src/integration_tests/xcm/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Forecasting Technologies LTD. +// Copyright 2022-2024 Forecasting Technologies LTD. // // This file is part of Zeitgeist. //