diff --git a/CODEOWNERS b/CODEOWNERS index 74c117914..00e47700b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -11,6 +11,7 @@ /zrml/authorized/ @Chralt98 /zrml/court/ @Chralt98 /zrml/global-disputes/ @Chralt98 +/zrml/neo-swaps/ @maltekliemann /zrml/prediction-markets/ @maltekliemann /zrml/rikiddo/ @sea212 /zrml/simple-disputes/ @Chralt98 @@ -19,4 +20,4 @@ # Skip weight and Cargo.toml files **/weights.rs -**/Cargo.toml \ No newline at end of file +**/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 047c57c25..5b742f1c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -532,7 +532,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "battery-station-runtime" -version = "0.3.11" +version = "0.4.0" dependencies = [ "cfg-if", "common-runtime", @@ -623,6 +623,7 @@ dependencies = [ "zrml-global-disputes", "zrml-liquidity-mining", "zrml-market-commons", + "zrml-neo-swaps", "zrml-orderbook-v1", "zrml-prediction-markets", "zrml-rikiddo", @@ -911,9 +912,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" [[package]] name = "byteorder" @@ -1203,7 +1204,7 @@ dependencies = [ [[package]] name = "common-runtime" -version = "0.3.11" +version = "0.4.0" dependencies = [ "cfg-if", "cumulus-pallet-xcmp-queue", @@ -1235,6 +1236,7 @@ dependencies = [ "pallet-treasury", "pallet-utility", "pallet-vesting", + "zeitgeist-primitives", ] [[package]] @@ -3600,6 +3602,20 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "hydra-dx-math" +version = "7.4.3" +source = "git+https://github.com/galacticcouncil/HydraDX-node?tag=v18.0.0#6173a8b0661582247eed774330aa8fa6d99d524d" +dependencies = [ + "fixed", + "num-traits", + "parity-scale-codec", + "primitive-types", + "scale-info", + "sp-arithmetic", + "sp-std", +] + [[package]] name = "hyper" version = "0.14.27" @@ -5123,7 +5139,7 @@ dependencies = [ [[package]] name = "moonbeam-vrf" version = "0.1.0" -source = "git+https://github.com/zeitgeistpm/moonbeam?branch=polkadot-v0.9.38-use-paritytech-dependencies#286d43904f4e8fe5f114731e0c20fcca052a30e3" +source = "git+https://github.com/zeitgeistpm/moonbeam?branch=polkadot-v0.9.38-use-paritytech-dependencies#095ddae0ea44d8385453091e5e11d475b3dbda1e" dependencies = [ "nimbus-primitives", "parity-scale-codec", @@ -5878,7 +5894,7 @@ dependencies = [ [[package]] name = "pallet-author-mapping" version = "2.0.5" -source = "git+https://github.com/zeitgeistpm/moonbeam?branch=polkadot-v0.9.38-use-paritytech-dependencies#286d43904f4e8fe5f114731e0c20fcca052a30e3" +source = "git+https://github.com/zeitgeistpm/moonbeam?branch=polkadot-v0.9.38-use-paritytech-dependencies#095ddae0ea44d8385453091e5e11d475b3dbda1e" dependencies = [ "frame-benchmarking", "frame-support", @@ -6484,7 +6500,7 @@ dependencies = [ [[package]] name = "pallet-parachain-staking" version = "3.0.0" -source = "git+https://github.com/zeitgeistpm/moonbeam?branch=polkadot-v0.9.38-use-paritytech-dependencies#286d43904f4e8fe5f114731e0c20fcca052a30e3" +source = "git+https://github.com/zeitgeistpm/moonbeam?branch=polkadot-v0.9.38-use-paritytech-dependencies#095ddae0ea44d8385453091e5e11d475b3dbda1e" dependencies = [ "frame-benchmarking", "frame-support", @@ -10855,7 +10871,7 @@ dependencies = [ [[package]] name = "session-keys-primitives" version = "0.1.0" -source = "git+https://github.com/zeitgeistpm/moonbeam?branch=polkadot-v0.9.38-use-paritytech-dependencies#286d43904f4e8fe5f114731e0c20fcca052a30e3" +source = "git+https://github.com/zeitgeistpm/moonbeam?branch=polkadot-v0.9.38-use-paritytech-dependencies#095ddae0ea44d8385453091e5e11d475b3dbda1e" dependencies = [ "async-trait", "frame-support", @@ -14261,7 +14277,7 @@ dependencies = [ [[package]] name = "zeitgeist-node" -version = "0.3.11" +version = "0.4.0" dependencies = [ "battery-station-runtime", "cfg-if", @@ -14353,7 +14369,7 @@ dependencies = [ [[package]] name = "zeitgeist-primitives" -version = "0.3.11" +version = "0.4.0" dependencies = [ "arbitrary", "fixed", @@ -14375,7 +14391,7 @@ dependencies = [ [[package]] name = "zeitgeist-runtime" -version = "0.3.11" +version = "0.4.0" dependencies = [ "cfg-if", "common-runtime", @@ -14465,6 +14481,7 @@ dependencies = [ "zrml-global-disputes", "zrml-liquidity-mining", "zrml-market-commons", + "zrml-neo-swaps", "zrml-orderbook-v1", "zrml-prediction-markets", "zrml-rikiddo", @@ -14496,7 +14513,7 @@ dependencies = [ [[package]] name = "zrml-authorized" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -14513,7 +14530,7 @@ dependencies = [ [[package]] name = "zrml-court" -version = "0.3.11" +version = "0.4.0" dependencies = [ "arrayvec 0.7.4", "frame-benchmarking", @@ -14537,7 +14554,7 @@ dependencies = [ [[package]] name = "zrml-global-disputes" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -14557,7 +14574,7 @@ dependencies = [ [[package]] name = "zrml-liquidity-mining" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -14575,7 +14592,7 @@ dependencies = [ [[package]] name = "zrml-market-commons" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-support", "frame-system", @@ -14589,9 +14606,53 @@ dependencies = [ "zeitgeist-primitives", ] +[[package]] +name = "zrml-neo-swaps" +version = "0.4.0" +dependencies = [ + "fixed", + "frame-benchmarking", + "frame-support", + "frame-system", + "hydra-dx-math", + "more-asserts", + "orml-asset-registry", + "orml-currencies", + "orml-tokens", + "orml-traits", + "pallet-balances", + "pallet-randomness-collective-flip", + "pallet-timestamp", + "pallet-treasury", + "pallet-xcm", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-io", + "sp-runtime", + "substrate-fixed", + "test-case", + "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "xcm", + "xcm-builder", + "zeitgeist-primitives", + "zrml-authorized", + "zrml-court", + "zrml-global-disputes", + "zrml-liquidity-mining", + "zrml-market-commons", + "zrml-neo-swaps", + "zrml-prediction-markets", + "zrml-prediction-markets-runtime-api", + "zrml-rikiddo", + "zrml-simple-disputes", + "zrml-swaps", +] + [[package]] name = "zrml-orderbook-v1" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -14644,7 +14705,7 @@ dependencies = [ [[package]] name = "zrml-prediction-markets" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -14696,7 +14757,7 @@ dependencies = [ [[package]] name = "zrml-prediction-markets-runtime-api" -version = "0.3.11" +version = "0.4.0" dependencies = [ "parity-scale-codec", "sp-api", @@ -14705,7 +14766,7 @@ dependencies = [ [[package]] name = "zrml-rikiddo" -version = "0.3.11" +version = "0.4.0" dependencies = [ "arbitrary", "cfg-if", @@ -14738,7 +14799,7 @@ dependencies = [ [[package]] name = "zrml-simple-disputes" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -14758,7 +14819,7 @@ dependencies = [ [[package]] name = "zrml-styx" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -14774,7 +14835,7 @@ dependencies = [ [[package]] name = "zrml-swaps" -version = "0.3.11" +version = "0.4.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -14817,7 +14878,7 @@ dependencies = [ [[package]] name = "zrml-swaps-rpc" -version = "0.3.11" +version = "0.4.0" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -14830,7 +14891,7 @@ dependencies = [ [[package]] name = "zrml-swaps-runtime-api" -version = "0.3.11" +version = "0.4.0" dependencies = [ "parity-scale-codec", "sp-api", diff --git a/Cargo.toml b/Cargo.toml index 5167cef07..79f4efb37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ default-members = [ "zrml/global-disputes", "zrml/liquidity-mining", "zrml/market-commons", + "zrml/neo-swaps", "zrml/orderbook-v1", "zrml/parimutuel", "zrml/prediction-markets", @@ -32,6 +33,7 @@ members = [ "zrml/global-disputes", "zrml/liquidity-mining", "zrml/market-commons", + "zrml/neo-swaps", "zrml/orderbook-v1", "zrml/orderbook-v1/fuzz", "zrml/parimutuel", @@ -231,6 +233,7 @@ zrml-court = { path = "zrml/court", default-features = false } zrml-global-disputes = { path = "zrml/global-disputes", default-features = false } zrml-liquidity-mining = { path = "zrml/liquidity-mining", default-features = false } zrml-market-commons = { path = "zrml/market-commons", default-features = false } +zrml-neo-swaps = { path = "zrml/neo-swaps", default-features = false } zrml-orderbook-v1 = { path = "zrml/orderbook-v1", default-features = false } zrml-prediction-markets = { path = "zrml/prediction-markets", default-features = false } zrml-prediction-markets-runtime-api = { path = "zrml/prediction-markets/runtime-api", default-features = false } @@ -253,6 +256,8 @@ arbitrary = { version = "1.3.0", default-features = false } arrayvec = { version = "0.7.4", default-features = false } cfg-if = { version = "1.0.0" } fixed = { version = "=1.15.0", default-features = false, features = ["num-traits"] } +# Using math code directly from the HydraDX node repository as https://github.com/galacticcouncil/hydradx-math is outdated and has been archived in May 2023. +hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-node", package = "hydra-dx-math", tag = "v18.0.0", default-features = false } # Hashbrown works in no_std by default and default features are used in Rikiddo hashbrown = { version = "0.12.3", default-features = true } hex-literal = { version = "0.3.4", default-features = false } diff --git a/README.md b/README.md index b31e630fb..62263e619 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,18 @@ # Zeitgeist: An Evolving Blockchain for Prediction Markets and Futarchy -![Rust](https://github.com/zeitgeistpm/zeitgeist/workflows/Rust/badge.svg) [![Codecov](https://codecov.io/gh/zeitgeistpm/zeitgeist/branch/main/graph/badge.svg)](https://codecov.io/gh/zeitgeistpm/zeitgeist) [![Discord](https://img.shields.io/badge/discord-https%3A%2F%2Fdiscord.gg%2FMD3TbH3ctv-purple)](https://discord.gg/MD3TbH3ctv) [![Telegram](https://img.shields.io/badge/telegram-https%3A%2F%2Ft.me%2Fzeitgeist__official-blue)](https://t.me/zeitgeist_official) +![Rust](https://github.com/zeitgeistpm/zeitgeist/workflows/Rust/badge.svg) +[![Codecov](https://codecov.io/gh/zeitgeistpm/zeitgeist/branch/main/graph/badge.svg)](https://codecov.io/gh/zeitgeistpm/zeitgeist) +[![Discord](https://img.shields.io/badge/discord-https%3A%2F%2Fdiscord.gg%2FMD3TbH3ctv-purple)](https://discord.gg/MD3TbH3ctv) +[![Telegram](https://img.shields.io/badge/telegram-https%3A%2F%2Ft.me%2Fzeitgeist__official-blue)](https://t.me/zeitgeist_official) Zeitgeist is a decentralized network for creating, betting on, and resolving prediction markets. The platform's native currency, the ZTG, is used to sway the direction of the network, and as a means of last-call dispute resolution. Additionally, Zeitgeist is a protocol for efficient trading of prediction market shares and will one day become the backbone of the decentralized finance -ecosystem by allowing traders to create complex financial contracts on -virtually _anything_. +ecosystem by allowing traders to create complex financial contracts on virtually +_anything_. ## Modules @@ -27,6 +30,9 @@ virtually _anything_. liquidity to swap pools. - [market-commons](./zrml/market-commons) - Contains common operations on markets that are used by multiple pallets. +- [neo-swaps](./zrml/neo-swaps) - An implementation of the Logarithmic Market + Scoring Rule as constant function market maker, tailor-made for decentralized + combinatorial markets and Futarchy. - [orderbook-v1](./zrml/orderbook-v1) - A naive orderbook implementation that's only part of Zeitgeist's PoC. Will be replaced by a v2 orderbook that uses 0x-style hybrid on-chain and off-chain trading. diff --git a/docs/changelog_for_devs.md b/docs/changelog_for_devs.md index fbdf342e4..29f993350 100644 --- a/docs/changelog_for_devs.md +++ b/docs/changelog_for_devs.md @@ -12,6 +12,38 @@ As of 0.3.9, the changelog's format is based on components which query the chain's storage, the extrinsics or the runtime APIs/RPC interface. +## v0.4.1 + +### Added + +- Implement AMM-2.0-light in the form of zrml-neo-swaps. The new pallet has the + following dispatchables: + + - `buy`: Buy outcome tokens from the specified market. + - `sell`: Sell outcome tokens to the specified market. + - `join`: Join the liquidity pool for the specified market. + - `exit`: Exit the liquidity pool for the specified market. + - `withdraw_fees`: Withdraw swap fees from the specified market. + - `deploy_pool`: Deploy a pool for the specified market and provide liquidity. + + The new pallet has the following events: + + - `BuyExecuted { who, market_id, asset_out, amount_in, amount_out, swap_fee_amount, external_fee_amount }`: + Informant bought a position. + - `SellExecuted { who, market_id, asset_in, amount_in, amount_out, swap_fee_amount, external_fee_amount }`: + Informants sold a position. + - `FeesWithdrawn { who }`: Liquidity provider withdrew fees. + - `JoinExecuted { who, market_id, pool_shares_amount, amounts_in, new_liquidity_parameter }`: + Liquidity provider joined the pool. + - `ExitExecuted { who, market_id, pool_shares_amount, amounts_out, new_liquidity_parameter }`: + Liquidity provider left the pool. + - `PoolDeployed { who, market_id, pool_shares_amount, amounts_in, liquidity_parameter }`: + Pool was created. + - `PoolDestroyed { who, market_id, pool_shares_amount, amounts_out }`: Pool + was destroyed. + + For details, please refer to the `README.md` and the in-file documentation. + ## v0.4.0 [#976]: https://github.com/zeitgeistpm/zeitgeist/pull/976 diff --git a/node/Cargo.toml b/node/Cargo.toml index 2309a837b..7cf8ed08c 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -187,7 +187,7 @@ description = "An evolving blockchain for prediction markets and futarchy." edition = "2021" homepage = "https://zeitgeist.pm" name = "zeitgeist-node" -version = "0.3.11" +version = "0.4.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/node/res/bs_parachain.json b/node/res/bs_parachain.json index 24eae3dbe..8f6d2574e 100644 --- a/node/res/bs_parachain.json +++ b/node/res/bs_parachain.json @@ -25,6 +25,9 @@ "parachain_id": 2101, "relay_chain": "rococo", "consensusEngine": null, + "bad_blocks": [ + "0x74d8c181547c1607ed28120f94cbe527cb3828772b3e794aabb45dc6a16e482d" + ], "codeSubstitutes": {}, "genesis": { "raw": { @@ -97,4 +100,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index eb15b3807..82e613543 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -14,8 +14,8 @@ sp-core = { workspace = true } sp-runtime = { workspace = true } [dev-dependencies] -test-case = { workspace = true } more-asserts = { workspace = true } +test-case = { workspace = true } typenum = { workspace = true } [features] @@ -37,4 +37,4 @@ std = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zeitgeist-primitives" -version = "0.3.11" +version = "0.4.0" diff --git a/primitives/src/constants.rs b/primitives/src/constants.rs index d5e32ef71..3841666a1 100644 --- a/primitives/src/constants.rs +++ b/primitives/src/constants.rs @@ -37,7 +37,8 @@ pub const BLOCKS_PER_MINUTE: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as Bloc pub const BLOCKS_PER_HOUR: BlockNumber = BLOCKS_PER_MINUTE * 60; // 300 // Definitions for currency -pub const BASE: u128 = 10_000_000_000; +pub const DECIMALS: u8 = 10; +pub const BASE: u128 = 10u128.pow(DECIMALS as u32); pub const CENT: Balance = BASE / 100; // 100_000_000 pub const MILLI: Balance = CENT / 10; // 10_000_000 pub const MICRO: Balance = MILLI / 1000; // 10_000 @@ -82,6 +83,9 @@ pub const GLOBAL_DISPUTES_LOCK_ID: [u8; 8] = *b"zge/gdlk"; /// Pallet identifier, mainly used for named balance reserves. pub const LM_PALLET_ID: PalletId = PalletId(*b"zge/lymg"); +// NeoSwaps +pub const NS_PALLET_ID: PalletId = PalletId(*b"zge/neos"); + // Prediction Markets /// The maximum allowed market life time, measured in blocks. pub const MAX_MARKET_LIFETIME: BlockNumber = 4 * BLOCKS_PER_YEAR; diff --git a/primitives/src/constants/mock.rs b/primitives/src/constants/mock.rs index 45fd822cf..8945dda69 100644 --- a/primitives/src/constants/mock.rs +++ b/primitives/src/constants/mock.rs @@ -70,6 +70,13 @@ parameter_types! { pub const LiquidityMiningPalletId: PalletId = PalletId(*b"zge/lymg"); } +// NeoSwaps +parameter_types! { + pub storage NeoExitFee: Balance = CENT; + pub const NeoMaxSwapFee: Balance = 10 * CENT; + pub const NeoSwapsPalletId: PalletId = PalletId(*b"zge/neos"); +} + // Prediction Market parameters parameter_types! { pub const AdvisoryBond: Balance = 25 * CENT; @@ -152,11 +159,10 @@ parameter_types! { } parameter_type_with_key! { - // Well, not every asset is a currency ¯\_(ツ)_/¯ pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance { match currency_id { Asset::Ztg => ExistentialDeposit::get(), - _ => 0 + _ => 10 } }; } diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 5992be965..5a3d424d8 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -1,3 +1,4 @@ +// Copyright 2023 Forecasting Technologies LTD. // Copyright 2021-2022 Zeitgeist PM LLC. // // This file is part of Zeitgeist. diff --git a/primitives/src/pool.rs b/primitives/src/pool.rs index cb5d15bd0..2b1c70529 100644 --- a/primitives/src/pool.rs +++ b/primitives/src/pool.rs @@ -84,6 +84,7 @@ where pub enum ScoringRule { CPMM, RikiddoSigmoidFeeMarketEma, + Lmsr, Orderbook, Parimutuel, } diff --git a/primitives/src/traits.rs b/primitives/src/traits.rs index f196c93fb..cea15e4d0 100644 --- a/primitives/src/traits.rs +++ b/primitives/src/traits.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with Zeitgeist. If not, see . +mod complete_set_operations_api; +mod deploy_pool_api; mod dispute_api; mod distribute_fees; mod market_commons_pallet_api; @@ -23,6 +25,8 @@ mod market_id; mod swaps; mod zeitgeist_multi_reservable_currency; +pub use complete_set_operations_api::CompleteSetOperationsApi; +pub use deploy_pool_api::DeployPoolApi; pub use dispute_api::{DisputeApi, DisputeMaxWeightApi, DisputeResolutionApi}; pub use distribute_fees::DistributeFees; pub use market_commons_pallet_api::MarketCommonsPalletApi; diff --git a/primitives/src/traits/complete_set_operations_api.rs b/primitives/src/traits/complete_set_operations_api.rs new file mode 100644 index 000000000..3685da5b4 --- /dev/null +++ b/primitives/src/traits/complete_set_operations_api.rs @@ -0,0 +1,35 @@ +// Copyright 2023 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 sp_runtime::DispatchResult; + +pub trait CompleteSetOperationsApi { + type AccountId; + type Balance; + type MarketId; + + fn buy_complete_set( + who: Self::AccountId, + market_id: Self::MarketId, + amount: Self::Balance, + ) -> DispatchResult; + fn sell_complete_set( + who: Self::AccountId, + market_id: Self::MarketId, + amount: Self::Balance, + ) -> DispatchResult; +} diff --git a/primitives/src/traits/deploy_pool_api.rs b/primitives/src/traits/deploy_pool_api.rs new file mode 100644 index 000000000..92f0bd1df --- /dev/null +++ b/primitives/src/traits/deploy_pool_api.rs @@ -0,0 +1,33 @@ +// Copyright 2023 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 alloc::vec::Vec; +use sp_runtime::DispatchResult; + +pub trait DeployPoolApi { + type AccountId; + type Balance; + type MarketId; + + fn deploy_pool( + who: Self::AccountId, + market_id: Self::MarketId, + amount: Self::Balance, + swap_prices: Vec, + swap_fee: Self::Balance, + ) -> DispatchResult; +} diff --git a/runtime/battery-station/Cargo.toml b/runtime/battery-station/Cargo.toml index b6e040f1d..7df3e156b 100644 --- a/runtime/battery-station/Cargo.toml +++ b/runtime/battery-station/Cargo.toml @@ -1,7 +1,6 @@ [build-dependencies] substrate-wasm-builder = { workspace = true } - [dependencies] frame-executive = { workspace = true } frame-support = { workspace = true } @@ -113,6 +112,7 @@ zrml-court = { workspace = true } zrml-global-disputes = { workspace = true, optional = true } zrml-liquidity-mining = { workspace = true } zrml-market-commons = { workspace = true } +zrml-neo-swaps = { workspace = true } zrml-orderbook-v1 = { workspace = true } zrml-prediction-markets = { workspace = true } zrml-rikiddo = { workspace = true } @@ -178,8 +178,8 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "hex-literal", "orml-asset-registry?/runtime-benchmarks", - "orml-tokens/runtime-benchmarks", "orml-benchmarking", + "orml-tokens/runtime-benchmarks", "orml-xtokens?/runtime-benchmarks", "pallet-author-inherent?/runtime-benchmarks", "pallet-author-mapping?/runtime-benchmarks", @@ -210,6 +210,7 @@ runtime-benchmarks = [ "zrml-authorized/runtime-benchmarks", "zrml-court/runtime-benchmarks", "zrml-liquidity-mining/runtime-benchmarks", + "zrml-neo-swaps/runtime-benchmarks", "zrml-prediction-markets/runtime-benchmarks", "zrml-simple-disputes/runtime-benchmarks", "zrml-global-disputes/runtime-benchmarks", @@ -323,6 +324,7 @@ std = [ "zrml-court/std", "zrml-liquidity-mining/std", "zrml-market-commons/std", + "zrml-neo-swaps/std", "zrml-prediction-markets/std", "zrml-rikiddo/std", "zrml-simple-disputes/std", @@ -377,6 +379,7 @@ try-runtime = [ "zrml-court/try-runtime", "zrml-liquidity-mining/try-runtime", "zrml-market-commons/try-runtime", + "zrml-neo-swaps/try-runtime", "zrml-prediction-markets/try-runtime", "zrml-rikiddo/try-runtime", "zrml-simple-disputes/try-runtime", @@ -410,7 +413,7 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "battery-station-runtime" -version = "0.3.11" +version = "0.4.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/battery-station/src/lib.rs b/runtime/battery-station/src/lib.rs index 5e251eada..d39d2250d 100644 --- a/runtime/battery-station/src/lib.rs +++ b/runtime/battery-station/src/lib.rs @@ -105,10 +105,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("zeitgeist"), impl_name: create_runtime_str!("zeitgeist"), authoring_version: 1, - spec_version: 48, + spec_version: 49, impl_version: 1, apis: RUNTIME_API_VERSIONS, - transaction_version: 23, + transaction_version: 24, state_version: 1, }; diff --git a/runtime/battery-station/src/parameters.rs b/runtime/battery-station/src/parameters.rs index 63404e327..cca522405 100644 --- a/runtime/battery-station/src/parameters.rs +++ b/runtime/battery-station/src/parameters.rs @@ -190,6 +190,10 @@ parameter_types! { // Additional storage item size of 32 bytes. pub const DepositFactor: Balance = deposit(0, 32); + // NeoSwaps + pub const NeoSwapsMaxSwapFee: Balance = 10 * CENT; + pub const NeoSwapsPalletId: PalletId = NS_PALLET_ID; + // ORML pub const GetNativeCurrencyId: CurrencyId = Asset::Ztg; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 9ed0a7429..ed404d80b 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -29,6 +29,7 @@ pallet-transaction-payment-rpc-runtime-api = { workspace = true } pallet-treasury = { workspace = true } pallet-utility = { workspace = true } pallet-vesting = { workspace = true } +zeitgeist-primitives = { workspace = true } # Utility cfg-if = { workspace = true } @@ -72,13 +73,14 @@ std = [ "pallet-utility/std", "pallet-vesting/std", "pallet-parachain-staking?/std", + "zeitgeist-primitives/std", ] [package] authors = ["Zeitgeist PM "] edition = "2021" name = "common-runtime" -version = "0.3.11" +version = "0.4.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index d861d349c..134850e73 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -51,7 +51,9 @@ macro_rules! decl_common_types { }; #[cfg(feature = "try-runtime")] use frame_try_runtime::{TryStateSelect, UpgradeCheckSelect}; - use sp_runtime::generic; + use sp_runtime::{generic, DispatchResult}; + use zeitgeist_primitives::traits::DeployPoolApi; + use zrml_neo_swaps::types::MarketCreatorFee; pub type Block = generic::Block; @@ -219,10 +221,10 @@ macro_rules! decl_common_types { common_runtime::impl_fee_types!(); pub mod opaque { - //! Opaque types. These are used by the CLI to instantiate machinery that don't need to know - //! the specifics of the runtime. They can then be made to be agnostic over specific formats - //! of data like extrinsics, allowing for them to continue syncing the network through upgrades - //! to even the core data structures. + //! Opaque types. These are used by the CLI to instantiate machinery that don't need to + //! know the specifics of the runtime. They can then be made to be agnostic over + //! specific formats of data like extrinsics, allowing for them to continue syncing the + //! network through upgrades to even the core data structures. use super::Header; use alloc::vec::Vec; @@ -311,7 +313,8 @@ macro_rules! create_runtime { PredictionMarkets: zrml_prediction_markets::{Call, Event, Pallet, Storage} = 57, Styx: zrml_styx::{Call, Event, Pallet, Storage} = 58, GlobalDisputes: zrml_global_disputes::{Call, Event, Pallet, Storage} = 59, - Orderbook: zrml_orderbook_v1::{Call, Event, Pallet, Storage} = 60, + NeoSwaps: zrml_neo_swaps::{Call, Event, Pallet, Storage} = 60, + Orderbook: zrml_orderbook_v1::{Call, Event, Pallet, Storage} = 61, $($additional_pallets)* } @@ -1126,6 +1129,7 @@ macro_rules! impl_config_traits { type Court = Court; type CloseOrigin = EnsureRoot; type DestroyOrigin = EnsureRootOrAllAdvisoryCommittee; + type DeployPool = NeoSwaps; type DisputeBond = DisputeBond; type RuntimeEvent = RuntimeEvent; type GlobalDisputes = GlobalDisputes; @@ -1240,6 +1244,17 @@ macro_rules! impl_config_traits { type WeightInfo = zrml_styx::weights::WeightInfo; } + impl zrml_neo_swaps::Config for Runtime { + type CompleteSetOperations = PredictionMarkets; + type ExternalFees = MarketCreatorFee; + type MarketCommons = MarketCommons; + type MultiCurrency = AssetManager; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = zrml_neo_swaps::weights::WeightInfo; + type MaxSwapFee = NeoSwapsMaxSwapFee; + type PalletId = NeoSwapsPalletId; + } + impl zrml_orderbook_v1::Config for Runtime { type AssetManager = AssetManager; type RuntimeEvent = RuntimeEvent; @@ -1360,6 +1375,7 @@ macro_rules! create_runtime_api { list_benchmark!(list, extra, zrml_prediction_markets, PredictionMarkets); list_benchmark!(list, extra, zrml_liquidity_mining, LiquidityMining); list_benchmark!(list, extra, zrml_styx, Styx); + list_benchmark!(list, extra, zrml_neo_swaps, NeoSwaps); cfg_if::cfg_if! { if #[cfg(feature = "parachain")] { @@ -1462,6 +1478,7 @@ macro_rules! create_runtime_api { add_benchmark!(params, batches, zrml_prediction_markets, PredictionMarkets); add_benchmark!(params, batches, zrml_liquidity_mining, LiquidityMining); add_benchmark!(params, batches, zrml_styx, Styx); + add_benchmark!(params, batches, zrml_neo_swaps, NeoSwaps); cfg_if::cfg_if! { diff --git a/runtime/common/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/common/src/weights/cumulus_pallet_xcmp_queue.rs index f14fd748f..eb289e315 100644 --- a/runtime/common/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/common/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for cumulus_pallet_xcmp_queue //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-20`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,16 +52,26 @@ use frame_support::{ /// Weight functions for cumulus_pallet_xcmp_queue (automatically generated) pub struct WeightInfo(PhantomData); impl cumulus_pallet_xcmp_queue::weights::WeightInfo for WeightInfo { - // Storage: XcmpQueue QueueConfig (r:1 w:1) + /// Storage: XcmpQueue QueueConfig (r:1 w:1) + /// Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_config_with_u32() -> Weight { - Weight::from_ref_time(16_530_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `604` + // Minimum execution time: 8_490 nanoseconds. + Weight::from_parts(10_580_000, 604) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: XcmpQueue QueueConfig (r:1 w:1) + /// Storage: XcmpQueue QueueConfig (r:1 w:1) + /// Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_config_with_weight() -> Weight { - Weight::from_ref_time(13_770_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `604` + // Minimum execution time: 8_690 nanoseconds. + Weight::from_parts(9_020_000, 604) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/frame_system.rs b/runtime/common/src/weights/frame_system.rs index ac21fa85a..342d0affe 100644 --- a/runtime/common/src/weights/frame_system.rs +++ b/runtime/common/src/weights/frame_system.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -50,41 +53,68 @@ use frame_support::{ pub struct WeightInfo(PhantomData); impl frame_system::weights::WeightInfo for WeightInfo { fn remark(b: u32) -> Weight { - Weight::from_ref_time(8_310_000) - // Standard Error: 2 - .saturating_add(Weight::from_ref_time(736).saturating_mul(b.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_500 nanoseconds. + Weight::from_ref_time(4_150_000) + // Standard Error: 1 + .saturating_add(Weight::from_ref_time(835).saturating_mul(b.into())) } fn remark_with_event(b: u32) -> Weight { - Weight::from_ref_time(26_690_000) - // Standard Error: 7 - .saturating_add(Weight::from_ref_time(2_552).saturating_mul(b.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_910 nanoseconds. + Weight::from_ref_time(14_380_000) + // Standard Error: 6 + .saturating_add(Weight::from_ref_time(2_765).saturating_mul(b.into())) } - // Storage: System Digest (r:1 w:1) - // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + /// Storage: System Digest (r:1 w:1) + /// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: unknown `0x3a686561707061676573` (r:0 w:1) + /// Proof Skipped: unknown `0x3a686561707061676573` (r:0 w:1) fn set_heap_pages() -> Weight { - Weight::from_ref_time(21_740_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `495` + // Minimum execution time: 7_180 nanoseconds. + Weight::from_parts(8_880_000, 495) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) fn set_storage(i: u32) -> Weight { - Weight::from_ref_time(13_617_603) - // Standard Error: 10_697 - .saturating_add(Weight::from_ref_time(1_193_287).saturating_mul(i.into())) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_811 nanoseconds. + Weight::from_ref_time(4_190_000) + // Standard Error: 4_882 + .saturating_add(Weight::from_ref_time(1_253_851).saturating_mul(i.into())) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) fn kill_storage(i: u32) -> Weight { - Weight::from_ref_time(287_703) - // Standard Error: 10_038 - .saturating_add(Weight::from_ref_time(1_039_732).saturating_mul(i.into())) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_700 nanoseconds. + Weight::from_ref_time(3_830_000) + // Standard Error: 2_621 + .saturating_add(Weight::from_ref_time(974_623).saturating_mul(i.into())) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Measured) fn kill_prefix(p: u32) -> Weight { - Weight::from_ref_time(14_620_000) - // Standard Error: 9_413 - .saturating_add(Weight::from_ref_time(2_130_455).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + // Proof Size summary in bytes: + // Measured: `52 + p * (69 ±0)` + // Estimated: `52 + p * (70 ±0)` + // Minimum execution time: 8_380 nanoseconds. + Weight::from_parts(8_740_000, 52) + // Standard Error: 5_825 + .saturating_add(Weight::from_ref_time(2_194_146).saturating_mul(p.into())) + .saturating_add(Weight::from_proof_size(70).saturating_mul(p.into())) } } diff --git a/runtime/common/src/weights/orml_currencies.rs b/runtime/common/src/weights/orml_currencies.rs index f05185036..3cd307d25 100644 --- a/runtime/common/src/weights/orml_currencies.rs +++ b/runtime/common/src/weights/orml_currencies.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for orml_currencies //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/orml_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -46,37 +49,65 @@ use frame_support::{traits::Get, weights::Weight}; /// Weight functions for orml_currencies (automatically generated) pub struct WeightInfo(PhantomData); impl orml_currencies::WeightInfo for WeightInfo { - // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Account (r:1 w:1) + /// Storage: Tokens Accounts (r:2 w:2) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_non_native_currency() -> Weight { - Weight::from_ref_time(95_870_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1719` + // Estimated: `7803` + // Minimum execution time: 82_310 nanoseconds. + Weight::from_parts(100_000_000, 7803) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: System Account (r:1 w:1) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_native_currency() -> Weight { - Weight::from_ref_time(80_780_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1461` + // Estimated: `2607` + // Minimum execution time: 67_440 nanoseconds. + Weight::from_parts(82_220_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Tokens Accounts (r:1 w:1) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Tokens Accounts (r:1 w:1) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_balance_non_native_currency() -> Weight { - Weight::from_ref_time(57_330_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1327` + // Estimated: `7723` + // Minimum execution time: 56_450 nanoseconds. + Weight::from_parts(69_660_000, 7723) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: System Account (r:1 w:1) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_balance_native_currency_creating() -> Weight { - Weight::from_ref_time(67_611_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1401` + // Estimated: `2607` + // Minimum execution time: 56_870 nanoseconds. + Weight::from_parts(69_640_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: System Account (r:1 w:1) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn update_balance_native_currency_killing() -> Weight { - Weight::from_ref_time(64_301_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1525` + // Estimated: `2607` + // Minimum execution time: 62_330 nanoseconds. + Weight::from_parts(66_420_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/orml_tokens.rs b/runtime/common/src/weights/orml_tokens.rs index 99c14aa88..37191cce8 100644 --- a/runtime/common/src/weights/orml_tokens.rs +++ b/runtime/common/src/weights/orml_tokens.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for orml_tokens //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/orml_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -46,40 +49,71 @@ use frame_support::{traits::Get, weights::Weight}; /// Weight functions for orml_tokens (automatically generated) pub struct WeightInfo(PhantomData); impl orml_tokens::WeightInfo for WeightInfo { - // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Account (r:1 w:1) + /// Storage: Tokens Accounts (r:2 w:2) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer() -> Weight { - Weight::from_ref_time(84_390_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1719` + // Estimated: `7803` + // Minimum execution time: 81_920 nanoseconds. + Weight::from_parts(98_861_000, 7803) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Account (r:1 w:1) + /// Storage: Tokens Accounts (r:2 w:2) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_all() -> Weight { - Weight::from_ref_time(84_860_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1719` + // Estimated: `7803` + // Minimum execution time: 85_190 nanoseconds. + Weight::from_parts(86_860_000, 7803) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Account (r:1 w:1) + /// Storage: Tokens Accounts (r:2 w:2) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { - Weight::from_ref_time(66_500_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1543` + // Estimated: `7803` + // Minimum execution time: 66_690 nanoseconds. + Weight::from_parts(81_520_000, 7803) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Account (r:2 w:1) + /// Storage: Tokens Accounts (r:2 w:2) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_transfer() -> Weight { - Weight::from_ref_time(86_851_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1719` + // Estimated: `10410` + // Minimum execution time: 65_970 nanoseconds. + Weight::from_parts(69_540_000, 10410) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Tokens Accounts (r:1 w:1) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Tokens Accounts (r:1 w:1) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn set_balance() -> Weight { - Weight::from_ref_time(66_770_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1327` + // Estimated: `7723` + // Minimum execution time: 49_330 nanoseconds. + Weight::from_parts(60_580_000, 7723) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } } diff --git a/runtime/common/src/weights/pallet_author_inherent.rs b/runtime/common/src/weights/pallet_author_inherent.rs index 136466f7a..ddbe2f204 100644 --- a/runtime/common/src/weights/pallet_author_inherent.rs +++ b/runtime/common/src/weights/pallet_author_inherent.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_author_inherent //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-20`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,15 +52,25 @@ use frame_support::{ /// Weight functions for pallet_author_inherent (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_author_inherent::weights::WeightInfo for WeightInfo { - // Storage: ParachainSystem ValidationData (r:1 w:0) - // Storage: AuthorInherent HighestSlotSeen (r:1 w:1) - // Storage: AuthorInherent Author (r:1 w:0) - // Storage: ParachainStaking SelectedCandidates (r:1 w:0) - // Storage: AuthorFilter EligibleCount (r:1 w:0) - // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) + /// Storage: ParachainSystem ValidationData (r:1 w:0) + /// Proof Skipped: ParachainSystem ValidationData (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AuthorInherent HighestSlotSeen (r:1 w:1) + /// Proof: AuthorInherent HighestSlotSeen (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: AuthorInherent Author (r:1 w:0) + /// Proof: AuthorInherent Author (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) + /// Storage: ParachainStaking SelectedCandidates (r:1 w:0) + /// Proof Skipped: ParachainStaking SelectedCandidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AuthorFilter EligibleCount (r:1 w:0) + /// Proof Skipped: AuthorFilter EligibleCount (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) + /// Proof: RandomnessCollectiveFlip RandomMaterial (max_values: Some(1), max_size: Some(2594), added: 3089, mode: MaxEncodedLen) fn kick_off_authorship_validation() -> Weight { - Weight::from_ref_time(44_241_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `501` + // Estimated: `7103` + // Minimum execution time: 30_120 nanoseconds. + Weight::from_parts(31_720_000, 7103) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/pallet_author_mapping.rs b/runtime/common/src/weights/pallet_author_mapping.rs index 0dae5b36f..54ac8eb9c 100644 --- a/runtime/common/src/weights/pallet_author_mapping.rs +++ b/runtime/common/src/weights/pallet_author_mapping.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_author_mapping //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-20`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,42 +52,75 @@ use frame_support::{ /// Weight functions for pallet_author_mapping (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_author_mapping::weights::WeightInfo for WeightInfo { - // Storage: AuthorMapping MappingWithDeposit (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: AuthorMapping NimbusLookup (r:0 w:1) + /// Storage: AuthorMapping MappingWithDeposit (r:1 w:1) + /// Proof Skipped: AuthorMapping MappingWithDeposit (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: AuthorMapping NimbusLookup (r:0 w:1) + /// Proof Skipped: AuthorMapping NimbusLookup (max_values: None, max_size: None, mode: Measured) fn add_association() -> Weight { - Weight::from_ref_time(69_090_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `462` + // Estimated: `6006` + // Minimum execution time: 39_250 nanoseconds. + Weight::from_parts(48_190_000, 6006) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: AuthorMapping MappingWithDeposit (r:2 w:2) - // Storage: AuthorMapping NimbusLookup (r:0 w:1) + /// Storage: AuthorMapping MappingWithDeposit (r:2 w:2) + /// Proof Skipped: AuthorMapping MappingWithDeposit (max_values: None, max_size: None, mode: Measured) + /// Storage: AuthorMapping NimbusLookup (r:0 w:1) + /// Proof Skipped: AuthorMapping NimbusLookup (max_values: None, max_size: None, mode: Measured) fn update_association() -> Weight { - Weight::from_ref_time(48_700_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `407` + // Estimated: `5764` + // Minimum execution time: 30_370 nanoseconds. + Weight::from_parts(31_410_000, 5764) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: AuthorMapping MappingWithDeposit (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: AuthorMapping NimbusLookup (r:0 w:1) + /// Storage: AuthorMapping MappingWithDeposit (r:1 w:1) + /// Proof Skipped: AuthorMapping MappingWithDeposit (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: AuthorMapping NimbusLookup (r:0 w:1) + /// Proof Skipped: AuthorMapping NimbusLookup (max_values: None, max_size: None, mode: Measured) fn clear_association() -> Weight { - Weight::from_ref_time(60_150_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `583` + // Estimated: `6248` + // Minimum execution time: 41_640 nanoseconds. + Weight::from_parts(50_640_000, 6248) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: AuthorMapping NimbusLookup (r:1 w:1) - // Storage: AuthorMapping MappingWithDeposit (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: AuthorMapping NimbusLookup (r:1 w:1) + /// Proof Skipped: AuthorMapping NimbusLookup (max_values: None, max_size: None, mode: Measured) + /// Storage: AuthorMapping MappingWithDeposit (r:1 w:1) + /// Proof Skipped: AuthorMapping MappingWithDeposit (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) fn remove_keys() -> Weight { - Weight::from_ref_time(78_330_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `689` + // Estimated: `8935` + // Minimum execution time: 47_510 nanoseconds. + Weight::from_parts(48_051_000, 8935) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: AuthorMapping NimbusLookup (r:1 w:1) - // Storage: AuthorMapping MappingWithDeposit (r:2 w:2) + /// Storage: AuthorMapping NimbusLookup (r:1 w:1) + /// Proof Skipped: AuthorMapping NimbusLookup (max_values: None, max_size: None, mode: Measured) + /// Storage: AuthorMapping MappingWithDeposit (r:2 w:2) + /// Proof Skipped: AuthorMapping MappingWithDeposit (max_values: None, max_size: None, mode: Measured) fn set_keys() -> Weight { - Weight::from_ref_time(53_200_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `513` + // Estimated: `8451` + // Minimum execution time: 36_541 nanoseconds. + Weight::from_parts(37_800_000, 8451) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } } diff --git a/runtime/common/src/weights/pallet_author_slot_filter.rs b/runtime/common/src/weights/pallet_author_slot_filter.rs index 1cc8432e9..9682c8b1d 100644 --- a/runtime/common/src/weights/pallet_author_slot_filter.rs +++ b/runtime/common/src/weights/pallet_author_slot_filter.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_author_slot_filter //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-20`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,8 +52,13 @@ use frame_support::{ /// Weight functions for pallet_author_slot_filter (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_author_slot_filter::weights::WeightInfo for WeightInfo { - // Storage: AuthorFilter EligibleCount (r:0 w:1) + /// Storage: AuthorFilter EligibleCount (r:0 w:1) + /// Proof Skipped: AuthorFilter EligibleCount (max_values: Some(1), max_size: None, mode: Measured) fn set_eligible() -> Weight { - Weight::from_ref_time(28_890_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_520 nanoseconds. + Weight::from_ref_time(11_310_000).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 6a3e98c67..c34d6efdd 100644 --- a/runtime/common/src/weights/pallet_balances.rs +++ b/runtime/common/src/weights/pallet_balances.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,46 +52,81 @@ 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) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer() -> Weight { - Weight::from_ref_time(109_200_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `1585` + // Estimated: `5214` + // Minimum execution time: 110_920 nanoseconds. + Weight::from_parts(112_730_000, 5214) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: System Account (r:1 w:1) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { - Weight::from_ref_time(60_490_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1409` + // Estimated: `2607` + // Minimum execution time: 61_750 nanoseconds. + Weight::from_parts(74_220_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: System Account (r:1 w:1) + /// 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 { - Weight::from_ref_time(54_180_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1559` + // Estimated: `2607` + // Minimum execution time: 53_450 nanoseconds. + Weight::from_parts(59_371_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: System Account (r:1 w:1) + /// 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 { - Weight::from_ref_time(60_760_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1559` + // Estimated: `2607` + // Minimum execution time: 65_040 nanoseconds. + Weight::from_parts(65_980_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: System Account (r:3 w:3) + /// Storage: System Account (r:3 w:3) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_transfer() -> Weight { - Weight::from_ref_time(90_620_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1581` + // Estimated: `7821` + // Minimum execution time: 110_150 nanoseconds. + Weight::from_parts(111_860_000, 7821) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: System Account (r:1 w:1) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn transfer_all() -> Weight { - Weight::from_ref_time(69_090_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1409` + // Estimated: `2607` + // Minimum execution time: 84_951 nanoseconds. + Weight::from_parts(85_671_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: System Account (r:1 w:1) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn force_unreserve() -> Weight { - Weight::from_ref_time(47_010_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1443` + // Estimated: `2607` + // Minimum execution time: 42_121 nanoseconds. + Weight::from_parts(51_680_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/pallet_bounties.rs b/runtime/common/src/weights/pallet_bounties.rs index 0bf91c127..40f52d934 100644 --- a/runtime/common/src/weights/pallet_bounties.rs +++ b/runtime/common/src/weights/pallet_bounties.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_bounties //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,87 +52,159 @@ use frame_support::{ /// Weight functions for pallet_bounties (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_bounties::weights::WeightInfo for WeightInfo { - // Storage: Bounties BountyCount (r:1 w:1) - // Storage: Bounties BountyDescriptions (r:0 w:1) - // Storage: Bounties Bounties (r:0 w:1) + /// Storage: Bounties BountyCount (r:1 w:1) + /// Proof: Bounties BountyCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Bounties BountyDescriptions (r:0 w:1) + /// Proof: Bounties BountyDescriptions (max_values: None, max_size: Some(8206), added: 10681, mode: MaxEncodedLen) + /// Storage: Bounties Bounties (r:0 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) fn propose_bounty(d: u32) -> Weight { - Weight::from_ref_time(56_491_371) - // Standard Error: 191 - .saturating_add(Weight::from_ref_time(3_355).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `3106` + // Minimum execution time: 39_210 nanoseconds. + Weight::from_parts(49_644_726, 3106) + // Standard Error: 161 + .saturating_add(Weight::from_ref_time(1_981).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } - // Storage: Bounties Bounties (r:1 w:1) - // Storage: Bounties BountyApprovals (r:1 w:1) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) + /// Storage: Bounties BountyApprovals (r:1 w:1) + /// Proof: Bounties BountyApprovals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) fn approve_bounty() -> Weight { - Weight::from_ref_time(29_490_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `229` + // Estimated: `3553` + // Minimum execution time: 21_960 nanoseconds. + Weight::from_parts(22_850_000, 3553) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Bounties Bounties (r:1 w:1) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) fn propose_curator() -> Weight { - Weight::from_ref_time(28_120_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `249` + // Estimated: `2656` + // Minimum execution time: 19_030 nanoseconds. + Weight::from_parts(19_740_000, 2656) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Bounties Bounties (r:1 w:1) - // Storage: System Account (r:2 w:2) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn unassign_curator() -> Weight { - Weight::from_ref_time(90_981_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `641` + // Estimated: `7870` + // Minimum execution time: 61_810 nanoseconds. + Weight::from_parts(69_140_000, 7870) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Bounties Bounties (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn accept_curator() -> Weight { - Weight::from_ref_time(66_590_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `457` + // Estimated: `5263` + // Minimum execution time: 37_390 nanoseconds. + Weight::from_parts(38_860_000, 5263) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Bounties Bounties (r:1 w:1) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) fn award_bounty() -> Weight { - Weight::from_ref_time(51_230_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `289` + // Estimated: `2656` + // Minimum execution time: 29_750 nanoseconds. + Weight::from_parts(30_860_000, 2656) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Bounties Bounties (r:1 w:1) - // Storage: System Account (r:3 w:3) - // Storage: Bounties BountyDescriptions (r:0 w:1) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) + /// Storage: System Account (r:3 w:3) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Bounties BountyDescriptions (r:0 w:1) + /// Proof: Bounties BountyDescriptions (max_values: None, max_size: Some(8206), added: 10681, mode: MaxEncodedLen) fn claim_bounty() -> Weight { - Weight::from_ref_time(146_571_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `674` + // Estimated: `10477` + // Minimum execution time: 108_790 nanoseconds. + Weight::from_parts(121_411_000, 10477) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } - // Storage: Bounties Bounties (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: Bounties BountyDescriptions (r:0 w:1) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Bounties BountyDescriptions (r:0 w:1) + /// Proof: Bounties BountyDescriptions (max_values: None, max_size: Some(8206), added: 10681, mode: MaxEncodedLen) fn close_bounty_proposed() -> Weight { - Weight::from_ref_time(94_620_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `541` + // Estimated: `7870` + // Minimum execution time: 71_620 nanoseconds. + Weight::from_parts(72_570_000, 7870) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } - // Storage: Bounties Bounties (r:1 w:1) - // Storage: System Account (r:3 w:3) - // Storage: Bounties BountyDescriptions (r:0 w:1) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) + /// Storage: System Account (r:3 w:3) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Bounties BountyDescriptions (r:0 w:1) + /// Proof: Bounties BountyDescriptions (max_values: None, max_size: Some(8206), added: 10681, mode: MaxEncodedLen) fn close_bounty_active() -> Weight { - Weight::from_ref_time(110_910_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `818` + // Estimated: `10477` + // Minimum execution time: 81_410 nanoseconds. + Weight::from_parts(91_680_000, 10477) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } - // Storage: Bounties Bounties (r:1 w:1) + /// Storage: Bounties Bounties (r:1 w:1) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) fn extend_bounty_expiry() -> Weight { - Weight::from_ref_time(50_451_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `289` + // Estimated: `2656` + // Minimum execution time: 26_580 nanoseconds. + Weight::from_parts(27_030_000, 2656) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Bounties BountyApprovals (r:1 w:1) - // Storage: Bounties Bounties (r:2 w:2) - // Storage: System Account (r:3 w:3) + /// Storage: Bounties BountyApprovals (r:1 w:1) + /// Proof: Bounties BountyApprovals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) + /// Storage: Bounties Bounties (r:100 w:100) + /// Proof: Bounties Bounties (max_values: None, max_size: Some(181), added: 2656, mode: MaxEncodedLen) + /// Storage: System Account (r:200 w:200) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn spend_funds(b: u32) -> Weight { - Weight::from_ref_time(15_180_000) - // Standard Error: 130_485 - .saturating_add(Weight::from_ref_time(50_076_119).saturating_mul(b.into())) + // Proof Size summary in bytes: + // Measured: `98 + b * (357 ±0)` + // Estimated: `897 + b * (7870 ±0)` + // Minimum execution time: 8_150 nanoseconds. + Weight::from_parts(52_589_666, 897) + // Standard Error: 242_561 + .saturating_add(Weight::from_ref_time(51_967_029).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into()))) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(7870).saturating_mul(b.into())) } } diff --git a/runtime/common/src/weights/pallet_collective.rs b/runtime/common/src/weights/pallet_collective.rs index d979dd8cf..1ef7ab271 100644 --- a/runtime/common/src/weights/pallet_collective.rs +++ b/runtime/common/src/weights/pallet_collective.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_collective //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,124 +52,223 @@ use frame_support::{ /// Weight functions for pallet_collective (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_collective::weights::WeightInfo for WeightInfo { - // Storage: AdvisoryCommittee Members (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:0) - // Storage: AdvisoryCommittee Prime (r:0 w:1) - // Storage: AdvisoryCommittee Voting (r:255 w:255) + /// Storage: AdvisoryCommittee Members (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Proposals (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Voting (r:255 w:255) + /// Proof Skipped: AdvisoryCommittee Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn set_members(m: u32, _n: u32, p: u32) -> Weight { - Weight::from_ref_time(34_440_000) - // Standard Error: 316_829 - .saturating_add(Weight::from_ref_time(23_163_910).saturating_mul(m.into())) - // Standard Error: 124_394 - .saturating_add(Weight::from_ref_time(14_040_837).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `0 + m * (8195 ±0) + p * (3227 ±0)` + // Estimated: `33167 + m * (19751 ±60) + p * (10255 ±23)` + // Minimum execution time: 30_430 nanoseconds. + Weight::from_parts(30_980_000, 33167) + // Standard Error: 332_697 + .saturating_add(Weight::from_ref_time(25_449_256).saturating_mul(m.into())) + // Standard Error: 130_624 + .saturating_add(Weight::from_ref_time(15_889_730).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(19751).saturating_mul(m.into())) + .saturating_add(Weight::from_proof_size(10255).saturating_mul(p.into())) } - // Storage: AdvisoryCommittee Members (r:1 w:0) - fn execute(_b: u32, _m: u32) -> Weight { - Weight::from_ref_time(52_383_265).saturating_add(T::DbWeight::get().reads(1)) + /// Storage: AdvisoryCommittee Members (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + fn execute(b: u32, m: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `100 + m * (32 ±0)` + // Estimated: `596 + m * (32 ±0)` + // Minimum execution time: 29_380 nanoseconds. + Weight::from_parts(32_168_334, 596) + // Standard Error: 176 + .saturating_add(Weight::from_ref_time(4_002).saturating_mul(b.into())) + // Standard Error: 1_816 + .saturating_add(Weight::from_ref_time(36_737).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(Weight::from_proof_size(32).saturating_mul(m.into())) } - // Storage: AdvisoryCommittee Members (r:1 w:0) - // Storage: AdvisoryCommittee ProposalOf (r:1 w:0) + /// Storage: AdvisoryCommittee Members (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee ProposalOf (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) fn propose_execute(b: u32, m: u32) -> Weight { - Weight::from_ref_time(51_062_771) - // Standard Error: 573 - .saturating_add(Weight::from_ref_time(1_921).saturating_mul(b.into())) - // Standard Error: 5_915 - .saturating_add(Weight::from_ref_time(36_487).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `100 + m * (32 ±0)` + // Estimated: `3172 + m * (64 ±0)` + // Minimum execution time: 32_490 nanoseconds. + Weight::from_parts(32_891_978, 3172) + // Standard Error: 606 + .saturating_add(Weight::from_ref_time(5_974).saturating_mul(b.into())) + // Standard Error: 6_249 + .saturating_add(Weight::from_ref_time(100_564).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(Weight::from_proof_size(64).saturating_mul(m.into())) } - // Storage: AdvisoryCommittee Members (r:1 w:0) - // Storage: AdvisoryCommittee ProposalOf (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:1) - // Storage: AdvisoryCommittee ProposalCount (r:1 w:1) - // Storage: AdvisoryCommittee Voting (r:0 w:1) + /// Storage: AdvisoryCommittee Members (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee ProposalOf (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Proposals (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee ProposalCount (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee ProposalCount (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Voting (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Voting (max_values: None, max_size: None, mode: Measured) fn propose_proposed(b: u32, m: u32, p: u32) -> Weight { - Weight::from_ref_time(36_154_514) - // Standard Error: 1_745 - .saturating_add(Weight::from_ref_time(20_413).saturating_mul(b.into())) - // Standard Error: 18_217 - .saturating_add(Weight::from_ref_time(126_504).saturating_mul(m.into())) - // Standard Error: 7_013 - .saturating_add(Weight::from_ref_time(329_220).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + // Proof Size summary in bytes: + // Measured: `565 + m * (32 ±0) + p * (33 ±0)` + // Estimated: `6570 + m * (160 ±0) + p * (170 ±0)` + // Minimum execution time: 46_210 nanoseconds. + Weight::from_parts(43_886_366, 6570) + // Standard Error: 751 + .saturating_add(Weight::from_ref_time(11_946).saturating_mul(b.into())) + // Standard Error: 7_842 + .saturating_add(Weight::from_ref_time(27_670).saturating_mul(m.into())) + // Standard Error: 3_019 + .saturating_add(Weight::from_ref_time(220_177).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_proof_size(160).saturating_mul(m.into())) + .saturating_add(Weight::from_proof_size(170).saturating_mul(p.into())) } - // Storage: AdvisoryCommittee Members (r:1 w:0) - // Storage: AdvisoryCommittee Voting (r:1 w:1) + /// Storage: AdvisoryCommittee Members (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Voting (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Voting (max_values: None, max_size: None, mode: Measured) fn vote(m: u32) -> Weight { - Weight::from_ref_time(93_521_939) - // Standard Error: 19_552 - .saturating_add(Weight::from_ref_time(125_381).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1240 + m * (64 ±0)` + // Estimated: `5448 + m * (128 ±0)` + // Minimum execution time: 42_820 nanoseconds. + Weight::from_parts(57_247_570, 5448) + // Standard Error: 5_586 + .saturating_add(Weight::from_ref_time(90_933).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(128).saturating_mul(m.into())) } - // Storage: AdvisoryCommittee Voting (r:1 w:1) - // Storage: AdvisoryCommittee Members (r:1 w:0) - // Storage: AdvisoryCommittee Proposals (r:1 w:1) - // Storage: AdvisoryCommittee ProposalOf (r:0 w:1) - fn close_early_disapproved(_m: u32, p: u32) -> Weight { - Weight::from_ref_time(93_839_100) - // Standard Error: 7_819 - .saturating_add(Weight::from_ref_time(265_745).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + /// Storage: AdvisoryCommittee Voting (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Members (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Proposals (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee ProposalOf (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) + fn close_early_disapproved(m: u32, p: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `683 + m * (64 ±0) + p * (33 ±0)` + // Estimated: `6017 + m * (260 ±0) + p * (136 ±0)` + // Minimum execution time: 42_010 nanoseconds. + Weight::from_parts(41_739_149, 6017) + // Standard Error: 8_825 + .saturating_add(Weight::from_ref_time(133_832).saturating_mul(m.into())) + // Standard Error: 3_354 + .saturating_add(Weight::from_ref_time(213_771).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(260).saturating_mul(m.into())) + .saturating_add(Weight::from_proof_size(136).saturating_mul(p.into())) } - // Storage: AdvisoryCommittee Voting (r:1 w:1) - // Storage: AdvisoryCommittee Members (r:1 w:0) - // Storage: AdvisoryCommittee ProposalOf (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:1) + /// Storage: AdvisoryCommittee Voting (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Members (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee ProposalOf (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Proposals (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) fn close_early_approved(b: u32, m: u32, p: u32) -> Weight { - Weight::from_ref_time(73_194_294) - // Standard Error: 2_028 - .saturating_add(Weight::from_ref_time(14_757).saturating_mul(b.into())) - // Standard Error: 21_436 - .saturating_add(Weight::from_ref_time(23_359).saturating_mul(m.into())) - // Standard Error: 8_147 - .saturating_add(Weight::from_ref_time(347_959).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `926 + b * (1 ±0) + m * (64 ±0) + p * (36 ±0)` + // Estimated: `9916 + b * (4 ±0) + m * (248 ±0) + p * (144 ±0)` + // Minimum execution time: 57_630 nanoseconds. + Weight::from_parts(71_246_911, 9916) + // Standard Error: 914 + .saturating_add(Weight::from_ref_time(10_364).saturating_mul(b.into())) + // Standard Error: 9_666 + .saturating_add(Weight::from_ref_time(28_754).saturating_mul(m.into())) + // Standard Error: 3_674 + .saturating_add(Weight::from_ref_time(240_907).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(4).saturating_mul(b.into())) + .saturating_add(Weight::from_proof_size(248).saturating_mul(m.into())) + .saturating_add(Weight::from_proof_size(144).saturating_mul(p.into())) } - // Storage: AdvisoryCommittee Voting (r:1 w:1) - // Storage: AdvisoryCommittee Members (r:1 w:0) - // Storage: AdvisoryCommittee Prime (r:1 w:0) - // Storage: AdvisoryCommittee Proposals (r:1 w:1) - // Storage: AdvisoryCommittee ProposalOf (r:0 w:1) + /// Storage: AdvisoryCommittee Voting (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Members (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Prime (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Proposals (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee ProposalOf (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) fn close_disapproved(m: u32, p: u32) -> Weight { - Weight::from_ref_time(57_401_274) - // Standard Error: 18_844 - .saturating_add(Weight::from_ref_time(130_583).saturating_mul(m.into())) - // Standard Error: 7_162 - .saturating_add(Weight::from_ref_time(307_554).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `703 + m * (64 ±0) + p * (33 ±0)` + // Estimated: `7250 + m * (325 ±0) + p * (170 ±0)` + // Minimum execution time: 47_540 nanoseconds. + Weight::from_parts(58_061_738, 7250) + // Standard Error: 9_360 + .saturating_add(Weight::from_ref_time(30_766).saturating_mul(m.into())) + // Standard Error: 3_557 + .saturating_add(Weight::from_ref_time(204_081).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(325).saturating_mul(m.into())) + .saturating_add(Weight::from_proof_size(170).saturating_mul(p.into())) } - // Storage: AdvisoryCommittee Voting (r:1 w:1) - // Storage: AdvisoryCommittee Members (r:1 w:0) - // Storage: AdvisoryCommittee Prime (r:1 w:0) - // Storage: AdvisoryCommittee ProposalOf (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:1) + /// Storage: AdvisoryCommittee Voting (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Members (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Prime (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee ProposalOf (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Proposals (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) fn close_approved(b: u32, m: u32, p: u32) -> Weight { - Weight::from_ref_time(60_881_034) - // Standard Error: 1_983 - .saturating_add(Weight::from_ref_time(12_789).saturating_mul(b.into())) - // Standard Error: 20_967 - .saturating_add(Weight::from_ref_time(128_737).saturating_mul(m.into())) - // Standard Error: 7_969 - .saturating_add(Weight::from_ref_time(380_829).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `946 + b * (1 ±0) + m * (64 ±0) + p * (36 ±0)` + // Estimated: `11505 + b * (5 ±0) + m * (310 ±0) + p * (180 ±0)` + // Minimum execution time: 69_630 nanoseconds. + Weight::from_parts(75_042_860, 11505) + // Standard Error: 818 + .saturating_add(Weight::from_ref_time(9_063).saturating_mul(b.into())) + // Standard Error: 8_654 + .saturating_add(Weight::from_ref_time(37_972).saturating_mul(m.into())) + // Standard Error: 3_289 + .saturating_add(Weight::from_ref_time(253_280).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(5).saturating_mul(b.into())) + .saturating_add(Weight::from_proof_size(310).saturating_mul(m.into())) + .saturating_add(Weight::from_proof_size(180).saturating_mul(p.into())) } - // Storage: AdvisoryCommittee Proposals (r:1 w:1) - // Storage: AdvisoryCommittee Voting (r:0 w:1) - // Storage: AdvisoryCommittee ProposalOf (r:0 w:1) + /// Storage: AdvisoryCommittee Proposals (r:1 w:1) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Voting (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee ProposalOf (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee ProposalOf (max_values: None, max_size: None, mode: Measured) fn disapprove_proposal(p: u32) -> Weight { - Weight::from_ref_time(48_045_535) - // Standard Error: 5_998 - .saturating_add(Weight::from_ref_time(254_464).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `258 + p * (32 ±0)` + // Estimated: `1266 + p * (96 ±0)` + // Minimum execution time: 27_850 nanoseconds. + Weight::from_parts(34_667_615, 1266) + // Standard Error: 3_964 + .saturating_add(Weight::from_ref_time(173_407).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(96).saturating_mul(p.into())) } } diff --git a/runtime/common/src/weights/pallet_contracts.rs b/runtime/common/src/weights/pallet_contracts.rs index 6c1b92a3c..d4c994ebc 100644 --- a/runtime/common/src/weights/pallet_contracts.rs +++ b/runtime/common/src/weights/pallet_contracts.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,1037 +52,1763 @@ 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) + /// Storage: Contracts DeletionQueue (r:1 w:0) + /// Proof: Contracts DeletionQueue (max_values: Some(1), max_size: Some(16642), added: 17137, mode: Ignored) fn on_process_deletion_queue_batch() -> Weight { - Weight::from_ref_time(7_240_000).saturating_add(T::DbWeight::get().reads(1)) - } - // Storage: Skipped Metadata (r:0 w:0) + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `0` + // Minimum execution time: 7_340 nanoseconds. + Weight::from_ref_time(7_910_000).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) fn on_initialize_per_trie_key(k: u32) -> Weight { - Weight::from_ref_time(7_272_510) - // Standard Error: 11_386 - .saturating_add(Weight::from_ref_time(1_931_876).saturating_mul(k.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) - } - // Storage: Contracts DeletionQueue (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `414 + k * (69 ±0)` + // Estimated: `0` + // Minimum execution time: 18_190 nanoseconds. + Weight::from_ref_time(1_690_272) + // Standard Error: 8_316 + .saturating_add(Weight::from_ref_time(1_923_221).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Contracts DeletionQueue (r:1 w:1) + /// Proof: Contracts DeletionQueue (max_values: Some(1), max_size: Some(16642), added: 17137, mode: Ignored) fn on_initialize_per_queue_item(q: u32) -> Weight { - Weight::from_ref_time(24_038_948) - // Standard Error: 20_497 - .saturating_add(Weight::from_ref_time(2_241_218).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) - // Storage: Contracts CodeStorage (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `214 + q * (33 ±0)` + // Estimated: `0` + // Minimum execution time: 6_350 nanoseconds. + Weight::from_ref_time(24_970_915) + // Standard Error: 16_486 + .saturating_add(Weight::from_ref_time(2_264_517).saturating_mul(q.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// 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) fn reinstrument(c: u32) -> Weight { - Weight::from_ref_time(98_902_788) - // Standard Error: 471 - .saturating_add(Weight::from_ref_time(101_231).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) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System Account (r:1 w:1) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `203 + c * (1 ±0)` + // Estimated: `0` + // Minimum execution time: 59_620 nanoseconds. + Weight::from_ref_time(55_067_915) + // Standard Error: 350 + .saturating_add(Weight::from_ref_time(111_042).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// 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) fn call_with_code_per_byte(c: u32) -> Weight { - Weight::from_ref_time(543_539_689) - // Standard Error: 221 - .saturating_add(Weight::from_ref_time(59_253).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) - // Storage: Contracts Nonce (r:1 w:1) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System Account (r:1 w:1) - // Storage: System EventTopics (r:3 w:3) - // Storage: Contracts PristineCode (r:0 w:1) - // Storage: Contracts OwnerInfoOf (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `675` + // Estimated: `0` + // Minimum execution time: 450_952 nanoseconds. + Weight::from_ref_time(619_179_647) + // Standard Error: 198 + .saturating_add(Weight::from_ref_time(70_522).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// 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) fn instantiate_with_code(c: u32, i: u32, s: u32) -> Weight { - Weight::from_ref_time(826_646_699) - // Standard Error: 837 - .saturating_add(Weight::from_ref_time(193_762).saturating_mul(c.into())) - // Standard Error: 98 - .saturating_add(Weight::from_ref_time(2_744).saturating_mul(i.into())) - // Standard Error: 98 - .saturating_add(Weight::from_ref_time(3_091).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) - // Storage: Contracts Nonce (r:1 w:1) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System Account (r:1 w:1) - // Storage: Contracts OwnerInfoOf (r:1 w:1) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `157` + // Estimated: `0` + // Minimum execution time: 7_124_782 nanoseconds. + Weight::from_ref_time(642_462_467) + // Standard Error: 767 + .saturating_add(Weight::from_ref_time(209_837).saturating_mul(c.into())) + // Standard Error: 45 + .saturating_add(Weight::from_ref_time(3_095).saturating_mul(i.into())) + // Standard Error: 45 + .saturating_add(Weight::from_ref_time(3_370).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(9_u64)) + } + /// 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) fn instantiate(i: u32, s: u32) -> Weight { - Weight::from_ref_time(512_301_189) - // Standard Error: 51 - .saturating_add(Weight::from_ref_time(2_113).saturating_mul(i.into())) - // Standard Error: 51 - .saturating_add(Weight::from_ref_time(3_108).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) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System Account (r:1 w:1) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `433` + // Estimated: `0` + // Minimum execution time: 2_953_489 nanoseconds. + Weight::from_ref_time(983_538_643) + // Standard Error: 44 + .saturating_add(Weight::from_ref_time(2_071).saturating_mul(i.into())) + // Standard Error: 44 + .saturating_add(Weight::from_ref_time(3_066).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// 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) fn call() -> Weight { - Weight::from_ref_time(295_691_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: Contracts CodeStorage (r:1 w:1) - // Storage: System EventTopics (r:1 w:1) - // Storage: Contracts PristineCode (r:0 w:1) - // Storage: Contracts OwnerInfoOf (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `727` + // Estimated: `0` + // Minimum execution time: 255_261 nanoseconds. + Weight::from_ref_time(280_541_000) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// 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) fn upload_code(c: u32) -> Weight { - Weight::from_ref_time(404_527_904) - // Standard Error: 709 - .saturating_add(Weight::from_ref_time(194_403).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) - // Storage: System EventTopics (r:1 w:1) - // Storage: Contracts CodeStorage (r:0 w:1) - // Storage: Contracts PristineCode (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `0` + // Minimum execution time: 415_211 nanoseconds. + Weight::from_ref_time(584_100_483) + // Standard Error: 865 + .saturating_add(Weight::from_ref_time(210_362).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// 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) fn remove_code() -> Weight { - Weight::from_ref_time(78_150_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts OwnerInfoOf (r:2 w:2) - // Storage: System EventTopics (r:3 w:3) + // Proof Size summary in bytes: + // Measured: `218` + // Estimated: `0` + // Minimum execution time: 40_660 nanoseconds. + Weight::from_ref_time(49_831_000) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// 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) fn set_code() -> Weight { - Weight::from_ref_time(80_990_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(6)) - } - // Storage: System Account (r:1 w:0) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `567` + // Estimated: `0` + // Minimum execution time: 43_560 nanoseconds. + Weight::from_ref_time(57_710_000) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// 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) fn seal_caller(r: u32) -> Weight { - Weight::from_ref_time(524_650_021) - // Standard Error: 494_101 - .saturating_add(Weight::from_ref_time(35_328_179).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `697 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 414_591 nanoseconds. + Weight::from_ref_time(507_051_177) + // Standard Error: 460_256 + .saturating_add(Weight::from_ref_time(41_906_034).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_is_contract(r: u32) -> Weight { - Weight::from_ref_time(286_854_172) - // Standard Error: 2_585_390 - .saturating_add(Weight::from_ref_time(423_104_124).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `749 + r * (19218 ±0)` + // Estimated: `0` + // Minimum execution time: 376_421 nanoseconds. + Weight::from_ref_time(273_419_458) + // Standard Error: 1_839_158 + .saturating_add(Weight::from_ref_time(500_620_682).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_code_hash(r: u32) -> Weight { - Weight::from_ref_time(336_760_438) - // Standard Error: 2_439_257 - .saturating_add(Weight::from_ref_time(515_802_575).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `741 + r * (19539 ±0)` + // Estimated: `0` + // Minimum execution time: 422_661 nanoseconds. + Weight::from_ref_time(297_306_353) + // Standard Error: 1_486_114 + .saturating_add(Weight::from_ref_time(594_612_175).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_own_code_hash(r: u32) -> Weight { - Weight::from_ref_time(528_911_079) - // Standard Error: 710_933 - .saturating_add(Weight::from_ref_time(44_397_609).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `704 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 383_971 nanoseconds. + Weight::from_ref_time(538_086_750) + // Standard Error: 482_564 + .saturating_add(Weight::from_ref_time(47_799_438).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_caller_is_origin(r: u32) -> Weight { - Weight::from_ref_time(521_417_446) - // Standard Error: 373_059 - .saturating_add(Weight::from_ref_time(19_335_916).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `694 + r * (240 ±0)` + // Estimated: `0` + // Minimum execution time: 392_191 nanoseconds. + Weight::from_ref_time(529_148_073) + // Standard Error: 401_482 + .saturating_add(Weight::from_ref_time(22_240_096).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_address(r: u32) -> Weight { - Weight::from_ref_time(537_384_850) - // Standard Error: 669_029 - .saturating_add(Weight::from_ref_time(37_720_265).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `698 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 430_521 nanoseconds. + Weight::from_ref_time(526_870_260) + // Standard Error: 549_166 + .saturating_add(Weight::from_ref_time(40_844_571).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_gas_left(r: u32) -> Weight { - Weight::from_ref_time(517_476_334) - // Standard Error: 517_971 - .saturating_add(Weight::from_ref_time(37_542_386).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `699 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 416_131 nanoseconds. + Weight::from_ref_time(488_659_078) + // Standard Error: 450_850 + .saturating_add(Weight::from_ref_time(43_862_203).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_balance(r: u32) -> Weight { - Weight::from_ref_time(550_753_388) - // Standard Error: 1_213_707 - .saturating_add(Weight::from_ref_time(180_902_166).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `873 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 448_991 nanoseconds. + Weight::from_ref_time(562_721_723) + // Standard Error: 1_530_629 + .saturating_add(Weight::from_ref_time(191_699_924).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_value_transferred(r: u32) -> Weight { - Weight::from_ref_time(514_302_216) - // Standard Error: 537_310 - .saturating_add(Weight::from_ref_time(37_746_961).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `708 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 371_431 nanoseconds. + Weight::from_ref_time(508_541_681) + // Standard Error: 441_247 + .saturating_add(Weight::from_ref_time(40_677_699).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_minimum_balance(r: u32) -> Weight { - Weight::from_ref_time(502_656_162) - // Standard Error: 503_558 - .saturating_add(Weight::from_ref_time(36_870_643).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `706 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 403_231 nanoseconds. + Weight::from_ref_time(533_640_067) + // Standard Error: 420_220 + .saturating_add(Weight::from_ref_time(39_968_958).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_block_number(r: u32) -> Weight { - Weight::from_ref_time(504_211_939) - // Standard Error: 537_723 - .saturating_add(Weight::from_ref_time(37_028_461).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `703 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 377_331 nanoseconds. + Weight::from_ref_time(517_541_129) + // Standard Error: 660_097 + .saturating_add(Weight::from_ref_time(41_963_235).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_now(r: u32) -> Weight { - Weight::from_ref_time(482_198_123) - // Standard Error: 466_842 - .saturating_add(Weight::from_ref_time(39_075_306).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) - // Storage: TransactionPayment NextFeeMultiplier (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `694 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 404_841 nanoseconds. + Weight::from_ref_time(492_606_951) + // Standard Error: 786_255 + .saturating_add(Weight::from_ref_time(44_988_691).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_weight_to_fee(r: u32) -> Weight { - Weight::from_ref_time(535_165_542) - // Standard Error: 1_354_661 - .saturating_add(Weight::from_ref_time(165_315_070).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `809 + r * (800 ±0)` + // Estimated: `0` + // Minimum execution time: 375_391 nanoseconds. + Weight::from_ref_time(486_909_222) + // Standard Error: 1_108_385 + .saturating_add(Weight::from_ref_time(183_182_667).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_gas(r: u32) -> Weight { - Weight::from_ref_time(247_072_360) - // Standard Error: 270_116 - .saturating_add(Weight::from_ref_time(20_185_060).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `661 + r * (320 ±0)` + // Estimated: `0` + // Minimum execution time: 195_821 nanoseconds. + Weight::from_ref_time(255_706_203) + // Standard Error: 152_429 + .saturating_add(Weight::from_ref_time(19_140_207).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_input(r: u32) -> Weight { - Weight::from_ref_time(473_801_389) - // Standard Error: 743_301 - .saturating_add(Weight::from_ref_time(37_449_010).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `696 + r * (480 ±0)` + // Estimated: `0` + // Minimum execution time: 432_501 nanoseconds. + Weight::from_ref_time(531_441_407) + // Standard Error: 449_978 + .saturating_add(Weight::from_ref_time(35_106_965).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_input_per_kb(n: u32) -> Weight { - Weight::from_ref_time(550_641_898) - // Standard Error: 187_094 - .saturating_add(Weight::from_ref_time(17_119_143).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) - fn seal_return(r: u32) -> Weight { - Weight::from_ref_time(492_073_724) - // Standard Error: 9_689_878 - .saturating_add(Weight::from_ref_time(50_969_675).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `1176` + // Estimated: `0` + // Minimum execution time: 413_421 nanoseconds. + Weight::from_ref_time(610_244_754) + // Standard Error: 166_402 + .saturating_add(Weight::from_ref_time(18_626_327).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) + fn seal_return(_r: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `684 + r * (8 ±0)` + // Estimated: `0` + // Minimum execution time: 371_171 nanoseconds. + Weight::from_ref_time(492_065_900) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_return_per_kb(n: u32) -> Weight { - Weight::from_ref_time(491_791_969) - // Standard Error: 14_426 - .saturating_add(Weight::from_ref_time(369_344).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) - // Storage: Contracts DeletionQueue (r:1 w:1) - // Storage: Contracts OwnerInfoOf (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `694` + // Estimated: `0` + // Minimum execution time: 384_511 nanoseconds. + Weight::from_ref_time(533_468_127) + // Standard Error: 13_902 + .saturating_add(Weight::from_ref_time(343_428).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_terminate(r: u32) -> Weight { - Weight::from_ref_time(509_575_083) - // Standard Error: 10_877_755 - .saturating_add(Weight::from_ref_time(13_812_416).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `726 + r * (285 ±0)` + // Estimated: `0` + // Minimum execution time: 371_511 nanoseconds. + Weight::from_ref_time(498_260_832) + // Standard Error: 10_611_365 + .saturating_add(Weight::from_ref_time(83_054_067).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) - // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_random(r: u32) -> Weight { - Weight::from_ref_time(584_357_455) - // Standard Error: 1_086_503 - .saturating_add(Weight::from_ref_time(211_881_743).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `775 + r * (800 ±0)` + // Estimated: `0` + // Minimum execution time: 400_002 nanoseconds. + Weight::from_ref_time(535_795_374) + // Standard Error: 433_802 + .saturating_add(Weight::from_ref_time(228_011_294).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_deposit_event(r: u32) -> Weight { - Weight::from_ref_time(536_470_048) - // Standard Error: 1_619_087 - .saturating_add(Weight::from_ref_time(408_202_800).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `694 + r * (800 ±0)` + // Estimated: `0` + // Minimum execution time: 380_131 nanoseconds. + Weight::from_ref_time(534_904_075) + // Standard Error: 1_278_761 + .saturating_add(Weight::from_ref_time(431_858_210).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_deposit_event_per_topic_and_kb(t: u32, n: u32) -> Weight { - Weight::from_ref_time(1_012_493_663) - // Standard Error: 4_467_981 - .saturating_add(Weight::from_ref_time(305_733_165).saturating_mul(t.into())) - // Standard Error: 1_227_123 - .saturating_add(Weight::from_ref_time(107_863_369).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `1630 + t * (2608 ±0) + n * (8 ±0)` + // Estimated: `0` + // Minimum execution time: 1_883_206 nanoseconds. + Weight::from_ref_time(848_572_505) + // Standard Error: 4_317_642 + .saturating_add(Weight::from_ref_time(364_117_215).saturating_mul(t.into())) + // Standard Error: 1_185_833 + .saturating_add(Weight::from_ref_time(128_033_226).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_debug_message(r: u32) -> Weight { - Weight::from_ref_time(310_425_575) - // Standard Error: 350_059 - .saturating_add(Weight::from_ref_time(30_466_452).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 Size summary in bytes: + // Measured: `693 + r * (800 ±0)` + // Estimated: `0` + // Minimum execution time: 211_820 nanoseconds. + Weight::from_ref_time(277_368_948) + // Standard Error: 381_276 + .saturating_add(Weight::from_ref_time(31_127_095).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_set_storage(r: u32) -> Weight { - Weight::from_ref_time(332_284_799) - // Standard Error: 3_921_028 - .saturating_add(Weight::from_ref_time(804_952_629).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `720 + r * (23420 ±0)` + // Estimated: `0` + // Minimum execution time: 378_292 nanoseconds. + Weight::from_ref_time(340_567_907) + // Standard Error: 3_537_344 + .saturating_add(Weight::from_ref_time(894_095_021).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_set_storage_per_new_kb(n: u32) -> Weight { - Weight::from_ref_time(1_054_846_155) - // Standard Error: 3_062_193 - .saturating_add(Weight::from_ref_time(174_014_042).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(52)) + // Proof Size summary in bytes: + // Measured: `12402 + n * (12006 ±0)` + // Estimated: `0` + // Minimum execution time: 615_232 nanoseconds. + Weight::from_ref_time(1_132_334_359) + // Standard Error: 3_371_637 + .saturating_add(Weight::from_ref_time(192_392_508).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(52_u64)) .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()))) + .saturating_add(T::DbWeight::get().writes(50_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_set_storage_per_old_kb(n: u32) -> Weight { - Weight::from_ref_time(1_010_228_458) - // Standard Error: 2_470_909 - .saturating_add(Weight::from_ref_time(138_538_184).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) + // Proof Size summary in bytes: + // Measured: `14990 + n * (175775 ±0)` + // Estimated: `0` + // Minimum execution time: 612_791 nanoseconds. + Weight::from_ref_time(1_134_662_807) + // Standard Error: 3_339_503 + .saturating_add(Weight::from_ref_time(119_878_257).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(51_u64)) .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()))) + .saturating_add(T::DbWeight::get().writes(49_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_clear_storage(r: u32) -> Weight { - Weight::from_ref_time(380_520_980) - // Standard Error: 3_909_300 - .saturating_add(Weight::from_ref_time(817_235_280).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `720 + r * (23100 ±0)` + // Estimated: `0` + // Minimum execution time: 383_941 nanoseconds. + Weight::from_ref_time(384_785_896) + // Standard Error: 3_259_278 + .saturating_add(Weight::from_ref_time(882_833_445).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_clear_storage_per_kb(n: u32) -> Weight { - Weight::from_ref_time(970_473_148) - // Standard Error: 2_890_250 - .saturating_add(Weight::from_ref_time(136_422_909).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) + // Proof Size summary in bytes: + // Measured: `14670 + n * (175775 ±0)` + // Estimated: `0` + // Minimum execution time: 562_292 nanoseconds. + Weight::from_ref_time(1_071_010_060) + // Standard Error: 3_182_125 + .saturating_add(Weight::from_ref_time(133_153_202).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(51_u64)) .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()))) + .saturating_add(T::DbWeight::get().writes(48_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_get_storage(r: u32) -> Weight { - Weight::from_ref_time(378_748_991) - // Standard Error: 2_923_997 - .saturating_add(Weight::from_ref_time(644_891_105).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `730 + r * (23740 ±0)` + // Estimated: `0` + // Minimum execution time: 383_241 nanoseconds. + Weight::from_ref_time(481_925_522) + // Standard Error: 2_078_469 + .saturating_add(Weight::from_ref_time(709_828_695).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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(3_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_get_storage_per_kb(n: u32) -> Weight { - Weight::from_ref_time(922_100_323) - // Standard Error: 3_042_669 - .saturating_add(Weight::from_ref_time(301_712_263).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) + // Proof Size summary in bytes: + // Measured: `15321 + n * (175775 ±0)` + // Estimated: `0` + // Minimum execution time: 526_282 nanoseconds. + Weight::from_ref_time(999_063_905) + // Standard Error: 3_021_133 + .saturating_add(Weight::from_ref_time(304_419_076).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(51_u64)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_contains_storage(r: u32) -> Weight { - Weight::from_ref_time(351_930_453) - // Standard Error: 3_420_347 - .saturating_add(Weight::from_ref_time(635_280_961).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `723 + r * (23100 ±0)` + // Estimated: `0` + // Minimum execution time: 378_371 nanoseconds. + Weight::from_ref_time(407_046_779) + // Standard Error: 2_152_108 + .saturating_add(Weight::from_ref_time(696_120_070).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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(3_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_contains_storage_per_kb(n: u32) -> Weight { - Weight::from_ref_time(848_856_926) - // Standard Error: 2_437_767 - .saturating_add(Weight::from_ref_time(131_258_052).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) + // Proof Size summary in bytes: + // Measured: `14673 + n * (175775 ±0)` + // Estimated: `0` + // Minimum execution time: 511_481 nanoseconds. + Weight::from_ref_time(957_749_360) + // Standard Error: 2_867_843 + .saturating_add(Weight::from_ref_time(121_100_740).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(51_u64)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_take_storage(r: u32) -> Weight { - Weight::from_ref_time(403_719_260) - // Standard Error: 3_386_460 - .saturating_add(Weight::from_ref_time(804_246_540).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `731 + r * (23740 ±0)` + // Estimated: `0` + // Minimum execution time: 455_411 nanoseconds. + Weight::from_ref_time(396_634_391) + // Standard Error: 2_834_278 + .saturating_add(Weight::from_ref_time(907_613_363).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Skipped Metadata (r:0 w:0) + /// Storage: Skipped Metadata (r:0 w:0) + /// Proof Skipped: Skipped Metadata (max_values: None, max_size: None, mode: Ignored) fn seal_take_storage_per_kb(n: u32) -> Weight { - Weight::from_ref_time(987_006_327) - // Standard Error: 3_355_175 - .saturating_add(Weight::from_ref_time(316_360_393).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(51)) + // Proof Size summary in bytes: + // Measured: `15322 + n * (175775 ±0)` + // Estimated: `0` + // Minimum execution time: 556_981 nanoseconds. + Weight::from_ref_time(1_092_296_100) + // Standard Error: 3_765_245 + .saturating_add(Weight::from_ref_time(319_955_976).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(51_u64)) .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:1 w:0) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + .saturating_add(T::DbWeight::get().writes(48_u64)) + } + /// 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) fn seal_transfer(r: u32) -> Weight { - Weight::from_ref_time(387_124_429) - // Standard Error: 5_436_860 - .saturating_add(Weight::from_ref_time(2_410_066_033).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) + // Proof Size summary in bytes: + // Measured: `1322 + r * (3601 ±0)` + // Estimated: `0` + // Minimum execution time: 378_041 nanoseconds. + Weight::from_ref_time(352_172_140) + // Standard Error: 3_697_576 + .saturating_add(Weight::from_ref_time(2_631_062_607).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) .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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// 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) fn seal_call(r: u32) -> Weight { - Weight::from_ref_time(412_832_000) - // Standard Error: 31_066_972 - .saturating_add(Weight::from_ref_time(34_742_483_512).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) + // Proof Size summary in bytes: + // Measured: `948 + r * (20495 ±0)` + // Estimated: `0` + // Minimum execution time: 458_601 nanoseconds. + Weight::from_ref_time(490_401_000) + // Standard Error: 30_563_693 + .saturating_add(Weight::from_ref_time(37_755_820_145).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) .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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_delegate_call(r: u32) -> Weight { - Weight::from_ref_time(478_601_000) - // Standard Error: 32_505_904 - .saturating_add(Weight::from_ref_time(34_270_355_505).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `0 + r * (71670 ±0)` + // Estimated: `0` + // Minimum execution time: 438_561 nanoseconds. + Weight::from_ref_time(531_402_000) + // Standard Error: 31_362_051 + .saturating_add(Weight::from_ref_time(37_080_198_263).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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:1 w:0) - // Storage: Contracts ContractInfoOf (r:81 w:81) - // Storage: Contracts CodeStorage (r:2 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:82 w:82) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_call_per_transfer_clone_kb(t: u32, c: u32) -> Weight { - Weight::from_ref_time(15_958_991_560) - // Standard Error: 112_443_411 - .saturating_add(Weight::from_ref_time(3_094_762_846).saturating_mul(t.into())) - // Standard Error: 168_602 - .saturating_add(Weight::from_ref_time(18_427_737).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(167)) + // Proof Size summary in bytes: + // Measured: `21128 + t * (15897 ±0)` + // Estimated: `0` + // Minimum execution time: 18_495_409 nanoseconds. + Weight::from_ref_time(16_632_793_094) + // Standard Error: 126_008_691 + .saturating_add(Weight::from_ref_time(3_202_223_200).saturating_mul(t.into())) + // Standard Error: 188_943 + .saturating_add(Weight::from_ref_time(19_391_282).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(167_u64)) .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:1 w:0) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) - // Storage: Contracts Nonce (r:1 w:1) - // Storage: Contracts OwnerInfoOf (r:80 w:80) + .saturating_add(T::DbWeight::get().writes(163_u64)) + } + /// 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) fn seal_instantiate(r: u32) -> Weight { - Weight::from_ref_time(481_351_000) - // Standard Error: 65_768_047 - .saturating_add(Weight::from_ref_time(45_721_336_046).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(8)) + // Proof Size summary in bytes: + // Measured: `1512 + r * (25573 ±0)` + // Estimated: `0` + // Minimum execution time: 384_252 nanoseconds. + Weight::from_ref_time(466_982_000) + // Standard Error: 66_870_986 + .saturating_add(Weight::from_ref_time(48_895_356_612).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) .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:81 w:81) - // Storage: Contracts ContractInfoOf (r:81 w:81) - // Storage: Contracts CodeStorage (r:2 w:1) - // Storage: Timestamp Now (r:1 w:0) - // Storage: Contracts Nonce (r:1 w:1) - // Storage: Contracts OwnerInfoOf (r:1 w:1) - // Storage: System EventTopics (r:82 w:82) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// 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) fn seal_instantiate_per_transfer_input_salt_kb(t: u32, i: u32, s: u32) -> Weight { - Weight::from_ref_time(202_589_751_000) - // Standard Error: 1_552_239 - .saturating_add(Weight::from_ref_time(119_317_380).saturating_mul(i.into())) - // Standard Error: 1_552_239 - .saturating_add(Weight::from_ref_time(115_833_964).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(249)) + // Proof Size summary in bytes: + // Measured: `5505 + t * (68 ±0)` + // Estimated: `0` + // Minimum execution time: 215_042_744 nanoseconds. + Weight::from_ref_time(38_184_950_902) + // Standard Error: 991_352 + .saturating_add(Weight::from_ref_time(217_952_334).saturating_mul(i.into())) + // Standard Error: 991_352 + .saturating_add(Weight::from_ref_time(216_436_919).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(249_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((1_u64).saturating_mul(t.into()))) - } - // Storage: System Account (r:1 w:0) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + .saturating_add(T::DbWeight::get().writes(247_u64)) + } + /// 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) fn seal_hash_sha2_256(r: u32) -> Weight { - Weight::from_ref_time(495_973_918) - // Standard Error: 8_530_509 - .saturating_add(Weight::from_ref_time(25_019_781).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `691 + r * (642 ±0)` + // Estimated: `0` + // Minimum execution time: 371_791 nanoseconds. + Weight::from_ref_time(476_522_136) + // Standard Error: 9_557_681 + .saturating_add(Weight::from_ref_time(18_119_263).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_hash_sha2_256_per_kb(n: u32) -> Weight { - Weight::from_ref_time(377_657_964) - // Standard Error: 242_553 - .saturating_add(Weight::from_ref_time(86_484_558).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `1493` + // Estimated: `0` + // Minimum execution time: 420_702 nanoseconds. + Weight::from_ref_time(496_211_000) + // Standard Error: 84_684 + .saturating_add(Weight::from_ref_time(89_350_132).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_hash_keccak_256(r: u32) -> Weight { - Weight::from_ref_time(495_349_616) - // Standard Error: 8_119_882 - .saturating_add(Weight::from_ref_time(94_785_183).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `693 + r * (642 ±0)` + // Estimated: `0` + // Minimum execution time: 371_382 nanoseconds. + Weight::from_ref_time(463_810_691) + // Standard Error: 8_376_917 + .saturating_add(Weight::from_ref_time(158_368_308).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_hash_keccak_256_per_kb(n: u32) -> Weight { - Weight::from_ref_time(526_361_042) - // Standard Error: 710_369 - .saturating_add(Weight::from_ref_time(364_405_193).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `1495` + // Estimated: `0` + // Minimum execution time: 455_871 nanoseconds. + Weight::from_ref_time(456_625_973) + // Standard Error: 736_099 + .saturating_add(Weight::from_ref_time(364_001_272).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_hash_blake2_256(r: u32) -> Weight { - Weight::from_ref_time(507_899_340) - // Standard Error: 10_823_074 - .saturating_add(Weight::from_ref_time(88_578_359).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `693 + r * (642 ±0)` + // Estimated: `0` + // Minimum execution time: 369_931 nanoseconds. + Weight::from_ref_time(480_784_981) + // Standard Error: 10_397_523 + .saturating_add(Weight::from_ref_time(56_170_718).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_hash_blake2_256_per_kb(n: u32) -> Weight { - Weight::from_ref_time(551_302_000) - // Standard Error: 230_749 - .saturating_add(Weight::from_ref_time(160_792_932).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `1495` + // Estimated: `0` + // Minimum execution time: 429_031 nanoseconds. + Weight::from_ref_time(718_663_421) + // Standard Error: 362_180 + .saturating_add(Weight::from_ref_time(161_289_668).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_hash_blake2_128(r: u32) -> Weight { - Weight::from_ref_time(491_245_965) - // Standard Error: 9_798_359 - .saturating_add(Weight::from_ref_time(96_456_634).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `693 + r * (642 ±0)` + // Estimated: `0` + // Minimum execution time: 369_331 nanoseconds. + Weight::from_ref_time(468_428_595) + // Standard Error: 9_815_114 + .saturating_add(Weight::from_ref_time(44_049_004).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_hash_blake2_128_per_kb(n: u32) -> Weight { - Weight::from_ref_time(64_392_820) - // Standard Error: 377_448 - .saturating_add(Weight::from_ref_time(161_709_979).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `1495` + // Estimated: `0` + // Minimum execution time: 424_471 nanoseconds. + Weight::from_ref_time(429_542_000) + // Standard Error: 212_095 + .saturating_add(Weight::from_ref_time(165_353_726).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_ecdsa_recover(r: u32) -> Weight { - Weight::from_ref_time(502_618_577) - // Standard Error: 11_881_886 - .saturating_add(Weight::from_ref_time(5_538_606_222).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `737 + r * (6083 ±0)` + // Estimated: `0` + // Minimum execution time: 374_721 nanoseconds. + Weight::from_ref_time(491_287_314) + // Standard Error: 10_676_782 + .saturating_add(Weight::from_ref_time(5_834_782_185).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_ecdsa_to_eth_address(r: u32) -> Weight { - Weight::from_ref_time(493_801_885) - // Standard Error: 9_462_721 - .saturating_add(Weight::from_ref_time(1_303_506_314).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) - // Storage: Contracts OwnerInfoOf (r:16 w:16) + // Proof Size summary in bytes: + // Measured: `706 + r * (3362 ±0)` + // Estimated: `0` + // Minimum execution time: 373_572 nanoseconds. + Weight::from_ref_time(496_504_477) + // Standard Error: 10_908_205 + .saturating_add(Weight::from_ref_time(1_220_678_822).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_set_code_hash(r: u32) -> Weight { - Weight::from_ref_time(467_662_000) - // Standard Error: 8_675_255 - .saturating_add(Weight::from_ref_time(2_830_181_038).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `0 + r * (79300 ±0)` + // Estimated: `0` + // Minimum execution time: 375_691 nanoseconds. + Weight::from_ref_time(440_152_000) + // Standard Error: 10_804_320 + .saturating_add(Weight::from_ref_time(3_124_340_260).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_reentrance_count(r: u32) -> Weight { - Weight::from_ref_time(525_753_609) - // Standard Error: 450_192 - .saturating_add(Weight::from_ref_time(21_456_704).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `689 + r * (240 ±0)` + // Estimated: `0` + // Minimum execution time: 376_221 nanoseconds. + Weight::from_ref_time(498_826_998) + // Standard Error: 433_701 + .saturating_add(Weight::from_ref_time(25_322_334).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_account_reentrance_count(r: u32) -> Weight { - Weight::from_ref_time(630_982_153) - // Standard Error: 576_474 - .saturating_add(Weight::from_ref_time(53_288_854).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) - // Storage: Contracts ContractInfoOf (r:1 w:1) - // Storage: Contracts CodeStorage (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: System EventTopics (r:2 w:2) - // Storage: Contracts Nonce (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `1387 + r * (3140 ±0)` + // Estimated: `0` + // Minimum execution time: 379_362 nanoseconds. + Weight::from_ref_time(641_369_462) + // Standard Error: 460_856 + .saturating_add(Weight::from_ref_time(34_964_650).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// 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) fn seal_instantiation_nonce(r: u32) -> Weight { - Weight::from_ref_time(491_797_726) - // Standard Error: 368_709 - .saturating_add(Weight::from_ref_time(21_107_489).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(4)) + // Proof Size summary in bytes: + // Measured: `692 + r * (240 ±0)` + // Estimated: `0` + // Minimum execution time: 381_041 nanoseconds. + Weight::from_ref_time(505_412_667) + // Standard Error: 328_975 + .saturating_add(Weight::from_ref_time(17_860_071).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } fn instr_i64const(r: u32) -> Weight { - Weight::from_ref_time(2_189_945) - // Standard Error: 8_830 - .saturating_add(Weight::from_ref_time(1_100_564).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_620 nanoseconds. + Weight::from_ref_time(2_387_337) + // Standard Error: 6_835 + .saturating_add(Weight::from_ref_time(638_538).saturating_mul(r.into())) } fn instr_i64load(r: u32) -> Weight { - Weight::from_ref_time(10_303_330) - // Standard Error: 35_494 - .saturating_add(Weight::from_ref_time(1_987_470).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_980 nanoseconds. + Weight::from_ref_time(1_975_244) + // Standard Error: 90_756 + .saturating_add(Weight::from_ref_time(2_402_218).saturating_mul(r.into())) } fn instr_i64store(r: u32) -> Weight { - Weight::from_ref_time(7_707_768) - // Standard Error: 16_588 - .saturating_add(Weight::from_ref_time(1_792_099).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_730 nanoseconds. + Weight::from_ref_time(6_196_566) + // Standard Error: 21_612 + .saturating_add(Weight::from_ref_time(1_944_752).saturating_mul(r.into())) } fn instr_select(r: u32) -> Weight { - Weight::from_ref_time(90_986) - // Standard Error: 16_466 - .saturating_add(Weight::from_ref_time(2_825_185).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_620 nanoseconds. + Weight::from_ref_time(2_605_203) + // Standard Error: 16_536 + .saturating_add(Weight::from_ref_time(1_690_156).saturating_mul(r.into())) } fn instr_if(r: u32) -> Weight { - Weight::from_ref_time(5_452_581) - // Standard Error: 22_949 - .saturating_add(Weight::from_ref_time(2_713_169).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_500 nanoseconds. + Weight::from_ref_time(2_073_365) + // Standard Error: 22_590 + .saturating_add(Weight::from_ref_time(2_835_368).saturating_mul(r.into())) } fn instr_br(r: u32) -> Weight { - Weight::from_ref_time(1_840_198) - // Standard Error: 13_561 - .saturating_add(Weight::from_ref_time(1_639_894).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_630 nanoseconds. + Weight::from_ref_time(1_713_049) + // Standard Error: 7_754 + .saturating_add(Weight::from_ref_time(1_041_485).saturating_mul(r.into())) } fn instr_br_if(r: u32) -> Weight { - Weight::from_ref_time(1_722_282) - // Standard Error: 16_560 - .saturating_add(Weight::from_ref_time(2_052_510).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_680 nanoseconds. + Weight::from_ref_time(1_784_562) + // Standard Error: 11_866 + .saturating_add(Weight::from_ref_time(1_400_065).saturating_mul(r.into())) } fn instr_br_table(r: u32) -> Weight { - Weight::from_ref_time(1_582_828) - // Standard Error: 21_269 - .saturating_add(Weight::from_ref_time(2_827_898).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_520 nanoseconds. + Weight::from_ref_time(2_393_259) + // Standard Error: 15_018 + .saturating_add(Weight::from_ref_time(1_763_195).saturating_mul(r.into())) } fn instr_br_table_per_entry(e: u32) -> Weight { - Weight::from_ref_time(8_391_206) - // Standard Error: 502 - .saturating_add(Weight::from_ref_time(824).saturating_mul(e.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_800 nanoseconds. + Weight::from_ref_time(7_373_483) + // Standard Error: 520 + .saturating_add(Weight::from_ref_time(3_848).saturating_mul(e.into())) } fn instr_call(r: u32) -> Weight { - Weight::from_ref_time(11_931_216) - // Standard Error: 47_016 - .saturating_add(Weight::from_ref_time(5_318_865).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_560 nanoseconds. + Weight::from_ref_time(5_556_196) + // Standard Error: 43_838 + .saturating_add(Weight::from_ref_time(5_075_625).saturating_mul(r.into())) } fn instr_call_indirect(r: u32) -> Weight { - Weight::from_ref_time(15_786_730) - // Standard Error: 59_351 - .saturating_add(Weight::from_ref_time(6_461_047).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_910 nanoseconds. + Weight::from_ref_time(8_951_239) + // Standard Error: 55_679 + .saturating_add(Weight::from_ref_time(5_802_490).saturating_mul(r.into())) } fn instr_call_indirect_per_param(p: u32) -> Weight { - Weight::from_ref_time(13_765_096) - // Standard Error: 4_883 - .saturating_add(Weight::from_ref_time(351_475).saturating_mul(p.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 9_270 nanoseconds. + Weight::from_ref_time(12_401_007) + // Standard Error: 4_705 + .saturating_add(Weight::from_ref_time(320_706).saturating_mul(p.into())) } fn instr_call_per_local(l: u32) -> Weight { - Weight::from_ref_time(9_861_091) - // Standard Error: 790 - .saturating_add(Weight::from_ref_time(87_335).saturating_mul(l.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 6_240 nanoseconds. + Weight::from_ref_time(8_985_089) + // Standard Error: 764 + .saturating_add(Weight::from_ref_time(86_565).saturating_mul(l.into())) } fn instr_local_get(r: u32) -> Weight { - Weight::from_ref_time(3_945_247) - // Standard Error: 11_128 - .saturating_add(Weight::from_ref_time(1_384_713).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_790 nanoseconds. + Weight::from_ref_time(5_762_201) + // Standard Error: 7_458 + .saturating_add(Weight::from_ref_time(803_267).saturating_mul(r.into())) } fn instr_local_set(r: u32) -> Weight { - Weight::from_ref_time(4_814_173) - // Standard Error: 11_533 - .saturating_add(Weight::from_ref_time(1_382_446).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_840 nanoseconds. + Weight::from_ref_time(5_531_801) + // Standard Error: 9_241 + .saturating_add(Weight::from_ref_time(1_127_998).saturating_mul(r.into())) } fn instr_local_tee(r: u32) -> Weight { - Weight::from_ref_time(6_068_013) - // Standard Error: 15_486 - .saturating_add(Weight::from_ref_time(1_901_310).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_870 nanoseconds. + Weight::from_ref_time(5_283_748) + // Standard Error: 12_147 + .saturating_add(Weight::from_ref_time(1_360_940).saturating_mul(r.into())) } fn instr_global_get(r: u32) -> Weight { - Weight::from_ref_time(6_345_230) - // Standard Error: 18_258 - .saturating_add(Weight::from_ref_time(1_617_970).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_790 nanoseconds. + Weight::from_ref_time(2_415_275) + // Standard Error: 16_052 + .saturating_add(Weight::from_ref_time(1_500_688).saturating_mul(r.into())) } fn instr_global_set(r: u32) -> Weight { - Weight::from_ref_time(324_115) - // Standard Error: 15_894 - .saturating_add(Weight::from_ref_time(2_226_970).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_530 nanoseconds. + Weight::from_ref_time(2_078_827) + // Standard Error: 14_870 + .saturating_add(Weight::from_ref_time(1_937_341).saturating_mul(r.into())) } fn instr_memory_current(r: u32) -> Weight { - Weight::from_ref_time(4_965_418) - // Standard Error: 13_543 - .saturating_add(Weight::from_ref_time(1_291_082).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_900 nanoseconds. + Weight::from_ref_time(2_165_104) + // Standard Error: 11_290 + .saturating_add(Weight::from_ref_time(1_446_668).saturating_mul(r.into())) } fn instr_memory_grow(r: u32) -> Weight { - Weight::from_ref_time(1_956_457) - // Standard Error: 660_715 - .saturating_add(Weight::from_ref_time(371_399_642).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_600 nanoseconds. + Weight::from_ref_time(1_978_697) + // Standard Error: 232_560 + .saturating_add(Weight::from_ref_time(241_980_002).saturating_mul(r.into())) } fn instr_i64clz(r: u32) -> Weight { - Weight::from_ref_time(3_541_045) - // Standard Error: 12_084 - .saturating_add(Weight::from_ref_time(1_417_000).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_680 nanoseconds. + Weight::from_ref_time(3_697_230) + // Standard Error: 10_402 + .saturating_add(Weight::from_ref_time(907_163).saturating_mul(r.into())) } fn instr_i64ctz(r: u32) -> Weight { - Weight::from_ref_time(4_045_982) - // Standard Error: 12_643 - .saturating_add(Weight::from_ref_time(1_494_257).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_530 nanoseconds. + Weight::from_ref_time(3_110_782) + // Standard Error: 8_945 + .saturating_add(Weight::from_ref_time(936_984).saturating_mul(r.into())) } fn instr_i64popcnt(r: u32) -> Weight { - Weight::from_ref_time(699_898) - // Standard Error: 13_951 - .saturating_add(Weight::from_ref_time(1_553_095).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_450 nanoseconds. + Weight::from_ref_time(2_631_715) + // Standard Error: 12_463 + .saturating_add(Weight::from_ref_time(956_920).saturating_mul(r.into())) } fn instr_i64eqz(r: u32) -> Weight { - Weight::from_ref_time(1_034_066) - // Standard Error: 12_154 - .saturating_add(Weight::from_ref_time(1_564_759).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_690 nanoseconds. + Weight::from_ref_time(2_337_994) + // Standard Error: 8_242 + .saturating_add(Weight::from_ref_time(931_058).saturating_mul(r.into())) } fn instr_i64extendsi32(r: u32) -> Weight { - Weight::from_ref_time(2_002_521) - // Standard Error: 11_738 - .saturating_add(Weight::from_ref_time(1_573_686).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_830 nanoseconds. + Weight::from_ref_time(3_852_742) + // Standard Error: 9_470 + .saturating_add(Weight::from_ref_time(907_345).saturating_mul(r.into())) } fn instr_i64extendui32(r: u32) -> Weight { - Weight::from_ref_time(2_774_946) - // Standard Error: 12_068 - .saturating_add(Weight::from_ref_time(1_487_936).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_440 nanoseconds. + Weight::from_ref_time(2_954_359) + // Standard Error: 9_330 + .saturating_add(Weight::from_ref_time(934_345).saturating_mul(r.into())) } fn instr_i32wrapi64(r: u32) -> Weight { - Weight::from_ref_time(626_689) - // Standard Error: 11_299 - .saturating_add(Weight::from_ref_time(1_549_056).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_430 nanoseconds. + Weight::from_ref_time(2_269_993) + // Standard Error: 10_238 + .saturating_add(Weight::from_ref_time(953_368).saturating_mul(r.into())) } fn instr_i64eq(r: u32) -> Weight { - Weight::from_ref_time(2_333_682) - // Standard Error: 17_041 - .saturating_add(Weight::from_ref_time(1_851_756).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_590 nanoseconds. + Weight::from_ref_time(3_010_851) + // Standard Error: 12_100 + .saturating_add(Weight::from_ref_time(1_265_899).saturating_mul(r.into())) } fn instr_i64ne(r: u32) -> Weight { - Weight::from_ref_time(1_041_986) - // Standard Error: 14_199 - .saturating_add(Weight::from_ref_time(1_944_400).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_570 nanoseconds. + Weight::from_ref_time(2_649_717) + // Standard Error: 12_171 + .saturating_add(Weight::from_ref_time(1_270_084).saturating_mul(r.into())) } fn instr_i64lts(r: u32) -> Weight { - Weight::from_ref_time(2_700_264) - // Standard Error: 15_744 - .saturating_add(Weight::from_ref_time(1_862_463).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_630 nanoseconds. + Weight::from_ref_time(2_874_454) + // Standard Error: 16_372 + .saturating_add(Weight::from_ref_time(1_248_283).saturating_mul(r.into())) } fn instr_i64ltu(r: u32) -> Weight { - Weight::from_ref_time(2_435_234) - // Standard Error: 16_322 - .saturating_add(Weight::from_ref_time(1_874_783).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_880 nanoseconds. + Weight::from_ref_time(3_788_144) + // Standard Error: 12_191 + .saturating_add(Weight::from_ref_time(1_236_076).saturating_mul(r.into())) } fn instr_i64gts(r: u32) -> Weight { - Weight::from_ref_time(1_459_541) - // Standard Error: 14_651 - .saturating_add(Weight::from_ref_time(1_917_007).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_470 nanoseconds. + Weight::from_ref_time(3_016_346) + // Standard Error: 11_591 + .saturating_add(Weight::from_ref_time(1_246_106).saturating_mul(r.into())) } fn instr_i64gtu(r: u32) -> Weight { - Weight::from_ref_time(3_588_850) - // Standard Error: 15_517 - .saturating_add(Weight::from_ref_time(1_795_934).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_490 nanoseconds. + Weight::from_ref_time(4_841_307) + // Standard Error: 13_372 + .saturating_add(Weight::from_ref_time(1_179_750).saturating_mul(r.into())) } fn instr_i64les(r: u32) -> Weight { - Weight::from_ref_time(3_091_309) - // Standard Error: 14_767 - .saturating_add(Weight::from_ref_time(1_843_758).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_640 nanoseconds. + Weight::from_ref_time(3_749_383) + // Standard Error: 13_031 + .saturating_add(Weight::from_ref_time(1_180_445).saturating_mul(r.into())) } fn instr_i64leu(r: u32) -> Weight { - Weight::from_ref_time(1_201_612) - // Standard Error: 14_668 - .saturating_add(Weight::from_ref_time(1_913_945).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_500 nanoseconds. + Weight::from_ref_time(3_947_468) + // Standard Error: 13_230 + .saturating_add(Weight::from_ref_time(1_187_807).saturating_mul(r.into())) } fn instr_i64ges(r: u32) -> Weight { - Weight::from_ref_time(1_491_587) - // Standard Error: 16_921 - .saturating_add(Weight::from_ref_time(1_946_149).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_560 nanoseconds. + Weight::from_ref_time(3_843_179) + // Standard Error: 12_761 + .saturating_add(Weight::from_ref_time(1_169_350).saturating_mul(r.into())) } fn instr_i64geu(r: u32) -> Weight { - Weight::from_ref_time(152_314) - // Standard Error: 11_949 - .saturating_add(Weight::from_ref_time(2_018_714).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_640 nanoseconds. + Weight::from_ref_time(3_546_752) + // Standard Error: 11_529 + .saturating_add(Weight::from_ref_time(1_189_547).saturating_mul(r.into())) } fn instr_i64add(r: u32) -> Weight { - Weight::from_ref_time(2_742_157) - // Standard Error: 14_796 - .saturating_add(Weight::from_ref_time(1_799_703).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_490 nanoseconds. + Weight::from_ref_time(3_462_333) + // Standard Error: 11_127 + .saturating_add(Weight::from_ref_time(1_192_366).saturating_mul(r.into())) } fn instr_i64sub(r: u32) -> Weight { - Weight::from_ref_time(2_286_292) - // Standard Error: 14_078 - .saturating_add(Weight::from_ref_time(1_784_751).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_570 nanoseconds. + Weight::from_ref_time(3_496_387) + // Standard Error: 9_997 + .saturating_add(Weight::from_ref_time(1_144_723).saturating_mul(r.into())) } fn instr_i64mul(r: u32) -> Weight { - Weight::from_ref_time(2_199_299) - // Standard Error: 15_272 - .saturating_add(Weight::from_ref_time(1_796_277).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_630 nanoseconds. + Weight::from_ref_time(2_929_178) + // Standard Error: 11_322 + .saturating_add(Weight::from_ref_time(1_194_513).saturating_mul(r.into())) } fn instr_i64divs(r: u32) -> Weight { - Weight::from_ref_time(1_413_962) - // Standard Error: 15_817 - .saturating_add(Weight::from_ref_time(2_000_355).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_610 nanoseconds. + Weight::from_ref_time(2_070_771) + // Standard Error: 15_807 + .saturating_add(Weight::from_ref_time(1_391_944).saturating_mul(r.into())) } fn instr_i64divu(r: u32) -> Weight { - Weight::from_ref_time(2_907_795) - // Standard Error: 15_745 - .saturating_add(Weight::from_ref_time(1_901_546).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_580 nanoseconds. + Weight::from_ref_time(3_433_245) + // Standard Error: 17_657 + .saturating_add(Weight::from_ref_time(1_261_402).saturating_mul(r.into())) } fn instr_i64rems(r: u32) -> Weight { - Weight::from_ref_time(2_669_603) - // Standard Error: 16_923 - .saturating_add(Weight::from_ref_time(1_921_234).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_560 nanoseconds. + Weight::from_ref_time(2_524_071) + // Standard Error: 14_654 + .saturating_add(Weight::from_ref_time(1_476_887).saturating_mul(r.into())) } fn instr_i64remu(r: u32) -> Weight { - Weight::from_ref_time(2_361_836) - // Standard Error: 15_758 - .saturating_add(Weight::from_ref_time(1_947_362).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_620 nanoseconds. + Weight::from_ref_time(1_648_003) + // Standard Error: 14_508 + .saturating_add(Weight::from_ref_time(1_349_871).saturating_mul(r.into())) } fn instr_i64and(r: u32) -> Weight { - Weight::from_ref_time(2_131_911) - // Standard Error: 16_388 - .saturating_add(Weight::from_ref_time(1_850_606).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_580 nanoseconds. + Weight::from_ref_time(4_370_647) + // Standard Error: 20_304 + .saturating_add(Weight::from_ref_time(1_217_565).saturating_mul(r.into())) } fn instr_i64or(r: u32) -> Weight { - Weight::from_ref_time(3_312_588) - // Standard Error: 14_708 - .saturating_add(Weight::from_ref_time(1_775_228).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_630 nanoseconds. + Weight::from_ref_time(3_535_670) + // Standard Error: 10_984 + .saturating_add(Weight::from_ref_time(1_180_943).saturating_mul(r.into())) } fn instr_i64xor(r: u32) -> Weight { - Weight::from_ref_time(2_122_896) - // Standard Error: 14_442 - .saturating_add(Weight::from_ref_time(1_840_191).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_470 nanoseconds. + Weight::from_ref_time(3_001_354) + // Standard Error: 14_478 + .saturating_add(Weight::from_ref_time(1_217_792).saturating_mul(r.into())) } fn instr_i64shl(r: u32) -> Weight { - Weight::from_ref_time(4_459_051) - // Standard Error: 14_854 - .saturating_add(Weight::from_ref_time(1_775_941).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_440 nanoseconds. + Weight::from_ref_time(3_198_669) + // Standard Error: 13_937 + .saturating_add(Weight::from_ref_time(1_206_547).saturating_mul(r.into())) } fn instr_i64shrs(r: u32) -> Weight { - Weight::from_ref_time(4_326_537) - // Standard Error: 13_678 - .saturating_add(Weight::from_ref_time(1_733_016).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_470 nanoseconds. + Weight::from_ref_time(1_586_404) + // Standard Error: 11_001 + .saturating_add(Weight::from_ref_time(1_270_803).saturating_mul(r.into())) } fn instr_i64shru(r: u32) -> Weight { - Weight::from_ref_time(2_565_777) - // Standard Error: 14_869 - .saturating_add(Weight::from_ref_time(1_834_825).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_540 nanoseconds. + Weight::from_ref_time(3_700_673) + // Standard Error: 12_442 + .saturating_add(Weight::from_ref_time(1_188_232).saturating_mul(r.into())) } fn instr_i64rotl(r: u32) -> Weight { - Weight::from_ref_time(1_074_040) - // Standard Error: 14_879 - .saturating_add(Weight::from_ref_time(1_887_430).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_510 nanoseconds. + Weight::from_ref_time(3_723_038) + // Standard Error: 14_571 + .saturating_add(Weight::from_ref_time(1_221_028).saturating_mul(r.into())) } fn instr_i64rotr(r: u32) -> Weight { - Weight::from_ref_time(2_637_485) - // Standard Error: 14_170 - .saturating_add(Weight::from_ref_time(1_850_130).saturating_mul(r.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_410 nanoseconds. + Weight::from_ref_time(4_089_917) + // Standard Error: 11_114 + .saturating_add(Weight::from_ref_time(1_221_863).saturating_mul(r.into())) } } diff --git a/runtime/common/src/weights/pallet_democracy.rs b/runtime/common/src/weights/pallet_democracy.rs index 0192ca072..7983bae3b 100644 --- a/runtime/common/src/weights/pallet_democracy.rs +++ b/runtime/common/src/weights/pallet_democracy.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_democracy //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,185 +52,332 @@ use frame_support::{ /// Weight functions for pallet_democracy (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_democracy::weights::WeightInfo for WeightInfo { - // Storage: Democracy PublicPropCount (r:1 w:1) - // Storage: Democracy PublicProps (r:1 w:1) - // Storage: Democracy Blacklist (r:1 w:0) - // Storage: Democracy DepositOf (r:0 w:1) + /// Storage: Democracy PublicPropCount (r:1 w:1) + /// Proof: Democracy PublicPropCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// 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) + /// Storage: Democracy DepositOf (r:0 w:1) + /// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen) fn propose() -> Weight { - Weight::from_ref_time(104_090_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `4835` + // Estimated: `23413` + // Minimum execution time: 60_680 nanoseconds. + Weight::from_parts(105_460_000, 23413) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Democracy DepositOf (r:1 w:1) + /// Storage: Democracy DepositOf (r:1 w:1) + /// Proof: Democracy DepositOf (max_values: None, max_size: Some(3230), added: 5705, mode: MaxEncodedLen) fn second() -> Weight { - Weight::from_ref_time(87_920_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `3591` + // Estimated: `5705` + // Minimum execution time: 44_880 nanoseconds. + Weight::from_parts(56_370_000, 5705) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Democracy ReferendumInfoOf (r:1 w:1) - // Storage: Democracy VotingOf (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Democracy ReferendumInfoOf (r:1 w:1) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Storage: Democracy VotingOf (r:1 w:1) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn vote_new() -> Weight { - Weight::from_ref_time(110_850_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `3500` + // Estimated: `12732` + // Minimum execution time: 61_371 nanoseconds. + Weight::from_parts(75_730_000, 12732) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Democracy ReferendumInfoOf (r:1 w:1) - // Storage: Democracy VotingOf (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Democracy ReferendumInfoOf (r:1 w:1) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Storage: Democracy VotingOf (r:1 w:1) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn vote_existing() -> Weight { - Weight::from_ref_time(110_480_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `3522` + // Estimated: `12732` + // Minimum execution time: 64_030 nanoseconds. + Weight::from_parts(76_721_000, 12732) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Democracy ReferendumInfoOf (r:1 w:1) - // Storage: Democracy Cancellations (r:1 w:1) + /// Storage: Democracy ReferendumInfoOf (r:1 w:1) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Storage: Democracy Cancellations (r:1 w:1) + /// Proof: Democracy Cancellations (max_values: None, max_size: Some(33), added: 2508, mode: MaxEncodedLen) fn emergency_cancel() -> Weight { - Weight::from_ref_time(52_520_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Democracy PublicProps (r:1 w:1) - // Storage: Democracy DepositOf (r:1 w:1) - // Storage: System Account (r:2 w:2) - // Storage: Democracy NextExternal (r:1 w:1) - // Storage: Democracy ReferendumInfoOf (r:1 w:1) - // Storage: Democracy Blacklist (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `5192` + // Minimum execution time: 29_470 nanoseconds. + Weight::from_parts(35_920_000, 5192) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_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: 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) + /// Storage: Democracy Blacklist (r:0 w:1) + /// Proof: Democracy Blacklist (max_values: None, max_size: Some(3242), added: 5717, mode: MaxEncodedLen) fn blacklist() -> Weight { - Weight::from_ref_time(170_441_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(7)) + // Proof Size summary in bytes: + // Measured: `6251` + // Estimated: `31427` + // Minimum execution time: 119_040 nanoseconds. + Weight::from_parts(144_711_000, 31427) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) } - // Storage: Democracy NextExternal (r:1 w:1) - // Storage: Democracy Blacklist (r:1 w:0) + /// 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) fn external_propose() -> Weight { - Weight::from_ref_time(39_940_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `3419` + // Estimated: `6344` + // Minimum execution time: 20_370 nanoseconds. + Weight::from_parts(24_541_000, 6344) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Democracy NextExternal (r:0 w:1) + /// Storage: Democracy NextExternal (r:0 w:1) + /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) fn external_propose_majority() -> Weight { - Weight::from_ref_time(10_580_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_450 nanoseconds. + Weight::from_ref_time(6_610_000).saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Democracy NextExternal (r:0 w:1) + /// Storage: Democracy NextExternal (r:0 w:1) + /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) fn external_propose_default() -> Weight { - Weight::from_ref_time(10_580_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_590 nanoseconds. + Weight::from_ref_time(6_640_000).saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Democracy NextExternal (r:1 w:1) - // Storage: Democracy ReferendumCount (r:1 w:1) - // Storage: Democracy ReferendumInfoOf (r:0 w:1) + /// 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 ReferendumInfoOf (r:0 w:1) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) fn fast_track() -> Weight { - Weight::from_ref_time(49_970_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `179` + // Estimated: `1126` + // Minimum execution time: 28_110 nanoseconds. + Weight::from_parts(28_900_000, 1126) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Democracy NextExternal (r:1 w:1) - // Storage: Democracy Blacklist (r:1 w:1) + /// 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) fn veto_external() -> Weight { - Weight::from_ref_time(59_000_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `3448` + // Estimated: `6344` + // Minimum execution time: 38_240 nanoseconds. + Weight::from_parts(43_900_000, 6344) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Democracy PublicProps (r:1 w:1) - // Storage: Democracy DepositOf (r:1 w:1) - // Storage: System Account (r:2 w:2) + /// 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) fn cancel_proposal() -> Weight { - Weight::from_ref_time(147_750_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + // Proof Size summary in bytes: + // Measured: `6122` + // Estimated: `28116` + // Minimum execution time: 97_150 nanoseconds. + Weight::from_parts(120_481_000, 28116) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } - // Storage: Democracy ReferendumInfoOf (r:0 w:1) + /// Storage: Democracy ReferendumInfoOf (r:0 w:1) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) fn cancel_referendum() -> Weight { - Weight::from_ref_time(34_150_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 12_600 nanoseconds. + Weight::from_ref_time(15_940_000).saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Democracy LowestUnbaked (r:1 w:1) - // Storage: Democracy ReferendumCount (r:1 w:0) - // Storage: Democracy ReferendumInfoOf (r:2 w:0) + /// 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) fn on_initialize_base(r: u32) -> Weight { - Weight::from_ref_time(31_624_285) - // Standard Error: 33_652 - .saturating_add(Weight::from_ref_time(3_950_413).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `174 + r * (125 ±0)` + // Estimated: `998 + r * (2684 ±0)` + // Minimum execution time: 13_420 nanoseconds. + Weight::from_parts(10_794_167, 998) + // Standard Error: 46_774 + .saturating_add(Weight::from_ref_time(4_985_297).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)) - } - // Storage: Democracy LowestUnbaked (r:1 w:1) - // Storage: Democracy ReferendumCount (r:1 w:0) - // Storage: Democracy LastTabledWasExternal (r:1 w:0) - // Storage: Democracy NextExternal (r:1 w:0) - // Storage: Democracy PublicProps (r:1 w:0) - // Storage: Democracy ReferendumInfoOf (r:2 w:0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(2684).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) + /// Storage: Democracy ReferendumCount (r:1 w:0) + /// Proof: Democracy ReferendumCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Democracy LastTabledWasExternal (r:1 w:0) + /// Proof: Democracy LastTabledWasExternal (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: Democracy NextExternal (r:1 w:0) + /// Proof: Democracy NextExternal (max_values: Some(1), max_size: Some(132), added: 627, mode: MaxEncodedLen) + /// 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) fn on_initialize_base_with_launch_period(r: u32) -> Weight { - Weight::from_ref_time(45_766_159) - // Standard Error: 54_944 - .saturating_add(Weight::from_ref_time(4_083_336).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(5)) + // Proof Size summary in bytes: + // Measured: `174 + r * (125 ±0)` + // Estimated: `19318 + r * (2684 ±0)` + // Minimum execution time: 19_240 nanoseconds. + Weight::from_parts(34_319_713, 19318) + // Standard Error: 44_408 + .saturating_add(Weight::from_ref_time(4_957_152).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(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(2684).saturating_mul(r.into())) } - // Storage: Democracy VotingOf (r:3 w:3) - // Storage: Balances Locks (r:1 w:1) - // Storage: Democracy ReferendumInfoOf (r:2 w:2) + /// Storage: Democracy VotingOf (r:3 w:3) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn delegate(r: u32) -> Weight { - Weight::from_ref_time(85_799_572) - // Standard Error: 67_221 - .saturating_add(Weight::from_ref_time(5_976_362).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(4)) + // Proof Size summary in bytes: + // Measured: `897 + r * (147 ±0)` + // Estimated: `22596 + r * (2684 ±0)` + // Minimum execution time: 59_120 nanoseconds. + Weight::from_parts(89_161_582, 22596) + // Standard Error: 71_808 + .saturating_add(Weight::from_ref_time(6_198_429).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4_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((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_proof_size(2684).saturating_mul(r.into())) } - // Storage: Democracy VotingOf (r:2 w:2) - // Storage: Democracy ReferendumInfoOf (r:2 w:2) + /// Storage: Democracy VotingOf (r:2 w:2) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// Proof: Democracy ReferendumInfoOf (max_values: None, max_size: Some(209), added: 2684, mode: MaxEncodedLen) fn undelegate(r: u32) -> Weight { - Weight::from_ref_time(48_347_605) - // Standard Error: 58_086 - .saturating_add(Weight::from_ref_time(6_042_597).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `522 + r * (147 ±0)` + // Estimated: `12548 + r * (2684 ±0)` + // Minimum execution time: 29_370 nanoseconds. + Weight::from_parts(43_898_195, 12548) + // Standard Error: 104_088 + .saturating_add(Weight::from_ref_time(6_428_500).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((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(2684).saturating_mul(r.into())) } - // Storage: Democracy PublicProps (r:0 w:1) + /// Storage: Democracy PublicProps (r:0 w:1) + /// Proof: Democracy PublicProps (max_values: Some(1), max_size: Some(16702), added: 17197, mode: MaxEncodedLen) fn clear_public_proposals() -> Weight { - Weight::from_ref_time(13_860_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_420 nanoseconds. + Weight::from_ref_time(6_760_000).saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Democracy VotingOf (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Democracy VotingOf (r:1 w:1) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) + /// 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) fn unlock_remove(r: u32) -> Weight { - Weight::from_ref_time(60_965_244) - // Standard Error: 8_626 - .saturating_add(Weight::from_ref_time(69_320).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: Democracy VotingOf (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `554` + // Estimated: `12655` + // Minimum execution time: 33_190 nanoseconds. + Weight::from_parts(46_406_241, 12655) + // Standard Error: 5_676 + .saturating_add(Weight::from_ref_time(8_684).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(3_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) + /// 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) fn unlock_set(r: u32) -> Weight { - Weight::from_ref_time(61_364_522) - // Standard Error: 8_955 - .saturating_add(Weight::from_ref_time(127_590).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: Democracy ReferendumInfoOf (r:1 w:1) - // Storage: Democracy VotingOf (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `555 + r * (22 ±0)` + // Estimated: `12655` + // Minimum execution time: 34_740 nanoseconds. + Weight::from_parts(45_567_328, 12655) + // Standard Error: 6_413 + .saturating_add(Weight::from_ref_time(67_764).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(3_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) + /// Storage: Democracy VotingOf (r:1 w:1) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) fn remove_vote(r: u32) -> Weight { - Weight::from_ref_time(37_901_366) - // Standard Error: 6_809 - .saturating_add(Weight::from_ref_time(147_723).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Democracy ReferendumInfoOf (r:1 w:1) - // Storage: Democracy VotingOf (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `760 + r * (26 ±0)` + // Estimated: `8958` + // Minimum execution time: 26_320 nanoseconds. + Weight::from_parts(34_770_028, 8958) + // Standard Error: 5_675 + .saturating_add(Weight::from_ref_time(90_054).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) + /// Storage: Democracy VotingOf (r:1 w:1) + /// Proof: Democracy VotingOf (max_values: None, max_size: Some(3799), added: 6274, mode: MaxEncodedLen) fn remove_other_vote(r: u32) -> Weight { - Weight::from_ref_time(37_159_184) - // Standard Error: 8_960 - .saturating_add(Weight::from_ref_time(168_663).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `760 + r * (26 ±0)` + // Estimated: `8958` + // Minimum execution time: 23_080 nanoseconds. + Weight::from_parts(34_385_271, 8958) + // Standard Error: 8_441 + .saturating_add(Weight::from_ref_time(98_441).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } } diff --git a/runtime/common/src/weights/pallet_identity.rs b/runtime/common/src/weights/pallet_identity.rs index 9d1b5c8f5..d94718b2b 100644 --- a/runtime/common/src/weights/pallet_identity.rs +++ b/runtime/common/src/weights/pallet_identity.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_identity //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,160 +52,258 @@ use frame_support::{ /// Weight functions for pallet_identity (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_identity::weights::WeightInfo for WeightInfo { - // Storage: Identity Registrars (r:1 w:1) + /// Storage: Identity Registrars (r:1 w:1) + /// Proof: Identity Registrars (max_values: Some(1), max_size: Some(457), added: 952, mode: MaxEncodedLen) fn add_registrar(r: u32) -> Weight { - Weight::from_ref_time(35_442_944) - // Standard Error: 114_026 - .saturating_add(Weight::from_ref_time(1_320_950).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Identity IdentityOf (r:1 w:1) - fn set_identity(r: u32, x: u32) -> Weight { - Weight::from_ref_time(65_456_192) - // Standard Error: 155_580 - .saturating_add(Weight::from_ref_time(280_047).saturating_mul(r.into())) - // Standard Error: 18_071 - .saturating_add(Weight::from_ref_time(642_608).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Identity IdentityOf (r:1 w:0) - // Storage: Identity SubsOf (r:1 w:1) - // Storage: Identity SuperOf (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `64 + r * (57 ±0)` + // Estimated: `952` + // Minimum execution time: 19_750 nanoseconds. + Weight::from_parts(23_875_912, 952) + // Standard Error: 44_966 + .saturating_add(Weight::from_ref_time(276_086).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Identity IdentityOf (r:1 w:1) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + fn set_identity(_r: u32, x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `474 + r * (5 ±0)` + // Estimated: `7313` + // Minimum execution time: 26_470 nanoseconds. + Weight::from_parts(52_488_961, 7313) + // Standard Error: 15_114 + .saturating_add(Weight::from_ref_time(650_896).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Identity IdentityOf (r:1 w:0) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + /// Storage: Identity SubsOf (r:1 w:1) + /// Proof: Identity SubsOf (max_values: None, max_size: Some(2106), added: 4581, mode: MaxEncodedLen) + /// Storage: Identity SuperOf (r:64 w:64) + /// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) fn set_subs_new(s: u32) -> Weight { - Weight::from_ref_time(52_167_774) - // Standard Error: 50_150 - .saturating_add(Weight::from_ref_time(5_114_992).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `101` + // Estimated: `11894 + s * (2589 ±0)` + // Minimum execution time: 15_090 nanoseconds. + Weight::from_parts(36_412_498, 11894) + // Standard Error: 41_980 + .saturating_add(Weight::from_ref_time(5_214_371).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(2589).saturating_mul(s.into())) } - // Storage: Identity IdentityOf (r:1 w:0) - // Storage: Identity SubsOf (r:1 w:1) - // Storage: Identity SuperOf (r:0 w:1) + /// Storage: Identity IdentityOf (r:1 w:0) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + /// Storage: Identity SubsOf (r:1 w:1) + /// Proof: Identity SubsOf (max_values: None, max_size: Some(2106), added: 4581, mode: MaxEncodedLen) + /// Storage: Identity SuperOf (r:0 w:64) + /// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) fn set_subs_old(p: u32) -> Weight { - Weight::from_ref_time(49_861_666) - // Standard Error: 54_784 - .saturating_add(Weight::from_ref_time(2_535_996).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) - } - // Storage: Identity SubsOf (r:1 w:1) - // Storage: Identity IdentityOf (r:1 w:1) - // Storage: Identity SuperOf (r:0 w:64) - fn clear_identity(_r: u32, s: u32, x: u32) -> Weight { - Weight::from_ref_time(95_624_852) - // Standard Error: 33_176 - .saturating_add(Weight::from_ref_time(2_111_179).saturating_mul(s.into())) - // Standard Error: 33_176 - .saturating_add(Weight::from_ref_time(143_010).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) - } - // Storage: Identity Registrars (r:1 w:0) - // Storage: Identity IdentityOf (r:1 w:1) - fn request_judgement(r: u32, x: u32) -> Weight { - Weight::from_ref_time(64_429_964) - // Standard Error: 133_660 - .saturating_add(Weight::from_ref_time(957_267).saturating_mul(r.into())) - // Standard Error: 15_525 - .saturating_add(Weight::from_ref_time(855_220).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Identity IdentityOf (r:1 w:1) - fn cancel_request(_r: u32, x: u32) -> Weight { - Weight::from_ref_time(77_150_416) - // Standard Error: 19_200 - .saturating_add(Weight::from_ref_time(645_689).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Identity Registrars (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `226 + p * (32 ±0)` + // Estimated: `11894` + // Minimum execution time: 17_660 nanoseconds. + Weight::from_parts(40_522_976, 11894) + // Standard Error: 33_316 + .saturating_add(Weight::from_ref_time(2_105_754).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Identity SubsOf (r:1 w:1) + /// Proof: Identity SubsOf (max_values: None, max_size: Some(2106), added: 4581, mode: MaxEncodedLen) + /// Storage: Identity IdentityOf (r:1 w:1) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + /// Storage: Identity SuperOf (r:0 w:64) + /// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + fn clear_identity(r: u32, s: u32, x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `535 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)` + // Estimated: `11894` + // Minimum execution time: 52_610 nanoseconds. + Weight::from_parts(38_385_262, 11894) + // Standard Error: 223_582 + .saturating_add(Weight::from_ref_time(234_415).saturating_mul(r.into())) + // Standard Error: 26_034 + .saturating_add(Weight::from_ref_time(2_014_829).saturating_mul(s.into())) + // Standard Error: 26_034 + .saturating_add(Weight::from_ref_time(425_350).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Identity Registrars (r:1 w:0) + /// Proof: Identity Registrars (max_values: Some(1), max_size: Some(457), added: 952, mode: MaxEncodedLen) + /// Storage: Identity IdentityOf (r:1 w:1) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + fn request_judgement(_r: u32, x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `431 + r * (57 ±0) + x * (66 ±0)` + // Estimated: `8265` + // Minimum execution time: 42_260 nanoseconds. + Weight::from_parts(52_260_973, 8265) + // Standard Error: 13_326 + .saturating_add(Weight::from_ref_time(721_487).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Identity IdentityOf (r:1 w:1) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + fn cancel_request(r: u32, x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `430 + x * (66 ±0)` + // Estimated: `7313` + // Minimum execution time: 36_330 nanoseconds. + Weight::from_parts(42_149_171, 7313) + // Standard Error: 141_837 + .saturating_add(Weight::from_ref_time(673_369).saturating_mul(r.into())) + // Standard Error: 16_475 + .saturating_add(Weight::from_ref_time(729_714).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Identity Registrars (r:1 w:1) + /// Proof: Identity Registrars (max_values: Some(1), max_size: Some(457), added: 952, mode: MaxEncodedLen) fn set_fee(r: u32) -> Weight { - Weight::from_ref_time(18_803_475) - // Standard Error: 40_144 - .saturating_add(Weight::from_ref_time(777_518).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `121 + r * (57 ±0)` + // Estimated: `952` + // Minimum execution time: 13_950 nanoseconds. + Weight::from_parts(16_409_239, 952) + // Standard Error: 29_690 + .saturating_add(Weight::from_ref_time(229_915).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Identity Registrars (r:1 w:1) + /// Storage: Identity Registrars (r:1 w:1) + /// Proof: Identity Registrars (max_values: Some(1), max_size: Some(457), added: 952, mode: MaxEncodedLen) fn set_account_id(r: u32) -> Weight { - Weight::from_ref_time(20_046_914) - // Standard Error: 39_734 - .saturating_add(Weight::from_ref_time(240_869).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `121 + r * (57 ±0)` + // Estimated: `952` + // Minimum execution time: 11_170 nanoseconds. + Weight::from_parts(13_615_141, 952) + // Standard Error: 20_885 + .saturating_add(Weight::from_ref_time(392_778).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Identity Registrars (r:1 w:1) + /// Storage: Identity Registrars (r:1 w:1) + /// Proof: Identity Registrars (max_values: Some(1), max_size: Some(457), added: 952, mode: MaxEncodedLen) fn set_fields(r: u32) -> Weight { - Weight::from_ref_time(16_609_928) - // Standard Error: 84_078 - .saturating_add(Weight::from_ref_time(1_848_011).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Identity Registrars (r:1 w:0) - // Storage: Identity IdentityOf (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `121 + r * (57 ±0)` + // Estimated: `952` + // Minimum execution time: 11_490 nanoseconds. + Weight::from_parts(14_496_207, 952) + // Standard Error: 41_795 + .saturating_add(Weight::from_ref_time(215_483).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Identity Registrars (r:1 w:0) + /// Proof: Identity Registrars (max_values: Some(1), max_size: Some(457), added: 952, mode: MaxEncodedLen) + /// Storage: Identity IdentityOf (r:1 w:1) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) fn provide_judgement(_r: u32, x: u32) -> Weight { - Weight::from_ref_time(62_486_303) - // Standard Error: 15_513 - .saturating_add(Weight::from_ref_time(1_086_594).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Identity SubsOf (r:1 w:1) - // Storage: Identity IdentityOf (r:1 w:1) - // Storage: System Account (r:2 w:2) - // Storage: Identity SuperOf (r:0 w:64) - fn kill_identity(_r: u32, s: u32, x: u32) -> Weight { - Weight::from_ref_time(112_372_876) - // Standard Error: 38_249 - .saturating_add(Weight::from_ref_time(2_119_735).saturating_mul(s.into())) - // Standard Error: 38_249 - .saturating_add(Weight::from_ref_time(155_243).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) - } - // Storage: Identity IdentityOf (r:1 w:0) - // Storage: Identity SuperOf (r:1 w:1) - // Storage: Identity SubsOf (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `509 + r * (57 ±0) + x * (66 ±0)` + // Estimated: `8265` + // Minimum execution time: 31_070 nanoseconds. + Weight::from_parts(48_354_843, 8265) + // Standard Error: 14_494 + .saturating_add(Weight::from_ref_time(1_136_000).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Identity SubsOf (r:1 w:1) + /// Proof: Identity SubsOf (max_values: None, max_size: Some(2106), added: 4581, mode: MaxEncodedLen) + /// Storage: Identity IdentityOf (r:1 w:1) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Identity SuperOf (r:0 w:64) + /// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + fn kill_identity(r: u32, s: u32, x: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `954 + r * (5 ±0) + s * (32 ±0) + x * (66 ±0)` + // Estimated: `17108` + // Minimum execution time: 75_910 nanoseconds. + Weight::from_parts(64_507_024, 17108) + // Standard Error: 253_244 + .saturating_add(Weight::from_ref_time(400_254).saturating_mul(r.into())) + // Standard Error: 29_488 + .saturating_add(Weight::from_ref_time(2_063_702).saturating_mul(s.into())) + // Standard Error: 29_488 + .saturating_add(Weight::from_ref_time(433_912).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: Identity IdentityOf (r:1 w:0) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + /// Storage: Identity SuperOf (r:1 w:1) + /// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + /// Storage: Identity SubsOf (r:1 w:1) + /// Proof: Identity SubsOf (max_values: None, max_size: Some(2106), added: 4581, mode: MaxEncodedLen) fn add_sub(s: u32) -> Weight { - Weight::from_ref_time(75_981_673) - // Standard Error: 32_552 - .saturating_add(Weight::from_ref_time(210_992).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Identity IdentityOf (r:1 w:0) - // Storage: Identity SuperOf (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `355 + s * (41 ±0)` + // Estimated: `14483` + // Minimum execution time: 40_220 nanoseconds. + Weight::from_parts(53_504_593, 14483) + // Standard Error: 10_817 + .saturating_add(Weight::from_ref_time(131_324).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Identity IdentityOf (r:1 w:0) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + /// Storage: Identity SuperOf (r:1 w:1) + /// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) fn rename_sub(s: u32) -> Weight { - Weight::from_ref_time(32_700_642) - // Standard Error: 7_890 - .saturating_add(Weight::from_ref_time(98_983).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Identity IdentityOf (r:1 w:0) - // Storage: Identity SuperOf (r:1 w:1) - // Storage: Identity SubsOf (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `464 + s * (7 ±0)` + // Estimated: `9902` + // Minimum execution time: 20_240 nanoseconds. + Weight::from_parts(25_667_761, 9902) + // Standard Error: 8_668 + .saturating_add(Weight::from_ref_time(86_610).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Identity IdentityOf (r:1 w:0) + /// Proof: Identity IdentityOf (max_values: None, max_size: Some(4838), added: 7313, mode: MaxEncodedLen) + /// Storage: Identity SuperOf (r:1 w:1) + /// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + /// Storage: Identity SubsOf (r:1 w:1) + /// Proof: Identity SubsOf (max_values: None, max_size: Some(2106), added: 4581, mode: MaxEncodedLen) fn remove_sub(s: u32) -> Weight { - Weight::from_ref_time(78_493_580) - // Standard Error: 35_462 - .saturating_add(Weight::from_ref_time(166_088).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Identity SuperOf (r:1 w:1) - // Storage: Identity SubsOf (r:1 w:1) - fn quit_sub(_s: u32) -> Weight { - Weight::from_ref_time(64_238_038) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `544 + s * (39 ±0)` + // Estimated: `14483` + // Minimum execution time: 44_900 nanoseconds. + Weight::from_parts(58_362_741, 14483) + // Standard Error: 10_560 + .saturating_add(Weight::from_ref_time(60_261).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Identity SuperOf (r:1 w:1) + /// Proof: Identity SuperOf (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen) + /// Storage: Identity SubsOf (r:1 w:1) + /// Proof: Identity SubsOf (max_values: None, max_size: Some(2106), added: 4581, mode: MaxEncodedLen) + fn quit_sub(s: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `469 + s * (42 ±0)` + // Estimated: `7170` + // Minimum execution time: 31_550 nanoseconds. + Weight::from_parts(40_548_052, 7170) + // Standard Error: 8_448 + .saturating_add(Weight::from_ref_time(83_481).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } } diff --git a/runtime/common/src/weights/pallet_membership.rs b/runtime/common/src/weights/pallet_membership.rs index 22c7f5c56..713341656 100644 --- a/runtime/common/src/weights/pallet_membership.rs +++ b/runtime/common/src/weights/pallet_membership.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_membership //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,77 +52,141 @@ use frame_support::{ /// Weight functions for pallet_membership (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_membership::weights::WeightInfo for WeightInfo { - // Storage: AdvisoryCommitteeMembership Members (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:0) - // Storage: AdvisoryCommittee Members (r:0 w:1) - // Storage: AdvisoryCommittee Prime (r:0 w:1) - fn add_member(_m: u32) -> Weight { - Weight::from_ref_time(55_911_099) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + /// Storage: AdvisoryCommitteeMembership Members (r:1 w:1) + /// Proof: AdvisoryCommitteeMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Proposals (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Members (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) + fn add_member(m: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `237 + m * (64 ±0)` + // Estimated: `4900 + m * (192 ±0)` + // Minimum execution time: 28_290 nanoseconds. + Weight::from_parts(35_685_233, 4900) + // Standard Error: 9_824 + .saturating_add(Weight::from_ref_time(79_139).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(192).saturating_mul(m.into())) } - // Storage: AdvisoryCommitteeMembership Members (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:0) - // Storage: AdvisoryCommitteeMembership Prime (r:1 w:0) - // Storage: AdvisoryCommittee Members (r:0 w:1) - // Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Storage: AdvisoryCommitteeMembership Members (r:1 w:1) + /// Proof: AdvisoryCommitteeMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Proposals (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommitteeMembership Prime (r:1 w:0) + /// Proof: AdvisoryCommitteeMembership Prime (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Members (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn remove_member(m: u32) -> Weight { - Weight::from_ref_time(51_116_109) - // Standard Error: 8_192 - .saturating_add(Weight::from_ref_time(60_364).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `341 + m * (64 ±0)` + // Estimated: `5739 + m * (192 ±0)` + // Minimum execution time: 33_260 nanoseconds. + Weight::from_parts(40_001_420, 5739) + // Standard Error: 4_422 + .saturating_add(Weight::from_ref_time(55_502).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(192).saturating_mul(m.into())) } - // Storage: AdvisoryCommitteeMembership Members (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:0) - // Storage: AdvisoryCommitteeMembership Prime (r:1 w:0) - // Storage: AdvisoryCommittee Members (r:0 w:1) - // Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Storage: AdvisoryCommitteeMembership Members (r:1 w:1) + /// Proof: AdvisoryCommitteeMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Proposals (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommitteeMembership Prime (r:1 w:0) + /// Proof: AdvisoryCommitteeMembership Prime (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Members (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn swap_member(m: u32) -> Weight { - Weight::from_ref_time(49_709_729) - // Standard Error: 6_277 - .saturating_add(Weight::from_ref_time(111_612).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `341 + m * (64 ±0)` + // Estimated: `5739 + m * (192 ±0)` + // Minimum execution time: 33_530 nanoseconds. + Weight::from_parts(40_652_820, 5739) + // Standard Error: 5_364 + .saturating_add(Weight::from_ref_time(76_219).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(192).saturating_mul(m.into())) } - // Storage: AdvisoryCommitteeMembership Members (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:0) - // Storage: AdvisoryCommitteeMembership Prime (r:1 w:0) - // Storage: AdvisoryCommittee Members (r:0 w:1) - // Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Storage: AdvisoryCommitteeMembership Members (r:1 w:1) + /// Proof: AdvisoryCommitteeMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Proposals (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommitteeMembership Prime (r:1 w:0) + /// Proof: AdvisoryCommitteeMembership Prime (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Members (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn reset_member(m: u32) -> Weight { - Weight::from_ref_time(49_088_026) - // Standard Error: 9_032 - .saturating_add(Weight::from_ref_time(299_091).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `341 + m * (64 ±0)` + // Estimated: `5739 + m * (192 ±0)` + // Minimum execution time: 32_460 nanoseconds. + Weight::from_parts(38_785_548, 5739) + // Standard Error: 6_043 + .saturating_add(Weight::from_ref_time(278_143).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(192).saturating_mul(m.into())) } - // Storage: AdvisoryCommitteeMembership Members (r:1 w:1) - // Storage: AdvisoryCommittee Proposals (r:1 w:0) - // Storage: AdvisoryCommitteeMembership Prime (r:1 w:1) - // Storage: AdvisoryCommittee Members (r:0 w:1) - // Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Storage: AdvisoryCommitteeMembership Members (r:1 w:1) + /// Proof: AdvisoryCommitteeMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Proposals (r:1 w:0) + /// Proof Skipped: AdvisoryCommittee Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommitteeMembership Prime (r:1 w:1) + /// Proof: AdvisoryCommitteeMembership Prime (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Members (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) fn change_key(m: u32) -> Weight { - Weight::from_ref_time(49_228_229) - // Standard Error: 9_250 - .saturating_add(Weight::from_ref_time(109_188).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(4)) + // Proof Size summary in bytes: + // Measured: `341 + m * (64 ±0)` + // Estimated: `5739 + m * (192 ±0)` + // Minimum execution time: 34_520 nanoseconds. + Weight::from_parts(43_530_038, 5739) + // Standard Error: 10_675 + .saturating_add(Weight::from_ref_time(71_445).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_proof_size(192).saturating_mul(m.into())) } - // Storage: AdvisoryCommitteeMembership Members (r:1 w:0) - // Storage: AdvisoryCommitteeMembership Prime (r:0 w:1) - // Storage: AdvisoryCommittee Prime (r:0 w:1) - fn set_prime(_m: u32) -> Weight { - Weight::from_ref_time(24_413_598) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + /// Storage: AdvisoryCommitteeMembership Members (r:1 w:0) + /// Proof: AdvisoryCommitteeMembership Members (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) + /// Storage: AdvisoryCommitteeMembership Prime (r:0 w:1) + /// Proof: AdvisoryCommitteeMembership Prime (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) + fn set_prime(m: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `136 + m * (32 ±0)` + // Estimated: `3833 + m * (32 ±0)` + // Minimum execution time: 15_240 nanoseconds. + Weight::from_parts(18_236_079, 3833) + // Standard Error: 2_638 + .saturating_add(Weight::from_ref_time(21_989).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(32).saturating_mul(m.into())) } - // Storage: AdvisoryCommitteeMembership Prime (r:0 w:1) - // Storage: AdvisoryCommittee Prime (r:0 w:1) - fn clear_prime(m: u32) -> Weight { - Weight::from_ref_time(11_575_303) - // Standard Error: 1_695 - .saturating_add(Weight::from_ref_time(4_887).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().writes(2)) + /// Storage: AdvisoryCommitteeMembership Prime (r:0 w:1) + /// Proof: AdvisoryCommitteeMembership Prime (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen) + /// Storage: AdvisoryCommittee Prime (r:0 w:1) + /// Proof Skipped: AdvisoryCommittee Prime (max_values: Some(1), max_size: None, mode: Measured) + fn clear_prime(_m: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_590 nanoseconds. + Weight::from_ref_time(6_974_592).saturating_add(T::DbWeight::get().writes(2_u64)) } } diff --git a/runtime/common/src/weights/pallet_multisig.rs b/runtime/common/src/weights/pallet_multisig.rs index 34838bc83..c285bbbe5 100644 --- a/runtime/common/src/weights/pallet_multisig.rs +++ b/runtime/common/src/weights/pallet_multisig.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_multisig //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -50,65 +53,98 @@ use frame_support::{ pub struct WeightInfo(PhantomData); impl pallet_multisig::weights::WeightInfo for WeightInfo { fn as_multi_threshold_1(z: u32) -> Weight { - Weight::from_ref_time(36_929_953) - // Standard Error: 65 - .saturating_add(Weight::from_ref_time(1_092).saturating_mul(z.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 17_510 nanoseconds. + Weight::from_ref_time(22_513_680) + // Standard Error: 72 + .saturating_add(Weight::from_ref_time(1_055).saturating_mul(z.into())) } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// Storage: Multisig Multisigs (r:1 w:1) + /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3350), added: 5825, mode: MaxEncodedLen) fn as_multi_create(s: u32, z: u32) -> Weight { - Weight::from_ref_time(63_719_080) - // Standard Error: 12_243 - .saturating_add(Weight::from_ref_time(257_990).saturating_mul(s.into())) - // Standard Error: 119 - .saturating_add(Weight::from_ref_time(2_956).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `303 + s * (1 ±0)` + // Estimated: `5825` + // Minimum execution time: 48_000 nanoseconds. + Weight::from_parts(54_977_016, 5825) + // Standard Error: 9_444 + .saturating_add(Weight::from_ref_time(41_852).saturating_mul(s.into())) + // Standard Error: 92 + .saturating_add(Weight::from_ref_time(2_453).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Multisig Multisigs (r:1 w:1) + /// Storage: Multisig Multisigs (r:1 w:1) + /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3350), added: 5825, mode: MaxEncodedLen) fn as_multi_approve(s: u32, z: u32) -> Weight { - Weight::from_ref_time(50_905_824) - // Standard Error: 10_798 - .saturating_add(Weight::from_ref_time(185_131).saturating_mul(s.into())) - // Standard Error: 105 - .saturating_add(Weight::from_ref_time(2_916).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `246` + // Estimated: `5825` + // Minimum execution time: 35_791 nanoseconds. + Weight::from_parts(40_752_558, 5825) + // Standard Error: 9_035 + .saturating_add(Weight::from_ref_time(40_991).saturating_mul(s.into())) + // Standard Error: 88 + .saturating_add(Weight::from_ref_time(2_340).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Multisig Multisigs (r:1 w:1) + /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3350), added: 5825, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn as_multi_complete(s: u32, z: u32) -> Weight { - Weight::from_ref_time(78_310_205) - // Standard Error: 14_374 - .saturating_add(Weight::from_ref_time(196_922).saturating_mul(s.into())) - // Standard Error: 140 - .saturating_add(Weight::from_ref_time(2_434).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `388 + s * (33 ±0)` + // Estimated: `8432` + // Minimum execution time: 57_500 nanoseconds. + Weight::from_parts(65_557_947, 8432) + // Standard Error: 17_739 + .saturating_add(Weight::from_ref_time(44_272).saturating_mul(s.into())) + // Standard Error: 173 + .saturating_add(Weight::from_ref_time(2_086).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// Storage: Multisig Multisigs (r:1 w:1) + /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3350), added: 5825, mode: MaxEncodedLen) fn approve_as_multi_create(s: u32) -> Weight { - Weight::from_ref_time(67_979_415) - // Standard Error: 15_370 - .saturating_add(Weight::from_ref_time(195_181).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `307 + s * (1 ±0)` + // Estimated: `5825` + // Minimum execution time: 37_550 nanoseconds. + Weight::from_parts(49_094_735, 5825) + // Standard Error: 12_276 + .saturating_add(Weight::from_ref_time(121_978).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Multisig Multisigs (r:1 w:1) + /// Storage: Multisig Multisigs (r:1 w:1) + /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3350), added: 5825, mode: MaxEncodedLen) fn approve_as_multi_approve(s: u32) -> Weight { - Weight::from_ref_time(51_759_537) - // Standard Error: 7_715 - .saturating_add(Weight::from_ref_time(129_743).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `246` + // Estimated: `5825` + // Minimum execution time: 26_680 nanoseconds. + Weight::from_parts(30_984_305, 5825) + // Standard Error: 6_780 + .saturating_add(Weight::from_ref_time(82_706).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Multisig Multisigs (r:1 w:1) + /// Storage: Multisig Multisigs (r:1 w:1) + /// Proof: Multisig Multisigs (max_values: None, max_size: Some(3350), added: 5825, mode: MaxEncodedLen) fn cancel_as_multi(s: u32) -> Weight { - Weight::from_ref_time(67_138_791) - // Standard Error: 14_867 - .saturating_add(Weight::from_ref_time(204_489).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `454 + s * (1 ±0)` + // Estimated: `5825` + // Minimum execution time: 40_801 nanoseconds. + Weight::from_parts(47_846_662, 5825) + // Standard Error: 7_468 + .saturating_add(Weight::from_ref_time(82_892).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_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 f1fa16d04..ef5084ceb 100644 --- a/runtime/common/src/weights/pallet_parachain_staking.rs +++ b/runtime/common/src/weights/pallet_parachain_staking.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_parachain_staking //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-20`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,367 +52,641 @@ use frame_support::{ /// Weight functions for pallet_parachain_staking (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_parachain_staking::weights::WeightInfo for WeightInfo { - // Storage: ParachainStaking InflationConfig (r:1 w:1) + /// Storage: ParachainStaking InflationConfig (r:1 w:1) + /// Proof Skipped: ParachainStaking InflationConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_staking_expectations() -> Weight { - Weight::from_ref_time(40_990_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: ParachainStaking InflationConfig (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `119` + // Estimated: `614` + // Minimum execution time: 17_450 nanoseconds. + Weight::from_parts(19_420_000, 614) + .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 { - Weight::from_ref_time(103_731_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: ParachainStaking ParachainBondInfo (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `119` + // Estimated: `614` + // Minimum execution time: 54_160 nanoseconds. + Weight::from_parts(66_410_000, 614) + .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 { - Weight::from_ref_time(36_860_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: ParachainStaking ParachainBondInfo (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `52` + // Estimated: `547` + // Minimum execution time: 15_690 nanoseconds. + Weight::from_parts(18_881_000, 547) + .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 { - Weight::from_ref_time(34_660_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: ParachainStaking TotalSelected (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `52` + // Estimated: `547` + // Minimum execution time: 13_480 nanoseconds. + Weight::from_parts(15_430_000, 547) + .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 { - Weight::from_ref_time(36_290_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: ParachainStaking CollatorCommission (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `28` + // Estimated: `523` + // Minimum execution time: 15_830 nanoseconds. + Weight::from_parts(16_920_000, 523) + .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 { - Weight::from_ref_time(32_030_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: ParachainStaking Round (r:1 w:1) - // Storage: ParachainStaking TotalSelected (r:1 w:0) - // Storage: ParachainStaking InflationConfig (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `27` + // Estimated: `522` + // Minimum execution time: 14_490 nanoseconds. + Weight::from_parts(16_890_000, 522) + .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) + /// Storage: ParachainStaking InflationConfig (r:1 w:1) + /// Proof Skipped: ParachainStaking InflationConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_blocks_per_round() -> Weight { - Weight::from_ref_time(94_490_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking DelegatorState (r:1 w:0) - // Storage: ParachainStaking CandidatePool (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) - // Storage: ParachainStaking TopDelegations (r:0 w:1) - // Storage: ParachainStaking BottomDelegations (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `147` + // Estimated: `1284` + // Minimum execution time: 66_770 nanoseconds. + Weight::from_parts(70_780_000, 1284) + .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) + /// Storage: ParachainStaking DelegatorState (r:1 w:0) + /// Proof Skipped: ParachainStaking DelegatorState (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) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, 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) fn join_candidates(x: u32) -> Weight { - Weight::from_ref_time(106_035_783) - // Standard Error: 3_265 - .saturating_add(Weight::from_ref_time(268_879).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(7)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) - // Storage: ParachainStaking CandidatePool (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `1898 + x * (49 ±0)` + // Estimated: `22371 + x * (300 ±0)` + // Minimum execution time: 60_351 nanoseconds. + Weight::from_parts(75_530_332, 22371) + // Standard Error: 2_331 + .saturating_add(Weight::from_ref_time(197_179).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(Weight::from_proof_size(300).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 schedule_leave_candidates(x: u32) -> Weight { - Weight::from_ref_time(65_831_978) - // Standard Error: 2_557 - .saturating_add(Weight::from_ref_time(213_969).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) - // Storage: ParachainStaking TopDelegations (r:1 w:1) - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: Balances Locks (r:2 w:2) - // Storage: System Account (r:2 w:2) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) - // Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:1) - // Storage: ParachainStaking BottomDelegations (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `990 + x * (48 ±0)` + // Estimated: `4794 + x * (98 ±0)` + // Minimum execution time: 27_140 nanoseconds. + Weight::from_parts(30_306_176, 4794) + // Standard Error: 1_948 + .saturating_add(Weight::from_ref_time(173_644).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(98).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 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) + /// Storage: System Account (r:350 w:350) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) + /// Proof Skipped: ParachainStaking DelegationScheduledRequests (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 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) fn execute_leave_candidates(x: u32) -> Weight { - Weight::from_ref_time(140_520_000) - // Standard Error: 158_815 - .saturating_add(Weight::from_ref_time(39_873_049).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `238 + x * (595 ±0)` + // Estimated: `18229 + x * (12995 ±0)` + // Minimum execution time: 100_960 nanoseconds. + Weight::from_parts(115_170_000, 18229) + // Standard Error: 151_085 + .saturating_add(Weight::from_ref_time(41_415_186).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(x.into()))) - .saturating_add(T::DbWeight::get().writes(5)) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(Weight::from_proof_size(12995).saturating_mul(x.into())) } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) + /// 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 cancel_leave_candidates(x: u32) -> Weight { - Weight::from_ref_time(54_524_144) - // Standard Error: 2_249 - .saturating_add(Weight::from_ref_time(222_440).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `946 + x * (48 ±0)` + // Estimated: `4704 + x * (98 ±0)` + // Minimum execution time: 26_340 nanoseconds. + Weight::from_parts(35_163_042, 4704) + // Standard Error: 1_923 + .saturating_add(Weight::from_ref_time(171_732).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(98).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 { - Weight::from_ref_time(49_040_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `371` + // Estimated: `3712` + // Minimum execution time: 28_560 nanoseconds. + Weight::from_parts(33_400_000, 3712) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_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) fn go_online() -> Weight { - Weight::from_ref_time(48_011_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `322` + // Estimated: `3614` + // Minimum execution time: 28_190 nanoseconds. + Weight::from_parts(34_510_000, 3614) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: ParachainStaking CandidateInfo (r:1 w:1) + /// Proof Skipped: ParachainStaking CandidateInfo (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: 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 { - Weight::from_ref_time(92_060_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `650` + // Estimated: `11796` + // Minimum execution time: 61_360 nanoseconds. + Weight::from_parts(73_000_000, 11796) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// 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 { - Weight::from_ref_time(48_040_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) - // Storage: ParachainStaking Total (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `216` + // Estimated: `2691` + // Minimum execution time: 23_200 nanoseconds. + Weight::from_parts(23_870_000, 2691) + .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 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: 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 { - Weight::from_ref_time(93_830_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: ParachainStaking CandidateInfo (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `670` + // Estimated: `11856` + // Minimum execution time: 53_870 nanoseconds. + Weight::from_parts(62_430_000, 11856) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// 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 { - Weight::from_ref_time(47_110_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: System Account (r:1 w:1) - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking TopDelegations (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `236` + // Estimated: `2711` + // Minimum execution time: 21_480 nanoseconds. + Weight::from_parts(22_500_000, 2711) + .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: 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) + /// 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: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: ParachainStaking Total (r:1 w:1) + /// Proof Skipped: ParachainStaking Total (max_values: Some(1), max_size: None, mode: Measured) fn delegate(x: u32, y: u32) -> Weight { - Weight::from_ref_time(110_347_088) - // Standard Error: 23_189 - .saturating_add(Weight::from_ref_time(487_718).saturating_mul(x.into())) - // Standard Error: 7_607 - .saturating_add(Weight::from_ref_time(296_818).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(7)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `2374 + x * (103 ±0) + y * (52 ±0)` + // Estimated: `25391 + x * (530 ±0) + y * (265 ±0)` + // Minimum execution time: 104_031 nanoseconds. + Weight::from_parts(93_820_718, 25391) + // Standard Error: 13_956 + .saturating_add(Weight::from_ref_time(349_185).saturating_mul(x.into())) + // Standard Error: 4_578 + .saturating_add(Weight::from_ref_time(193_605).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(Weight::from_proof_size(530).saturating_mul(x.into())) + .saturating_add(Weight::from_proof_size(265).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 { - Weight::from_ref_time(59_610_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking TopDelegations (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) - // Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:0) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `176` + // Estimated: `5302` + // Minimum execution time: 27_260 nanoseconds. + Weight::from_parts(30_230_000, 5302) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// 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) + /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidateInfo (r:99 w:99) + /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking TopDelegations (r:99 w:99) + /// 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) fn execute_leave_delegators(x: u32) -> Weight { - Weight::from_ref_time(128_231_000) - // Standard Error: 126_511 - .saturating_add(Weight::from_ref_time(33_070_806).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `755 + x * (558 ±0)` + // Estimated: `26542 + x * (13492 ±2)` + // Minimum execution time: 88_350 nanoseconds. + Weight::from_parts(8_859_687, 26542) + // Standard Error: 173_924 + .saturating_add(Weight::from_ref_time(34_595_003).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1_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((3_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(13492).saturating_mul(x.into())) } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) + /// 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 { - Weight::from_ref_time(62_711_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `298` + // Estimated: `5546` + // Minimum execution time: 28_540 nanoseconds. + Weight::from_parts(31_040_000, 5546) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_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 schedule_revoke_delegation() -> Weight { - Weight::from_ref_time(49_690_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:0) - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking TopDelegations (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `176` + // Estimated: `5302` + // Minimum execution time: 24_460 nanoseconds. + Weight::from_parts(29_720_000, 5302) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// 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) + /// 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) fn delegator_bond_more() -> Weight { - Weight::from_ref_time(106_200_000) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(7)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `1066` + // Estimated: `23667` + // Minimum execution time: 75_251 nanoseconds. + Weight::from_parts(95_650_000, 23667) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(7_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 schedule_delegator_bond_less() -> Weight { - Weight::from_ref_time(50_160_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:0) - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking TopDelegations (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `176` + // Estimated: `5302` + // Minimum execution time: 27_070 nanoseconds. + Weight::from_parts(32_830_000, 5302) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_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) + /// 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 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 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 { - Weight::from_ref_time(115_551_000) - .saturating_add(T::DbWeight::get().reads(10)) - .saturating_add(T::DbWeight::get().writes(8)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) - // Storage: ParachainStaking Round (r:1 w:0) - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: ParachainStaking TopDelegations (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `1243` + // Estimated: `28447` + // Minimum execution time: 91_870 nanoseconds. + Weight::from_parts(108_950_000, 28447) + .saturating_add(T::DbWeight::get().reads(9_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: 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) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// 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) fn execute_delegator_bond_less() -> Weight { - Weight::from_ref_time(121_371_000) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(8)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `1188` + // Estimated: `24399` + // Minimum execution time: 77_400 nanoseconds. + Weight::from_parts(94_280_000, 24399) + .saturating_add(T::DbWeight::get().reads(8_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) fn cancel_revoke_delegation() -> Weight { - Weight::from_ref_time(50_280_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `298` + // Estimated: `5546` + // Minimum execution time: 27_250 nanoseconds. + Weight::from_parts(32_621_000, 5546) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_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_delegator_bond_less() -> Weight { - Weight::from_ref_time(58_521_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: ParachainStaking Points (r:1 w:0) - // Storage: ParachainStaking Staked (r:1 w:1) - // Storage: ParachainStaking InflationConfig (r:1 w:0) - // Storage: ParachainStaking ParachainBondInfo (r:1 w:0) - // Storage: System Account (r:1 w:1) - // Storage: ParachainStaking CollatorCommission (r:1 w:0) - // Storage: ParachainStaking DelayedPayouts (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `298` + // Estimated: `5546` + // Minimum execution time: 27_100 nanoseconds. + Weight::from_parts(32_171_000, 5546) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: ParachainStaking Points (r:1 w:0) + /// Proof Skipped: ParachainStaking Points (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking Staked (r:1 w:1) + /// Proof Skipped: ParachainStaking Staked (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking InflationConfig (r:1 w:0) + /// Proof Skipped: ParachainStaking InflationConfig (max_values: Some(1), max_size: None, mode: Measured) + /// 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) + /// 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 { - Weight::from_ref_time(68_370_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:0) - // Storage: ParachainStaking TopDelegations (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `438` + // Estimated: `11670` + // Minimum execution time: 47_910 nanoseconds. + Weight::from_parts(62_160_000, 11670) + .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) + /// Storage: ParachainStaking TopDelegations (r:1 w:0) + /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) fn get_rewardable_delegators(y: u32) -> Weight { - Weight::from_ref_time(18_407_099) - // Standard Error: 4_044 - .saturating_add(Weight::from_ref_time(123_828).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(2)) - } - // Storage: ParachainStaking CandidatePool (r:1 w:0) - // Storage: ParachainStaking TotalSelected (r:1 w:0) - // Storage: ParachainStaking CandidateInfo (r:1 w:0) - // Storage: ParachainStaking DelegationScheduledRequests (r:1 w:0) - // Storage: ParachainStaking TopDelegations (r:1 w:0) - // Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:0) - // Storage: ParachainStaking SelectedCandidates (r:0 w:1) - // Storage: ParachainStaking AtStake (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `118 + y * (48 ±0)` + // Estimated: `5180 + y * (96 ±0)` + // Minimum execution time: 8_950 nanoseconds. + Weight::from_parts(10_639_265, 5180) + // Standard Error: 1_783 + .saturating_add(Weight::from_ref_time(87_488).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(Weight::from_proof_size(96).saturating_mul(y.into())) + } + /// Storage: ParachainStaking TotalSelected (r:1 w:0) + /// Proof Skipped: ParachainStaking TotalSelected (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidatePool (r:1 w:0) + /// Proof Skipped: ParachainStaking CandidatePool (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking CandidateInfo (r:51 w:0) + /// Proof Skipped: ParachainStaking CandidateInfo (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking DelegationScheduledRequests (r:51 w:0) + /// Proof Skipped: ParachainStaking DelegationScheduledRequests (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking TopDelegations (r:51 w:0) + /// Proof Skipped: ParachainStaking TopDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking AutoCompoundingDelegations (r:51 w:0) + /// Proof Skipped: ParachainStaking AutoCompoundingDelegations (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking SelectedCandidates (r:0 w:1) + /// Proof Skipped: ParachainStaking SelectedCandidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainStaking AtStake (r:0 w:51) + /// Proof Skipped: ParachainStaking AtStake (max_values: None, max_size: None, mode: Measured) fn select_top_candidates(x: u32, y: u32) -> Weight { - Weight::from_ref_time(44_960_000) - // Standard Error: 179_351 - .saturating_add(Weight::from_ref_time(28_562_191).saturating_mul(x.into())) - // Standard Error: 89_438 - .saturating_add(Weight::from_ref_time(3_026_421).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `0 + x * (5122 ±0) + y * (2400 ±0)` + // Estimated: `13898 + x * (26124 ±53) + y * (6816 ±26)` + // Minimum execution time: 31_540 nanoseconds. + Weight::from_parts(33_560_000, 13898) + // Standard Error: 171_541 + .saturating_add(Weight::from_ref_time(27_739_842).saturating_mul(x.into())) + // Standard Error: 85_543 + .saturating_add(Weight::from_ref_time(2_678_578).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((1_u64).saturating_mul(x.into()))) - } - // Storage: ParachainStaking DelayedPayouts (r:1 w:0) - // Storage: ParachainStaking Points (r:1 w:0) - // Storage: ParachainStaking AtStake (r:2 w:1) - // Storage: ParachainStaking AwardedPts (r:1 w:1) - // Storage: System Account (r:1 w:1) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(26124).saturating_mul(x.into())) + .saturating_add(Weight::from_proof_size(6816).saturating_mul(y.into())) + } + /// Storage: ParachainStaking DelayedPayouts (r:1 w:0) + /// Proof Skipped: ParachainStaking DelayedPayouts (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking Points (r:1 w:0) + /// Proof Skipped: ParachainStaking Points (max_values: None, max_size: None, mode: Measured) + /// Storage: ParachainStaking AtStake (r:2 w:1) + /// 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: System Account (r:301 w:301) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn pay_one_collator_reward(y: u32) -> Weight { - Weight::from_ref_time(67_927_525) - // Standard Error: 92_967 - .saturating_add(Weight::from_ref_time(19_813_862).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `485 + y * (219 ±0)` + // Estimated: `16898 + y * (3483 ±0)` + // Minimum execution time: 63_730 nanoseconds. + Weight::from_parts(5_351_340, 16898) + // Standard Error: 72_227 + .saturating_add(Weight::from_ref_time(19_826_040).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(6_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((1_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(3483).saturating_mul(y.into())) } - // Storage: ParachainStaking Round (r:1 w:0) fn base_on_initialize() -> Weight { - Weight::from_ref_time(12_210_000).saturating_add(T::DbWeight::get().reads(1)) - } - // Storage: ParachainStaking DelegatorState (r:1 w:0) - // Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_880 nanoseconds. + Weight::from_ref_time(2_300_000) + } + /// Storage: ParachainStaking DelegatorState (r:1 w:0) + /// Proof Skipped: ParachainStaking DelegatorState (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) fn set_auto_compound(x: u32, y: u32) -> Weight { - Weight::from_ref_time(58_451_779) - // Standard Error: 3_930 - .saturating_add(Weight::from_ref_time(198_503).saturating_mul(x.into())) - // Standard Error: 11_766 - .saturating_add(Weight::from_ref_time(211_110).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: System Account (r:1 w:1) - // Storage: ParachainStaking DelegatorState (r:1 w:1) - // Storage: ParachainStaking CandidateInfo (r:1 w:1) - // Storage: ParachainStaking AutoCompoundingDelegations (r:1 w:1) - // Storage: ParachainStaking TopDelegations (r:1 w:1) - // Storage: ParachainStaking CandidatePool (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: ParachainStaking Total (r:1 w:1) - // Storage: ParachainStaking BottomDelegations (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `718 + x * (34 ±0) + y * (48 ±0)` + // Estimated: `6134 + x * (70 ±0) + y * (98 ±0)` + // Minimum execution time: 37_070 nanoseconds. + Weight::from_parts(38_931_440, 6134) + // Standard Error: 1_774 + .saturating_add(Weight::from_ref_time(105_495).saturating_mul(x.into())) + // Standard Error: 5_312 + .saturating_add(Weight::from_ref_time(100_869).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(70).saturating_mul(x.into())) + .saturating_add(Weight::from_proof_size(98).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) + /// 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) + /// 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: 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) + /// 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(x: u32, y: u32, z: u32) -> Weight { - Weight::from_ref_time(123_727_512) - // Standard Error: 5_920 - .saturating_add(Weight::from_ref_time(189_919).saturating_mul(x.into())) - // Standard Error: 5_920 - .saturating_add(Weight::from_ref_time(85_340).saturating_mul(y.into())) - // Standard Error: 20_660 - .saturating_add(Weight::from_ref_time(351_236).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(8)) - } - // Storage: System Account (r:1 w:1) + // 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: 116_371 nanoseconds. + Weight::from_parts(88_321_494, 127262) + // Standard Error: 4_402 + .saturating_add(Weight::from_ref_time(248_247).saturating_mul(x.into())) + // Standard Error: 4_414 + .saturating_add(Weight::from_ref_time(42_668).saturating_mul(y.into())) + // Standard Error: 15_546 + .saturating_add(Weight::from_ref_time(322_386).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + .saturating_add(Weight::from_proof_size(367).saturating_mul(x.into())) + .saturating_add(Weight::from_proof_size(73).saturating_mul(y.into())) + .saturating_add(Weight::from_proof_size(230).saturating_mul(z.into())) + } + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn mint_collator_reward() -> Weight { - Weight::from_ref_time(50_830_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `139` + // Estimated: `2607` + // Minimum execution time: 20_740 nanoseconds. + Weight::from_parts(21_390_000, 2607) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/pallet_preimage.rs b/runtime/common/src/weights/pallet_preimage.rs index 6e35654da..d054a1e0c 100644 --- a/runtime/common/src/weights/pallet_preimage.rs +++ b/runtime/common/src/weights/pallet_preimage.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_preimage //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,88 +52,154 @@ use frame_support::{ /// Weight functions for pallet_preimage (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_preimage::weights::WeightInfo for WeightInfo { - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Preimage PreimageFor (r:0 w:1) + /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn note_preimage(s: u32) -> Weight { - Weight::from_ref_time(56_230_000) - // Standard Error: 8 - .saturating_add(Weight::from_ref_time(3_128).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `179` + // Estimated: `2566` + // Minimum execution time: 39_500 nanoseconds. + Weight::from_parts(43_130_000, 2566) + // Standard Error: 5 + .saturating_add(Weight::from_ref_time(3_100).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Preimage PreimageFor (r:0 w:1) + /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn note_requested_preimage(s: u32) -> Weight { - Weight::from_ref_time(41_390_000) - // Standard Error: 8 - .saturating_add(Weight::from_ref_time(3_154).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `2566` + // Minimum execution time: 26_460 nanoseconds. + Weight::from_parts(28_420_000, 2566) + // Standard Error: 5 + .saturating_add(Weight::from_ref_time(3_064).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Preimage PreimageFor (r:0 w:1) + /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn note_no_deposit_preimage(s: u32) -> Weight { - Weight::from_ref_time(39_160_000) - // Standard Error: 7 - .saturating_add(Weight::from_ref_time(3_123).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `2566` + // Minimum execution time: 25_700 nanoseconds. + Weight::from_parts(25_820_000, 2566) + // Standard Error: 5 + .saturating_add(Weight::from_ref_time(3_122).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Preimage PreimageFor (r:0 w:1) + /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn unnote_preimage() -> Weight { - Weight::from_ref_time(112_570_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `357` + // Estimated: `2566` + // Minimum execution time: 58_510 nanoseconds. + Weight::from_parts(68_820_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Preimage PreimageFor (r:0 w:1) + /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn unnote_no_deposit_preimage() -> Weight { - Weight::from_ref_time(83_560_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `144` + // Estimated: `2566` + // Minimum execution time: 43_320 nanoseconds. + Weight::from_parts(51_221_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_preimage() -> Weight { - Weight::from_ref_time(78_500_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `220` + // Estimated: `2566` + // Minimum execution time: 40_470 nanoseconds. + Weight::from_parts(47_190_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_no_deposit_preimage() -> Weight { - Weight::from_ref_time(47_780_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `144` + // Estimated: `2566` + // Minimum execution time: 25_250 nanoseconds. + Weight::from_parts(32_000_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_unnoted_preimage() -> Weight { - Weight::from_ref_time(80_300_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `2566` + // Minimum execution time: 32_140 nanoseconds. + Weight::from_parts(41_680_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn request_requested_preimage() -> Weight { - Weight::from_ref_time(21_190_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `2566` + // Minimum execution time: 14_850 nanoseconds. + Weight::from_parts(16_230_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Preimage PreimageFor (r:0 w:1) + /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen) fn unrequest_preimage() -> Weight { - Weight::from_ref_time(76_891_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `144` + // Estimated: `2566` + // Minimum execution time: 42_320 nanoseconds. + Weight::from_parts(48_090_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn unrequest_unnoted_preimage() -> Weight { - Weight::from_ref_time(21_810_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `2566` + // Minimum execution time: 15_460 nanoseconds. + Weight::from_parts(17_840_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn unrequest_multi_referenced_preimage() -> Weight { - Weight::from_ref_time(21_410_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `2566` + // Minimum execution time: 15_400 nanoseconds. + Weight::from_parts(18_930_000, 2566) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/pallet_proxy.rs b/runtime/common/src/weights/pallet_proxy.rs index 47f831231..160226a01 100644 --- a/runtime/common/src/weights/pallet_proxy.rs +++ b/runtime/common/src/weights/pallet_proxy.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_proxy //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,92 +52,141 @@ use frame_support::{ /// Weight functions for pallet_proxy (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_proxy::weights::WeightInfo for WeightInfo { - // Storage: Proxy Proxies (r:1 w:0) + /// Storage: Proxy Proxies (r:1 w:0) + /// Proof: Proxy Proxies (max_values: None, max_size: Some(1369), added: 3844, mode: MaxEncodedLen) fn proxy(p: u32) -> Weight { - Weight::from_ref_time(45_430_273) - // Standard Error: 16_376 - .saturating_add(Weight::from_ref_time(170_989).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(1)) + // Proof Size summary in bytes: + // Measured: `122 + p * (41 ±0)` + // Estimated: `3844` + // Minimum execution time: 20_750 nanoseconds. + Weight::from_parts(26_214_665, 3844) + // Standard Error: 13_389 + .saturating_add(Weight::from_ref_time(66_184).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) } - // Storage: Proxy Proxies (r:1 w:0) - // Storage: Proxy Announcements (r:1 w:1) - // Storage: System Account (r:1 w:1) - fn proxy_announced(a: u32, _p: u32) -> Weight { - Weight::from_ref_time(81_336_808) - // Standard Error: 39_634 - .saturating_add(Weight::from_ref_time(132_877).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) + /// Storage: Proxy Proxies (r:1 w:0) + /// Proof: Proxy Proxies (max_values: None, max_size: Some(1369), added: 3844, mode: MaxEncodedLen) + /// Storage: Proxy Announcements (r:1 w:1) + /// Proof: Proxy Announcements (max_values: None, max_size: Some(2361), added: 4836, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn proxy_announced(a: u32, p: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `521 + a * (72 ±0) + p * (41 ±0)` + // Estimated: `11287` + // Minimum execution time: 47_440 nanoseconds. + Weight::from_parts(60_567_287, 11287) + // Standard Error: 27_284 + .saturating_add(Weight::from_ref_time(100_013).saturating_mul(a.into())) + // Standard Error: 28_190 + .saturating_add(Weight::from_ref_time(2_765).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Proxy Announcements (r:1 w:1) - // Storage: System Account (r:1 w:1) - fn remove_announcement(a: u32, p: u32) -> Weight { - Weight::from_ref_time(47_073_348) - // Standard Error: 24_794 - .saturating_add(Weight::from_ref_time(390_421).saturating_mul(a.into())) - // Standard Error: 25_617 - .saturating_add(Weight::from_ref_time(91_176).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + /// Storage: Proxy Announcements (r:1 w:1) + /// Proof: Proxy Announcements (max_values: None, max_size: Some(2361), added: 4836, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn remove_announcement(a: u32, _p: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `404 + a * (72 ±0)` + // Estimated: `7443` + // Minimum execution time: 28_060 nanoseconds. + Weight::from_parts(37_408_718, 7443) + // Standard Error: 18_090 + .saturating_add(Weight::from_ref_time(103_057).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Proxy Announcements (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Proxy Announcements (r:1 w:1) + /// Proof: Proxy Announcements (max_values: None, max_size: Some(2361), added: 4836, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reject_announcement(a: u32, _p: u32) -> Weight { - Weight::from_ref_time(57_836_563) - // Standard Error: 21_558 - .saturating_add(Weight::from_ref_time(203_004).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `404 + a * (72 ±0)` + // Estimated: `7443` + // Minimum execution time: 28_210 nanoseconds. + Weight::from_parts(38_345_310, 7443) + // Standard Error: 16_574 + .saturating_add(Weight::from_ref_time(165_716).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Proxy Proxies (r:1 w:0) - // Storage: Proxy Announcements (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Proxy Proxies (r:1 w:0) + /// Proof: Proxy Proxies (max_values: None, max_size: Some(1369), added: 3844, mode: MaxEncodedLen) + /// Storage: Proxy Announcements (r:1 w:1) + /// Proof: Proxy Announcements (max_values: None, max_size: Some(2361), added: 4836, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn announce(a: u32, _p: u32) -> Weight { - Weight::from_ref_time(77_933_386) - // Standard Error: 31_635 - .saturating_add(Weight::from_ref_time(128_801).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `449 + a * (72 ±0) + p * (41 ±0)` + // Estimated: `11287` + // Minimum execution time: 40_250 nanoseconds. + Weight::from_parts(53_247_454, 11287) + // Standard Error: 21_381 + .saturating_add(Weight::from_ref_time(116_995).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Proxy Proxies (r:1 w:1) + /// Storage: Proxy Proxies (r:1 w:1) + /// Proof: Proxy Proxies (max_values: None, max_size: Some(1369), added: 3844, mode: MaxEncodedLen) fn add_proxy(p: u32) -> Weight { - Weight::from_ref_time(56_713_436) - // Standard Error: 22_905 - .saturating_add(Weight::from_ref_time(213_098).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `122 + p * (41 ±0)` + // Estimated: `3844` + // Minimum execution time: 30_200 nanoseconds. + Weight::from_parts(35_645_380, 3844) + // Standard Error: 20_941 + .saturating_add(Weight::from_ref_time(202_965).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Proxy Proxies (r:1 w:1) - fn remove_proxy(p: u32) -> Weight { - Weight::from_ref_time(60_721_471) - // Standard Error: 45_816 - .saturating_add(Weight::from_ref_time(163_780).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + /// Storage: Proxy Proxies (r:1 w:1) + /// Proof: Proxy Proxies (max_values: None, max_size: Some(1369), added: 3844, mode: MaxEncodedLen) + fn remove_proxy(_p: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `122 + p * (41 ±0)` + // Estimated: `3844` + // Minimum execution time: 29_920 nanoseconds. + Weight::from_parts(41_304_838, 3844) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Proxy Proxies (r:1 w:1) + /// Storage: Proxy Proxies (r:1 w:1) + /// Proof: Proxy Proxies (max_values: None, max_size: Some(1369), added: 3844, mode: MaxEncodedLen) fn remove_proxies(p: u32) -> Weight { - Weight::from_ref_time(50_358_662) - // Standard Error: 23_696 - .saturating_add(Weight::from_ref_time(82_661).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `122 + p * (41 ±0)` + // Estimated: `3844` + // Minimum execution time: 24_330 nanoseconds. + Weight::from_parts(30_122_952, 3844) + // Standard Error: 12_920 + .saturating_add(Weight::from_ref_time(42_769).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - // Storage: Proxy Proxies (r:1 w:1) - fn create_pure(p: u32) -> Weight { - Weight::from_ref_time(62_497_769) - // Standard Error: 26_171 - .saturating_add(Weight::from_ref_time(34_287).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + /// Storage: Proxy Proxies (r:1 w:1) + /// Proof: Proxy Proxies (max_values: None, max_size: Some(1369), added: 3844, mode: MaxEncodedLen) + fn create_pure(_p: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `102` + // Estimated: `3844` + // Minimum execution time: 31_670 nanoseconds. + Weight::from_parts(40_185_113, 3844) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Proxy Proxies (r:1 w:1) - fn kill_pure(p: u32) -> Weight { - Weight::from_ref_time(51_548_294) - // Standard Error: 19_850 - .saturating_add(Weight::from_ref_time(337_485).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + /// Storage: Proxy Proxies (r:1 w:1) + /// Proof: Proxy Proxies (max_values: None, max_size: Some(1369), added: 3844, mode: MaxEncodedLen) + fn kill_pure(_p: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `163 + p * (41 ±0)` + // Estimated: `3844` + // Minimum execution time: 25_800 nanoseconds. + Weight::from_parts(34_349_516, 3844) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/common/src/weights/pallet_scheduler.rs b/runtime/common/src/weights/pallet_scheduler.rs index 0c8e66e01..569e8b4f6 100644 --- a/runtime/common/src/weights/pallet_scheduler.rs +++ b/runtime/common/src/weights/pallet_scheduler.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_scheduler //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,78 +52,139 @@ use frame_support::{ /// Weight functions for pallet_scheduler (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_scheduler::weights::WeightInfo for WeightInfo { - // Storage: Scheduler IncompleteSince (r:1 w:1) + /// Storage: Scheduler IncompleteSince (r:1 w:1) + /// Proof: Scheduler IncompleteSince (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) fn service_agendas_base() -> Weight { - Weight::from_ref_time(11_880_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `35` + // Estimated: `503` + // Minimum execution time: 6_030 nanoseconds. + Weight::from_parts(6_340_000, 503) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Scheduler Agenda (r:1 w:1) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(10667), added: 13142, mode: MaxEncodedLen) fn service_agenda_base(s: u32) -> Weight { - Weight::from_ref_time(18_660_144) - // Standard Error: 10_642 - .saturating_add(Weight::from_ref_time(592_343).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `114 + s * (181 ±0)` + // Estimated: `13142` + // Minimum execution time: 5_421 nanoseconds. + Weight::from_parts(15_044_319, 13142) + // Standard Error: 12_339 + .saturating_add(Weight::from_ref_time(540_060).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn service_task_base() -> Weight { - Weight::from_ref_time(23_750_000) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_170 nanoseconds. + Weight::from_ref_time(8_980_000) } - // Storage: Preimage PreimageFor (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Preimage PreimageFor (r:1 w:1) + /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: Measured) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn service_task_fetched(s: u32) -> Weight { - Weight::from_ref_time(51_490_000) - // Standard Error: 7 - .saturating_add(Weight::from_ref_time(2_301).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `211 + s * (1 ±0)` + // Estimated: `5252 + s * (1 ±0)` + // Minimum execution time: 31_080 nanoseconds. + Weight::from_parts(31_610_000, 5252) + // Standard Error: 6 + .saturating_add(Weight::from_ref_time(2_338).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(1).saturating_mul(s.into())) } - // Storage: Scheduler Lookup (r:0 w:1) + /// Storage: Scheduler Lookup (r:0 w:1) + /// Proof: Scheduler Lookup (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) fn service_task_named() -> Weight { - Weight::from_ref_time(22_690_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_210 nanoseconds. + Weight::from_ref_time(12_680_000).saturating_add(T::DbWeight::get().writes(1_u64)) } fn service_task_periodic() -> Weight { - Weight::from_ref_time(24_121_000) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_900 nanoseconds. + Weight::from_ref_time(10_260_000) } fn execute_dispatch_signed() -> Weight { - Weight::from_ref_time(9_010_000) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_880 nanoseconds. + Weight::from_ref_time(4_510_000) } fn execute_dispatch_unsigned() -> Weight { - Weight::from_ref_time(8_660_000) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_520 nanoseconds. + Weight::from_ref_time(4_300_000) } - // Storage: Scheduler Agenda (r:1 w:1) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(10667), added: 13142, mode: MaxEncodedLen) fn schedule(s: u32) -> Weight { - Weight::from_ref_time(46_100_804) - // Standard Error: 17_237 - .saturating_add(Weight::from_ref_time(678_601).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `114 + s * (181 ±0)` + // Estimated: `13142` + // Minimum execution time: 18_890 nanoseconds. + Weight::from_parts(31_761_368, 13142) + // Standard Error: 12_745 + .saturating_add(Weight::from_ref_time(582_142).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Scheduler Agenda (r:1 w:1) - // Storage: Scheduler Lookup (r:0 w:1) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(10667), added: 13142, mode: MaxEncodedLen) + /// Storage: Scheduler Lookup (r:0 w:1) + /// Proof: Scheduler Lookup (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) fn cancel(s: u32) -> Weight { - Weight::from_ref_time(51_657_945) - // Standard Error: 40_641 - .saturating_add(Weight::from_ref_time(893_452).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `114 + s * (181 ±0)` + // Estimated: `13142` + // Minimum execution time: 26_840 nanoseconds. + Weight::from_parts(30_383_746, 13142) + // Standard Error: 24_905 + .saturating_add(Weight::from_ref_time(904_743).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Scheduler Lookup (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:1) + /// Storage: Scheduler Lookup (r:1 w:1) + /// Proof: Scheduler Lookup (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(10667), added: 13142, mode: MaxEncodedLen) fn schedule_named(s: u32) -> Weight { - Weight::from_ref_time(53_301_422) - // Standard Error: 19_662 - .saturating_add(Weight::from_ref_time(680_204).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `297 + s * (189 ±0)` + // Estimated: `15669` + // Minimum execution time: 25_130 nanoseconds. + Weight::from_parts(38_669_389, 15669) + // Standard Error: 14_406 + .saturating_add(Weight::from_ref_time(629_425).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Scheduler Lookup (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:1) + /// Storage: Scheduler Lookup (r:1 w:1) + /// Proof: Scheduler Lookup (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(10667), added: 13142, mode: MaxEncodedLen) fn cancel_named(s: u32) -> Weight { - Weight::from_ref_time(52_033_355) - // Standard Error: 51_001 - .saturating_add(Weight::from_ref_time(1_093_929).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `321 + s * (189 ±0)` + // Estimated: `15669` + // Minimum execution time: 29_960 nanoseconds. + Weight::from_parts(37_063_103, 15669) + // Standard Error: 27_105 + .saturating_add(Weight::from_ref_time(848_431).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } } diff --git a/runtime/common/src/weights/pallet_timestamp.rs b/runtime/common/src/weights/pallet_timestamp.rs index 66be5ef24..f601de2b2 100644 --- a/runtime/common/src/weights/pallet_timestamp.rs +++ b/runtime/common/src/weights/pallet_timestamp.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,14 +52,24 @@ use frame_support::{ /// Weight functions for pallet_timestamp (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_timestamp::weights::WeightInfo for WeightInfo { - // Storage: Timestamp Now (r:1 w:1) - // Storage: Aura CurrentSlot (r:1 w:0) + /// Storage: Timestamp Now (r:1 w:1) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Aura CurrentSlot (r:1 w:0) + /// Proof: Aura CurrentSlot (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) fn set() -> Weight { - Weight::from_ref_time(28_450_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `256` + // Estimated: `1006` + // Minimum execution time: 22_740 nanoseconds. + Weight::from_parts(28_510_000, 1006) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn on_finalize() -> Weight { - Weight::from_ref_time(11_150_000) + // Proof Size summary in bytes: + // Measured: `128` + // Estimated: `0` + // Minimum execution time: 8_690 nanoseconds. + Weight::from_ref_time(8_880_000) } } diff --git a/runtime/common/src/weights/pallet_treasury.rs b/runtime/common/src/weights/pallet_treasury.rs index e017457cc..6975ca689 100644 --- a/runtime/common/src/weights/pallet_treasury.rs +++ b/runtime/common/src/weights/pallet_treasury.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_treasury //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,56 +52,96 @@ use frame_support::{ /// Weight functions for pallet_treasury (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_treasury::weights::WeightInfo for WeightInfo { - // Storage: Treasury ProposalCount (r:1 w:1) - // Storage: Treasury Approvals (r:1 w:1) - // Storage: Treasury Proposals (r:0 w:1) + /// Storage: Treasury ProposalCount (r:1 w:1) + /// Proof: Treasury ProposalCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Treasury Approvals (r:1 w:1) + /// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) + /// Storage: Treasury Proposals (r:0 w:1) + /// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) fn spend() -> Weight { - Weight::from_ref_time(38_000_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `1396` + // Minimum execution time: 23_110 nanoseconds. + Weight::from_parts(28_271_000, 1396) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Treasury ProposalCount (r:1 w:1) - // Storage: Treasury Proposals (r:0 w:1) + /// Storage: Treasury ProposalCount (r:1 w:1) + /// Proof: Treasury ProposalCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Treasury Proposals (r:0 w:1) + /// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) fn propose_spend() -> Weight { - Weight::from_ref_time(47_441_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `179` + // Estimated: `499` + // Minimum execution time: 38_230 nanoseconds. + Weight::from_parts(45_180_000, 499) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Treasury Proposals (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Treasury Proposals (r:1 w:1) + /// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reject_proposal() -> Weight { - Weight::from_ref_time(66_720_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `545` + // Estimated: `7797` + // Minimum execution time: 56_670 nanoseconds. + Weight::from_parts(58_110_000, 7797) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Treasury Proposals (r:1 w:0) - // Storage: Treasury Approvals (r:1 w:1) + /// Storage: Treasury Proposals (r:1 w:0) + /// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + /// Storage: Treasury Approvals (r:1 w:1) + /// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) fn approve_proposal(p: u32) -> Weight { - Weight::from_ref_time(27_037_020) - // Standard Error: 6_404 - .saturating_add(Weight::from_ref_time(271_419).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `500 + p * (8 ±0)` + // Estimated: `3480` + // Minimum execution time: 16_440 nanoseconds. + Weight::from_parts(24_466_536, 3480) + // Standard Error: 5_719 + .saturating_add(Weight::from_ref_time(7_361).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Treasury Approvals (r:1 w:1) + /// Storage: Treasury Approvals (r:1 w:1) + /// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) fn remove_approval() -> Weight { - Weight::from_ref_time(33_281_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `127` + // Estimated: `897` + // Minimum execution time: 13_300 nanoseconds. + Weight::from_parts(13_990_000, 897) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: System Account (r:1 w:1) - // Storage: Treasury Deactivated (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:1) - // Storage: Treasury Approvals (r:1 w:1) - // Storage: Bounties BountyApprovals (r:1 w:1) - // Storage: Treasury Proposals (r:2 w:2) + /// Storage: System Account (r:201 w:201) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Treasury Deactivated (r:1 w:1) + /// Proof: Treasury Deactivated (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:1) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Treasury Approvals (r:1 w:1) + /// Proof: Treasury Approvals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) + /// Storage: Treasury Proposals (r:100 w:100) + /// Proof: Treasury Proposals (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + /// Storage: Bounties BountyApprovals (r:1 w:1) + /// Proof: Bounties BountyApprovals (max_values: Some(1), max_size: Some(402), added: 897, mode: MaxEncodedLen) fn on_initialize_proposals(p: u32) -> Weight { - Weight::from_ref_time(94_784_571) - // Standard Error: 313_454 - .saturating_add(Weight::from_ref_time(48_850_989).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(4)) + // Proof Size summary in bytes: + // Measured: `383 + p * (318 ±0)` + // Estimated: `5423 + p * (7797 ±0)` + // Minimum execution time: 63_181 nanoseconds. + Weight::from_parts(88_775_191, 5423) + // Standard Error: 330_024 + .saturating_add(Weight::from_ref_time(46_475_971).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(p.into()))) - .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(Weight::from_proof_size(7797).saturating_mul(p.into())) } } diff --git a/runtime/common/src/weights/pallet_utility.rs b/runtime/common/src/weights/pallet_utility.rs index 8fa2fed0a..b4b142dd3 100644 --- a/runtime/common/src/weights/pallet_utility.rs +++ b/runtime/common/src/weights/pallet_utility.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_utility //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -50,24 +53,44 @@ use frame_support::{ pub struct WeightInfo(PhantomData); impl pallet_utility::weights::WeightInfo for WeightInfo { fn batch(c: u32) -> Weight { - Weight::from_ref_time(58_239_300) - // Standard Error: 67_448 - .saturating_add(Weight::from_ref_time(7_264_706).saturating_mul(c.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 11_120 nanoseconds. + Weight::from_ref_time(57_937_255) + // Standard Error: 47_371 + .saturating_add(Weight::from_ref_time(6_567_198).saturating_mul(c.into())) } fn as_derivative() -> Weight { - Weight::from_ref_time(14_790_000) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_060 nanoseconds. + Weight::from_ref_time(8_530_000) } fn batch_all(c: u32) -> Weight { - Weight::from_ref_time(71_049_100) - // Standard Error: 36_692 - .saturating_add(Weight::from_ref_time(7_366_227).saturating_mul(c.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 12_200 nanoseconds. + Weight::from_ref_time(61_059_264) + // Standard Error: 82_792 + .saturating_add(Weight::from_ref_time(6_833_403).saturating_mul(c.into())) } fn dispatch_as() -> Weight { - Weight::from_ref_time(34_180_000) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 14_500 nanoseconds. + Weight::from_ref_time(17_151_000) } fn force_batch(c: u32) -> Weight { - Weight::from_ref_time(42_443_655) - // Standard Error: 30_677 - .saturating_add(Weight::from_ref_time(7_153_347).saturating_mul(c.into())) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_320 nanoseconds. + Weight::from_ref_time(90_747_111) + // Standard Error: 25_070 + .saturating_add(Weight::from_ref_time(6_573_723).saturating_mul(c.into())) } } diff --git a/runtime/common/src/weights/pallet_vesting.rs b/runtime/common/src/weights/pallet_vesting.rs index 791b82d51..815386f29 100644 --- a/runtime/common/src/weights/pallet_vesting.rs +++ b/runtime/common/src/weights/pallet_vesting.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for pallet_vesting //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/frame_weight_template.hbs +// --header=./HEADER_GPL3 // --output=./runtime/common/src/weights/ #![allow(unused_parens)] @@ -49,86 +52,148 @@ use frame_support::{ /// Weight functions for pallet_vesting (automatically generated) pub struct WeightInfo(PhantomData); impl pallet_vesting::weights::WeightInfo for WeightInfo { - // Storage: Vesting Vesting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Vesting Vesting (r:1 w:1) + /// Proof: Vesting Vesting (max_values: None, max_size: Some(1169), added: 3644, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn vest_locked(l: u32, s: u32) -> Weight { - Weight::from_ref_time(67_772_711) - // Standard Error: 24_976 - .saturating_add(Weight::from_ref_time(116_226).saturating_mul(l.into())) - // Standard Error: 44_437 - .saturating_add(Weight::from_ref_time(318_658).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `405 + l * (25 ±0) + s * (40 ±0)` + // Estimated: `7418` + // Minimum execution time: 38_600 nanoseconds. + Weight::from_parts(43_587_531, 7418) + // Standard Error: 15_831 + .saturating_add(Weight::from_ref_time(68_812).saturating_mul(l.into())) + // Standard Error: 28_166 + .saturating_add(Weight::from_ref_time(85_553).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Vesting Vesting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - fn vest_unlocked(_l: u32, s: u32) -> Weight { - Weight::from_ref_time(81_734_827) - // Standard Error: 42_951 - .saturating_add(Weight::from_ref_time(56_221).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + /// Storage: Vesting Vesting (r:1 w:1) + /// Proof: Vesting Vesting (max_values: None, max_size: Some(1169), added: 3644, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + fn vest_unlocked(l: u32, s: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `405 + l * (25 ±0) + s * (40 ±0)` + // Estimated: `7418` + // Minimum execution time: 38_721 nanoseconds. + Weight::from_parts(40_131_560, 7418) + // Standard Error: 12_751 + .saturating_add(Weight::from_ref_time(153_614).saturating_mul(l.into())) + // Standard Error: 22_687 + .saturating_add(Weight::from_ref_time(106_312).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Vesting Vesting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) - fn vest_other_locked(_l: u32, s: u32) -> Weight { - Weight::from_ref_time(74_636_848) - // Standard Error: 30_247 - .saturating_add(Weight::from_ref_time(120_555).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + /// Storage: Vesting Vesting (r:1 w:1) + /// Proof: Vesting Vesting (max_values: None, max_size: Some(1169), added: 3644, mode: MaxEncodedLen) + /// 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) + fn vest_other_locked(l: u32, s: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `544 + l * (25 ±0) + s * (40 ±0)` + // Estimated: `10025` + // Minimum execution time: 43_470 nanoseconds. + Weight::from_parts(49_859_247, 10025) + // Standard Error: 17_297 + .saturating_add(Weight::from_ref_time(82_500).saturating_mul(l.into())) + // Standard Error: 30_776 + .saturating_add(Weight::from_ref_time(131_073).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Vesting Vesting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) - fn vest_other_unlocked(l: u32, s: u32) -> Weight { - Weight::from_ref_time(71_174_075) - // Standard Error: 18_317 - .saturating_add(Weight::from_ref_time(79_995).saturating_mul(l.into())) - // Standard Error: 32_589 - .saturating_add(Weight::from_ref_time(169_250).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + /// Storage: Vesting Vesting (r:1 w:1) + /// Proof: Vesting Vesting (max_values: None, max_size: Some(1169), added: 3644, mode: MaxEncodedLen) + /// 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) + fn vest_other_unlocked(l: u32, _s: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `544 + l * (25 ±0) + s * (40 ±0)` + // Estimated: `10025` + // Minimum execution time: 44_220 nanoseconds. + Weight::from_parts(54_622_024, 10025) + // Standard Error: 13_957 + .saturating_add(Weight::from_ref_time(64_053).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Vesting Vesting (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Vesting Vesting (r:1 w:1) + /// Proof: Vesting Vesting (max_values: None, max_size: Some(1169), added: 3644, mode: MaxEncodedLen) + /// 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) fn vested_transfer(l: u32, _s: u32) -> Weight { - Weight::from_ref_time(102_807_286) - // Standard Error: 24_089 - .saturating_add(Weight::from_ref_time(89_315).saturating_mul(l.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `615 + l * (25 ±0) + s * (40 ±0)` + // Estimated: `10025` + // Minimum execution time: 63_530 nanoseconds. + Weight::from_parts(81_340_929, 10025) + // Standard Error: 24_465 + .saturating_add(Weight::from_ref_time(43_600).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Vesting Vesting (r:1 w:1) - // Storage: System Account (r:2 w:2) - // Storage: Balances Locks (r:1 w:1) - fn force_vested_transfer(_l: u32, _s: u32) -> Weight { - Weight::from_ref_time(110_346_038) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + /// Storage: Vesting Vesting (r:1 w:1) + /// Proof: Vesting Vesting (max_values: None, max_size: Some(1169), added: 3644, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// 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) + fn force_vested_transfer(l: u32, s: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `754 + l * (25 ±0) + s * (40 ±0)` + // Estimated: `12632` + // Minimum execution time: 67_830 nanoseconds. + Weight::from_parts(77_854_612, 12632) + // Standard Error: 27_906 + .saturating_add(Weight::from_ref_time(72_280).saturating_mul(l.into())) + // Standard Error: 49_651 + .saturating_add(Weight::from_ref_time(135_728).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } - // Storage: Vesting Vesting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Vesting Vesting (r:1 w:1) + /// Proof: Vesting Vesting (max_values: None, max_size: Some(1169), added: 3644, mode: MaxEncodedLen) + /// 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) fn not_unlocking_merge_schedules(l: u32, s: u32) -> Weight { - Weight::from_ref_time(79_783_352) - // Standard Error: 26_074 - .saturating_add(Weight::from_ref_time(28_030).saturating_mul(l.into())) - // Standard Error: 48_152 - .saturating_add(Weight::from_ref_time(9_317).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `542 + l * (25 ±0) + s * (40 ±0)` + // Estimated: `10025` + // Minimum execution time: 45_830 nanoseconds. + Weight::from_parts(50_112_392, 10025) + // Standard Error: 16_706 + .saturating_add(Weight::from_ref_time(88_312).saturating_mul(l.into())) + // Standard Error: 30_853 + .saturating_add(Weight::from_ref_time(115_089).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Vesting Vesting (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Vesting Vesting (r:1 w:1) + /// Proof: Vesting Vesting (max_values: None, max_size: Some(1169), added: 3644, mode: MaxEncodedLen) + /// 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) fn unlocking_merge_schedules(l: u32, s: u32) -> Weight { - Weight::from_ref_time(72_755_600) - // Standard Error: 19_705 - .saturating_add(Weight::from_ref_time(89_673).saturating_mul(l.into())) - // Standard Error: 36_390 - .saturating_add(Weight::from_ref_time(144_540).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `542 + l * (25 ±0) + s * (40 ±0)` + // Estimated: `10025` + // Minimum execution time: 45_530 nanoseconds. + Weight::from_parts(45_481_538, 10025) + // Standard Error: 13_332 + .saturating_add(Weight::from_ref_time(273_701).saturating_mul(l.into())) + // Standard Error: 24_620 + .saturating_add(Weight::from_ref_time(164_319).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } } diff --git a/runtime/zeitgeist/Cargo.toml b/runtime/zeitgeist/Cargo.toml index d1771f947..93b1906bd 100644 --- a/runtime/zeitgeist/Cargo.toml +++ b/runtime/zeitgeist/Cargo.toml @@ -111,6 +111,7 @@ zrml-court = { workspace = true } zrml-global-disputes = { workspace = true, optional = true } zrml-liquidity-mining = { workspace = true } zrml-market-commons = { workspace = true } +zrml-neo-swaps = { workspace = true } zrml-orderbook-v1 = { workspace = true } zrml-prediction-markets = { workspace = true } zrml-rikiddo = { workspace = true } @@ -177,9 +178,9 @@ runtime-benchmarks = [ "hex-literal", "polkadot-runtime?/runtime-benchmarks", "orml-asset-registry?/runtime-benchmarks", + "orml-benchmarking", "orml-tokens/runtime-benchmarks", "orml-xtokens?/runtime-benchmarks", - "orml-benchmarking", "pallet-author-inherent?/runtime-benchmarks", "pallet-author-mapping?/runtime-benchmarks", "pallet-author-slot-filter?/runtime-benchmarks", @@ -207,6 +208,7 @@ runtime-benchmarks = [ "zrml-authorized/runtime-benchmarks", "zrml-court/runtime-benchmarks", "zrml-liquidity-mining/runtime-benchmarks", + "zrml-neo-swaps/runtime-benchmarks", "zrml-prediction-markets/runtime-benchmarks", "zrml-simple-disputes/runtime-benchmarks", "zrml-global-disputes/runtime-benchmarks", @@ -312,6 +314,7 @@ std = [ "zrml-court/std", "zrml-liquidity-mining/std", "zrml-market-commons/std", + "zrml-neo-swaps/std", "zrml-prediction-markets/std", "zrml-rikiddo/std", "zrml-simple-disputes/std", @@ -366,6 +369,7 @@ try-runtime = [ "zrml-court/try-runtime", "zrml-liquidity-mining/try-runtime", "zrml-market-commons/try-runtime", + "zrml-neo-swaps/try-runtime", "zrml-prediction-markets/try-runtime", "zrml-rikiddo/try-runtime", "zrml-simple-disputes/try-runtime", @@ -398,7 +402,7 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zeitgeist-runtime" -version = "0.3.11" +version = "0.4.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/zeitgeist/src/lib.rs b/runtime/zeitgeist/src/lib.rs index 25b6918cb..ce7ab6c93 100644 --- a/runtime/zeitgeist/src/lib.rs +++ b/runtime/zeitgeist/src/lib.rs @@ -93,10 +93,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("zeitgeist"), impl_name: create_runtime_str!("zeitgeist"), authoring_version: 1, - spec_version: 48, + spec_version: 49, impl_version: 1, apis: RUNTIME_API_VERSIONS, - transaction_version: 23, + transaction_version: 24, state_version: 1, }; diff --git a/runtime/zeitgeist/src/parameters.rs b/runtime/zeitgeist/src/parameters.rs index 96535581f..f40b5b25a 100644 --- a/runtime/zeitgeist/src/parameters.rs +++ b/runtime/zeitgeist/src/parameters.rs @@ -190,6 +190,10 @@ parameter_types! { // Additional storage item size of 32 bytes. pub const DepositFactor: Balance = deposit(0, 32); + // NeoSwaps + pub const NeoSwapsMaxSwapFee: Balance = 10 * CENT; + pub const NeoSwapsPalletId: PalletId = NS_PALLET_ID; + // ORML pub const GetNativeCurrencyId: CurrencyId = Asset::Ztg; diff --git a/scripts/benchmarks/configuration.sh b/scripts/benchmarks/configuration.sh index c4f71fe2c..f5ce38ec1 100644 --- a/scripts/benchmarks/configuration.sh +++ b/scripts/benchmarks/configuration.sh @@ -27,8 +27,8 @@ export ORML_PALLETS_STEPS="${ORML_PALLETS_STEPS:-50}" export ORML_WEIGHT_TEMPLATE="./misc/orml_weight_template.hbs" export ZEITGEIST_PALLETS=( - zrml_authorized zrml_court zrml_global_disputes zrml_liquidity_mining zrml_prediction_markets \ - zrml_swaps zrml_styx \ + zrml_authorized zrml_court zrml_global_disputes zrml_liquidity_mining zrml_neo_swaps \ + zrml_prediction_markets zrml_swaps zrml_styx \ ) export ZEITGEIST_PALLETS_RUNS="${ZEITGEIST_PALLETS_RUNS:-1000}" export ZEITGEIST_PALLETS_STEPS="${ZEITGEIST_PALLETS_STEPS:-10}" diff --git a/zrml/authorized/Cargo.toml b/zrml/authorized/Cargo.toml index ae4ba5c12..17f825848 100644 --- a/zrml/authorized/Cargo.toml +++ b/zrml/authorized/Cargo.toml @@ -38,4 +38,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-authorized" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/authorized/src/weights.rs b/zrml/authorized/src/weights.rs index 8cd6968ff..650633d9f 100644 --- a/zrml/authorized/src/weights.rs +++ b/zrml/authorized/src/weights.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for zrml_authorized //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-03, STEPS: `10`, REPEAT: 1000, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `10`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/weight_template.hbs +// --header=./HEADER_GPL3 // --output=./zrml/authorized/src/weights.rs #![allow(unused_parens)] @@ -60,42 +63,91 @@ pub trait WeightInfoZeitgeist { /// Weight functions for zrml_authorized (automatically generated) pub struct WeightInfo(PhantomData); impl WeightInfoZeitgeist for WeightInfo { - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) fn authorize_market_outcome_first_report(m: u32) -> Weight { - Weight::from_ref_time(50_720_068) - // Standard Error: 2_573 - .saturating_add(Weight::from_ref_time(88_116).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `819 + m * (22 ±0)` + // Estimated: `9057` + // Minimum execution time: 37_680 nanoseconds. + Weight::from_parts(43_803_530, 9057) + // Standard Error: 2_117 + .saturating_add(Weight::from_ref_time(147_011).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn authorize_market_outcome_existing_report() -> Weight { - Weight::from_ref_time(39_720_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `573` + // Estimated: `5540` + // Minimum execution time: 30_130 nanoseconds. + Weight::from_parts(37_510_000, 5540) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn on_dispute_weight() -> Weight { - Weight::from_ref_time(0) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 240 nanoseconds. + Weight::from_ref_time(370_000) } + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn on_resolution_weight() -> Weight { - Weight::from_ref_time(0) + // Proof Size summary in bytes: + // Measured: `217` + // Estimated: `2524` + // Minimum execution time: 8_390 nanoseconds. + Weight::from_parts(10_690_000, 2524) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn exchange_weight() -> Weight { - Weight::from_ref_time(0) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_430 nanoseconds. + Weight::from_ref_time(3_130_000) } + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:0) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn get_auto_resolve_weight() -> Weight { - Weight::from_ref_time(0) + // Proof Size summary in bytes: + // Measured: `217` + // Estimated: `2524` + // Minimum execution time: 7_560 nanoseconds. + Weight::from_parts(9_510_000, 2524).saturating_add(T::DbWeight::get().reads(1_u64)) } fn has_failed_weight() -> Weight { - Weight::from_ref_time(0) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 240 nanoseconds. + Weight::from_ref_time(330_000) } fn on_global_dispute_weight() -> Weight { - Weight::from_ref_time(0) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 220 nanoseconds. + Weight::from_ref_time(330_000) } + /// Storage: Authorized AuthorizedOutcomeReports (r:0 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn clear_weight() -> Weight { - Weight::from_ref_time(0) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_140 nanoseconds. + Weight::from_ref_time(2_760_000).saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/zrml/court/Cargo.toml b/zrml/court/Cargo.toml index d40612540..10db2de92 100644 --- a/zrml/court/Cargo.toml +++ b/zrml/court/Cargo.toml @@ -46,4 +46,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-court" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/court/src/weights.rs b/zrml/court/src/weights.rs index faf60e5fe..05b91842d 100644 --- a/zrml/court/src/weights.rs +++ b/zrml/court/src/weights.rs @@ -19,11 +19,13 @@ //! Autogenerated weights for zrml_court //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-03, STEPS: `10`, REPEAT: 1000, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `10`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: -// ./target/release/zeitgeist +// ./target/production/zeitgeist // benchmark // pallet // --chain=dev @@ -34,8 +36,9 @@ // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./zrml/court/src/weights.rs // --template=./misc/weight_template.hbs +// --header=./HEADER_GPL3 +// --output=./zrml/court/src/weights.rs #![allow(unused_parens)] #![allow(unused_imports)] @@ -71,234 +74,399 @@ pub trait WeightInfoZeitgeist { /// Weight functions for zrml_court (automatically generated) pub struct WeightInfo(PhantomData); impl WeightInfoZeitgeist for WeightInfo { - // Storage: Court JurorPool (r:1 w:1) - // Storage: Court Jurors (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Court CourtPool (r:1 w:1) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) + /// Storage: Court Participants (r:1 w:1) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn join_court(j: u32) -> Weight { - Weight::from_ref_time(33_951_000) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(94_000).saturating_mul(j.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `1096 + j * (72 ±0)` + // Estimated: `78997` + // Minimum execution time: 43_160 nanoseconds. + Weight::from_parts(55_537_589, 78997) + // Standard Error: 372 + .saturating_add(Weight::from_ref_time(127_178).saturating_mul(j.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Court JurorPool (r:1 w:1) - // Storage: Court Jurors (r:6 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Court CourtPool (r:1 w:1) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) + /// Storage: Court Participants (r:6 w:1) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn delegate(j: u32, d: u32) -> Weight { - Weight::from_ref_time(46_155_000) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(122_000).saturating_mul(j.into())) - // Standard Error: 51_000 - .saturating_add(Weight::from_ref_time(863_000).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `0 + j * (74 ±0) + d * (685 ±0)` + // Estimated: `78997 + d * (2726 ±0)` + // Minimum execution time: 71_440 nanoseconds. + Weight::from_parts(44_282_067, 78997) + // Standard Error: 449 + .saturating_add(Weight::from_ref_time(173_095).saturating_mul(j.into())) + // Standard Error: 97_916 + .saturating_add(Weight::from_ref_time(8_829_240).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(d.into()))) - .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_proof_size(2726).saturating_mul(d.into())) } - // Storage: Court Jurors (r:1 w:1) - // Storage: Court JurorPool (r:1 w:1) + /// Storage: Court Participants (r:1 w:1) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Court CourtPool (r:1 w:1) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) fn prepare_exit_court(j: u32) -> Weight { - Weight::from_ref_time(19_325_000) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(84_000).saturating_mul(j.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `1034 + j * (72 ±0)` + // Estimated: `75223` + // Minimum execution time: 27_450 nanoseconds. + Weight::from_parts(33_850_483, 75223) + // Standard Error: 279 + .saturating_add(Weight::from_ref_time(112_723).saturating_mul(j.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Court Jurors (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Court Participants (r:1 w:1) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn exit_court_remove() -> Weight { - Weight::from_ref_time(38_000_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `273` + // Estimated: `6500` + // Minimum execution time: 38_030 nanoseconds. + Weight::from_parts(46_410_000, 6500) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Court Jurors (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: Court Participants (r:1 w:1) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn exit_court_set() -> Weight { - Weight::from_ref_time(37_000_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `273` + // Estimated: `6500` + // Minimum execution time: 36_590 nanoseconds. + Weight::from_parts(41_660_000, 6500) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: Court Courts (r:1 w:0) - // Storage: Court SelectedDraws (r:1 w:1) + /// Storage: Court Courts (r:1 w:0) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) fn vote(d: u32) -> Weight { - Weight::from_ref_time(48_629_000) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(90_000).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `416 + d * (53 ±0)` + // Estimated: `155273` + // Minimum execution time: 53_750 nanoseconds. + Weight::from_parts(63_068_664, 155273) + // Standard Error: 466 + .saturating_add(Weight::from_ref_time(128_840).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Court CourtIdToMarketId (r:1 w:0) - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Court Jurors (r:1 w:0) - // Storage: Court Courts (r:1 w:0) - // Storage: Court SelectedDraws (r:1 w:1) + /// Storage: Court CourtIdToMarketId (r:1 w:0) + /// Proof: Court CourtIdToMarketId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Court Participants (r:1 w:0) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Court Courts (r:1 w:0) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) fn denounce_vote(d: u32) -> Weight { - Weight::from_ref_time(41_779_000) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(126_000).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `1525 + d * (53 ±0)` + // Estimated: `163530` + // Minimum execution time: 56_950 nanoseconds. + Weight::from_parts(65_065_365, 163530) + // Standard Error: 667 + .saturating_add(Weight::from_ref_time(175_106).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Court CourtIdToMarketId (r:1 w:0) - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Court Jurors (r:1 w:0) - // Storage: Court Courts (r:1 w:0) - // Storage: Court SelectedDraws (r:1 w:1) + /// Storage: Court CourtIdToMarketId (r:1 w:0) + /// Proof: Court CourtIdToMarketId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Court Participants (r:1 w:0) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Court Courts (r:1 w:0) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) fn reveal_vote(d: u32) -> Weight { - Weight::from_ref_time(69_471_000) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(92_000).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `2107 + d * (53 ±0)` + // Estimated: `163530` + // Minimum execution time: 89_280 nanoseconds. + Weight::from_parts(105_142_516, 163530) + // Standard Error: 700 + .saturating_add(Weight::from_ref_time(129_152).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Court Courts (r:1 w:1) - // Storage: Court CourtIdToMarketId (r:1 w:0) - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Court SelectedDraws (r:1 w:1) - // Storage: Court JurorPool (r:1 w:1) - // Storage: Court JurorsSelectionNonce (r:1 w:1) - // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) - // Storage: Court Jurors (r:223 w:222) - // Storage: Court RequestBlock (r:1 w:0) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:2 w:2) - // Storage: Balances Reserves (r:1 w:1) - fn appeal(j: u32, a: u32, r: u32, _f: u32) -> Weight { - Weight::from_ref_time(0) - // Standard Error: 26_000 - .saturating_add(Weight::from_ref_time(5_584_000).saturating_mul(j.into())) - // Standard Error: 7_923_000 - .saturating_add(Weight::from_ref_time(2_539_125_000).saturating_mul(a.into())) - // Standard Error: 320_000 - .saturating_add(Weight::from_ref_time(1_503_000).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads((128_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes((128_u64).saturating_mul(a.into()))) + /// Storage: Court Courts (r:1 w:1) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court CourtIdToMarketId (r:1 w:0) + /// Proof: Court CourtIdToMarketId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) + /// Storage: Court CourtPool (r:1 w:1) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) + /// Storage: Court SelectionNonce (r:1 w:1) + /// Proof: Court SelectionNonce (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) + /// Proof: RandomnessCollectiveFlip RandomMaterial (max_values: Some(1), max_size: Some(2594), added: 3089, mode: MaxEncodedLen) + /// Storage: Court Participants (r:347 w:343) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Court RequestBlock (r:1 w:0) + /// Proof: Court RequestBlock (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:2 w:2) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + fn appeal(j: u32, a: u32, _r: u32, _f: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + j * (132 ±0) + a * (35486 ±0) + r * (16 ±0) + f * (16 ±0)` + // Estimated: `515302 + j * (203 ±1) + a * (314898 ±368)` + // Minimum execution time: 3_550_031 nanoseconds. + Weight::from_parts(3_951_492_000, 515302) + // Standard Error: 24_907 + .saturating_add(Weight::from_ref_time(5_971_667).saturating_mul(j.into())) + // Standard Error: 8_889_266 + .saturating_add(Weight::from_ref_time(4_324_332_119).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(109_u64)) + .saturating_add(T::DbWeight::get().reads((116_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(100_u64)) + .saturating_add(Weight::from_proof_size(203).saturating_mul(j.into())) + .saturating_add(Weight::from_proof_size(314898).saturating_mul(a.into())) } - // Storage: Court Courts (r:1 w:1) - // Storage: Court SelectedDraws (r:1 w:1) - // Storage: Court Jurors (r:5 w:5) - // Storage: System Account (r:6 w:5) + /// Storage: Court Courts (r:1 w:1) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) + /// Storage: Court Participants (r:510 w:510) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: System Account (r:511 w:510) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reassign_court_stakes(d: u32) -> Weight { - Weight::from_ref_time(0) - // Standard Error: 19_000 - .saturating_add(Weight::from_ref_time(44_416_000).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `911 + d * (587 ±0)` + // Estimated: `157880 + d * (5333 ±0)` + // Minimum execution time: 151_380 nanoseconds. + Weight::from_parts(154_621_000, 157880) + // Standard Error: 36_846 + .saturating_add(Weight::from_ref_time(68_443_331).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(d.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(d.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(5333).saturating_mul(d.into())) } - // Storage: Court YearlyInflation (r:0 w:1) + /// Storage: Court YearlyInflation (r:0 w:1) + /// Proof: Court YearlyInflation (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn set_inflation() -> Weight { - Weight::from_ref_time(16_000_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 12_830 nanoseconds. + Weight::from_ref_time(13_480_000).saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Court YearlyInflation (r:1 w:0) - // Storage: Court JurorPool (r:1 w:0) - // Storage: System Account (r:1 w:1) + /// Storage: Court YearlyInflation (r:1 w:0) + /// Proof: Court YearlyInflation (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Court CourtPool (r:1 w:0) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) + /// Storage: System Account (r:1000 w:1000) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn handle_inflation(j: u32) -> Weight { - Weight::from_ref_time(0) - // Standard Error: 4_000 - .saturating_add(Weight::from_ref_time(12_853_000).saturating_mul(j.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `0 + j * (243 ±0)` + // Estimated: `72996 + j * (2607 ±0)` + // Minimum execution time: 33_610 nanoseconds. + Weight::from_parts(40_730_000, 72996) + // Standard Error: 9_967 + .saturating_add(Weight::from_ref_time(20_723_935).saturating_mul(j.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(j.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(j.into()))) + .saturating_add(Weight::from_proof_size(2607).saturating_mul(j.into())) } - // Storage: Court CourtPool (r:1 w:1) - // Storage: Court SelectionNonce (r:1 w:1) - // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) - // Storage: Court Participants (r:35 w:31) + /// Storage: Court CourtPool (r:1 w:1) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) + /// Storage: Court SelectionNonce (r:1 w:1) + /// Proof: Court SelectionNonce (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) + /// Proof: RandomnessCollectiveFlip RandomMaterial (max_values: Some(1), max_size: Some(2594), added: 3089, mode: MaxEncodedLen) + /// Storage: Court Participants (r:240 w:236) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) fn select_participants(a: u32) -> Weight { - Weight::from_ref_time(639_560_000) - // Standard Error: 11_776_000 - .saturating_add(Weight::from_ref_time(2_310_239_000).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(24)) + // Proof Size summary in bytes: + // Measured: `84018 + a * (19595 ±0)` + // Estimated: `133335 + a * (162878 ±713)` + // Minimum execution time: 1_557_395 nanoseconds. + Weight::from_parts(973_988_351, 133335) + // Standard Error: 17_132_150 + .saturating_add(Weight::from_ref_time(3_436_391_543).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(24_u64)) .saturating_add(T::DbWeight::get().reads((60_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(19)) - .saturating_add(T::DbWeight::get().writes((60_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(19_u64)) + .saturating_add(Weight::from_proof_size(162878).saturating_mul(a.into())) } - // Storage: Court NextCourtId (r:1 w:1) - // Storage: Court JurorPool (r:1 w:1) - // Storage: Court JurorsSelectionNonce (r:1 w:1) - // Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) - // Storage: Court Jurors (r:23 w:23) - // Storage: Court RequestBlock (r:1 w:0) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) - // Storage: Court SelectedDraws (r:0 w:1) - // Storage: Court CourtIdToMarketId (r:0 w:1) - // Storage: Court MarketIdToCourtId (r:0 w:1) - // Storage: Court Courts (r:0 w:1) + /// Storage: Court NextCourtId (r:1 w:1) + /// Proof: Court NextCourtId (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Court CourtPool (r:1 w:1) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) + /// Storage: Court SelectionNonce (r:1 w:1) + /// Proof: Court SelectionNonce (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0) + /// Proof: RandomnessCollectiveFlip RandomMaterial (max_values: Some(1), max_size: Some(2594), added: 3089, mode: MaxEncodedLen) + /// Storage: Court Participants (r:31 w:31) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Court RequestBlock (r:1 w:0) + /// Proof: Court RequestBlock (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:0 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) + /// Storage: Court CourtIdToMarketId (r:0 w:1) + /// Proof: Court CourtIdToMarketId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court MarketIdToCourtId (r:0 w:1) + /// Proof: Court MarketIdToCourtId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court Courts (r:0 w:1) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) fn on_dispute(j: u32, r: u32) -> Weight { - Weight::from_ref_time(196_514_000) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(144_000).saturating_mul(j.into())) - // Standard Error: 3_000 - .saturating_add(Weight::from_ref_time(157_000).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(33)) - .saturating_add(T::DbWeight::get().writes(35)) + // Proof Size summary in bytes: + // Measured: `6039 + j * (80 ±0) + r * (16 ±0)` + // Estimated: `153295 + j * (11 ±0) + r * (29 ±1)` + // Minimum execution time: 295_111 nanoseconds. + Weight::from_parts(341_821_863, 153295) + // Standard Error: 1_402 + .saturating_add(Weight::from_ref_time(251_136).saturating_mul(j.into())) + // Standard Error: 21_685 + .saturating_add(Weight::from_ref_time(294_981).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(35_u64)) + .saturating_add(Weight::from_proof_size(11).saturating_mul(j.into())) + .saturating_add(Weight::from_proof_size(29).saturating_mul(r.into())) } - // Storage: Court MarketIdToCourtId (r:1 w:0) - // Storage: Court Courts (r:1 w:1) - // Storage: Court SelectedDraws (r:1 w:0) - // Storage: Court CourtIdToMarketId (r:1 w:0) - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Court Jurors (r:1 w:1) + /// Storage: Court MarketIdToCourtId (r:1 w:0) + /// Proof: Court MarketIdToCourtId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court Courts (r:1 w:1) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:0) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) + /// Storage: Court CourtIdToMarketId (r:1 w:0) + /// Proof: Court CourtIdToMarketId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Court Participants (r:510 w:510) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) fn on_resolution(d: u32) -> Weight { - Weight::from_ref_time(17_329_000) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(4_102_000).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(5)) + // Proof Size summary in bytes: + // Measured: `930 + d * (256 ±0)` + // Estimated: `163319 + d * (2726 ±0)` + // Minimum execution time: 45_150 nanoseconds. + Weight::from_parts(45_960_000, 163319) + // Standard Error: 5_929 + .saturating_add(Weight::from_ref_time(7_126_653).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(d.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(d.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(2726).saturating_mul(d.into())) } - // Storage: Court MarketIdToCourtId (r:1 w:0) - // Storage: Court Courts (r:1 w:0) - // Storage: Balances Reserves (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: Court MarketIdToCourtId (r:1 w:0) + /// Proof: Court MarketIdToCourtId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court Courts (r:1 w:0) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:4 w:4) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: System Account (r:4 w:4) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn exchange(a: u32) -> Weight { - Weight::from_ref_time(17_021_000) - // Standard Error: 29_000 - .saturating_add(Weight::from_ref_time(21_348_000).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `386 + a * (352 ±0)` + // Estimated: `5339 + a * (6331 ±0)` + // Minimum execution time: 15_690 nanoseconds. + Weight::from_parts(20_044_520, 5339) + // Standard Error: 71_967 + .saturating_add(Weight::from_ref_time(30_374_058).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) + .saturating_add(Weight::from_proof_size(6331).saturating_mul(a.into())) } - // Storage: Court MarketIdToCourtId (r:1 w:0) - // Storage: Court Courts (r:1 w:0) + /// Storage: Court MarketIdToCourtId (r:1 w:0) + /// Proof: Court MarketIdToCourtId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court Courts (r:1 w:0) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) fn get_auto_resolve() -> Weight { - Weight::from_ref_time(9_000_000).saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `389` + // Estimated: `5339` + // Minimum execution time: 13_440 nanoseconds. + Weight::from_parts(14_310_000, 5339).saturating_add(T::DbWeight::get().reads(2_u64)) } - // Storage: Court MarketIdToCourtId (r:1 w:0) - // Storage: Court JurorPool (r:1 w:0) - // Storage: Court Courts (r:1 w:0) - // Storage: Court CourtIdToMarketId (r:1 w:0) - // Storage: MarketCommons Markets (r:1 w:0) + /// Storage: Court MarketIdToCourtId (r:1 w:0) + /// Proof: Court MarketIdToCourtId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court CourtPool (r:1 w:0) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) + /// Storage: Court Courts (r:1 w:0) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court CourtIdToMarketId (r:1 w:0) + /// Proof: Court CourtIdToMarketId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) fn has_failed() -> Weight { - Weight::from_ref_time(24_000_000).saturating_add(T::DbWeight::get().reads(5)) + // Proof Size summary in bytes: + // Measured: `3151` + // Estimated: `83367` + // Minimum execution time: 34_400 nanoseconds. + Weight::from_parts(36_120_000, 83367).saturating_add(T::DbWeight::get().reads(5_u64)) } - // Storage: Court MarketIdToCourtId (r:1 w:0) - // Storage: Court Courts (r:1 w:1) - // Storage: Court SelectedDraws (r:1 w:1) - // Storage: Court Jurors (r:510 w:510) - fn on_global_dispute(a: u32, d: u32) -> Weight { - Weight::from_ref_time(11_646_000) - // Standard Error: 588_000 - .saturating_add(Weight::from_ref_time(20_187_000).saturating_mul(a.into())) - // Standard Error: 5_000 - .saturating_add(Weight::from_ref_time(4_083_000).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(3)) + /// Storage: Court MarketIdToCourtId (r:1 w:0) + /// Proof: Court MarketIdToCourtId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court Courts (r:1 w:1) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) + /// Storage: Court Participants (r:510 w:510) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + fn on_global_dispute(_a: u32, d: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `448 + a * (66 ±0) + d * (256 ±0)` + // Estimated: `157788 + d * (2726 ±0)` + // Minimum execution time: 30_890 nanoseconds. + Weight::from_parts(31_700_000, 157788) + // Standard Error: 4_099 + .saturating_add(Weight::from_ref_time(7_478_471).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(d.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(d.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(2726).saturating_mul(d.into())) } - // Storage: Court MarketIdToCourtId (r:1 w:0) - // Storage: Court SelectedDraws (r:1 w:1) - // Storage: Court Jurors (r:1 w:1) - // Storage: Court Courts (r:0 w:1) + /// Storage: Court MarketIdToCourtId (r:1 w:0) + /// Proof: Court MarketIdToCourtId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) + /// Storage: Court Participants (r:510 w:510) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: Court Courts (r:0 w:1) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) fn clear(d: u32) -> Weight { - Weight::from_ref_time(4_229_000) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(4_115_000).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `363 + d * (256 ±0)` + // Estimated: `154964 + d * (2726 ±0)` + // Minimum execution time: 25_431 nanoseconds. + Weight::from_parts(26_110_000, 154964) + // Standard Error: 5_377 + .saturating_add(Weight::from_ref_time(7_135_106).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(d.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(d.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(2726).saturating_mul(d.into())) } } diff --git a/zrml/global-disputes/Cargo.toml b/zrml/global-disputes/Cargo.toml index fc0104836..964dc8509 100644 --- a/zrml/global-disputes/Cargo.toml +++ b/zrml/global-disputes/Cargo.toml @@ -45,4 +45,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-global-disputes" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/global-disputes/src/weights.rs b/zrml/global-disputes/src/weights.rs index d5fbdcaa2..c4bbd433f 100644 --- a/zrml/global-disputes/src/weights.rs +++ b/zrml/global-disputes/src/weights.rs @@ -19,11 +19,13 @@ //! Autogenerated weights for zrml_global_disputes //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `10`, REPEAT: 1000, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `10`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: -// ./target/release/zeitgeist +// ./target/production/zeitgeist // benchmark // pallet // --chain=dev @@ -34,8 +36,9 @@ // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./zrml/global-disputes/src/weights.rs // --template=./misc/weight_template.hbs +// --header=./HEADER_GPL3 +// --output=./zrml/global-disputes/src/weights.rs #![allow(unused_parens)] #![allow(unused_imports)] @@ -59,94 +62,156 @@ pub trait WeightInfoZeitgeist { /// Weight functions for zrml_global_disputes (automatically generated) pub struct WeightInfo(PhantomData); impl WeightInfoZeitgeist for WeightInfo { - // Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:1) - // Storage: GlobalDisputes Outcomes (r:1 w:1) - // Storage: GlobalDisputes Locks (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - fn vote_on_outcome(_o: u32, v: u32) -> Weight { - Weight::from_ref_time(89_222_217) - // Standard Error: 4_589 - .saturating_add(Weight::from_ref_time(183_754).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:1) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: GlobalDisputes Outcomes (r:1 w:1) + /// Proof: GlobalDisputes Outcomes (max_values: None, max_size: Some(395), added: 2870, mode: MaxEncodedLen) + /// Storage: GlobalDisputes Locks (r:1 w:1) + /// Proof: GlobalDisputes Locks (max_values: None, max_size: Some(1641), added: 4116, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + fn vote_on_outcome(o: u32, v: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `556 + o * (26 ±0) + v * (32 ±0)` + // Estimated: `13631` + // Minimum execution time: 56_590 nanoseconds. + Weight::from_parts(64_123_584, 13631) + // Standard Error: 20_943 + .saturating_add(Weight::from_ref_time(211_783).saturating_mul(o.into())) + // Standard Error: 3_674 + .saturating_add(Weight::from_ref_time(73_843).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } - // Storage: GlobalDisputes Locks (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:0) - // Storage: GlobalDisputes GlobalDisputesInfo (r:5 w:0) + /// Storage: GlobalDisputes Locks (r:1 w:1) + /// Proof: GlobalDisputes Locks (max_values: None, max_size: Some(1641), added: 4116, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:50 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// 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:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn unlock_vote_balance_set(l: u32, o: u32) -> Weight { - Weight::from_ref_time(54_445_996) - // Standard Error: 8_942 - .saturating_add(Weight::from_ref_time(4_333_876).saturating_mul(l.into())) - // Standard Error: 50_061 - .saturating_add(Weight::from_ref_time(1_054_193).saturating_mul(o.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `0 + l * (467 ±0) + o * (1600 ±0)` + // Estimated: `10497 + l * (2871 ±0)` + // Minimum execution time: 32_240 nanoseconds. + Weight::from_parts(38_620_672, 10497) + // Standard Error: 11_532 + .saturating_add(Weight::from_ref_time(4_005_759).saturating_mul(l.into())) + // Standard Error: 64_559 + .saturating_add(Weight::from_ref_time(1_054_448).saturating_mul(o.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(l.into()))) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(2871).saturating_mul(l.into())) } - // Storage: GlobalDisputes Locks (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:0) - // Storage: GlobalDisputes GlobalDisputesInfo (r:5 w:0) + /// Storage: GlobalDisputes Locks (r:1 w:1) + /// Proof: GlobalDisputes Locks (max_values: None, max_size: Some(1641), added: 4116, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:50 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// 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:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn unlock_vote_balance_remove(l: u32, o: u32) -> Weight { - Weight::from_ref_time(61_165_913) - // Standard Error: 9_374 - .saturating_add(Weight::from_ref_time(4_014_112).saturating_mul(l.into())) - // Standard Error: 52_477 - .saturating_add(Weight::from_ref_time(199_810).saturating_mul(o.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `0 + l * (451 ±0) + o * (1600 ±0)` + // Estimated: `10497 + l * (2871 ±0)` + // Minimum execution time: 31_970 nanoseconds. + Weight::from_parts(33_511_909, 10497) + // Standard Error: 10_428 + .saturating_add(Weight::from_ref_time(3_811_407).saturating_mul(l.into())) + // Standard Error: 58_378 + .saturating_add(Weight::from_ref_time(1_203_183).saturating_mul(o.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(l.into()))) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(2871).saturating_mul(l.into())) } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:1) - // Storage: GlobalDisputes Outcomes (r:1 w:1) - // Storage: System Account (r:1 w:1) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:1) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: GlobalDisputes Outcomes (r:1 w:1) + /// Proof: GlobalDisputes Outcomes (max_values: None, max_size: Some(395), added: 2870, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn add_vote_outcome(_w: u32) -> Weight { - Weight::from_ref_time(100_295_681) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `686 + w * (32 ±0)` + // Estimated: `11364` + // Minimum execution time: 66_930 nanoseconds. + Weight::from_parts(80_489_480, 11364) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: GlobalDisputes Outcomes (r:1 w:0) - // Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) - // Storage: System Account (r:2 w:2) + /// Storage: GlobalDisputes Outcomes (r:1 w:0) + /// Proof: GlobalDisputes Outcomes (max_values: None, max_size: Some(395), added: 2870, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: System Account (r:11 w:11) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reward_outcome_owner_shared_possession(o: u32) -> Weight { - Weight::from_ref_time(36_741_000) - // Standard Error: 20_000 - .saturating_add(Weight::from_ref_time(22_017_000).saturating_mul(o.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `490 + o * (41 ±0)` + // Estimated: `8869 + o * (2702 ±6)` + // Minimum execution time: 65_240 nanoseconds. + Weight::from_parts(53_543_555, 8869) + // Standard Error: 97_020 + .saturating_add(Weight::from_ref_time(29_345_233).saturating_mul(o.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(o.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(o.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(2702).saturating_mul(o.into())) } - // Storage: GlobalDisputes Outcomes (r:1 w:0) - // Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) - // Storage: System Account (r:2 w:2) + /// Storage: GlobalDisputes Outcomes (r:1 w:0) + /// Proof: GlobalDisputes Outcomes (max_values: None, max_size: Some(395), added: 2870, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn reward_outcome_owner_paid_possession() -> Weight { - Weight::from_ref_time(56_000_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) + // Proof Size summary in bytes: + // Measured: `537` + // Estimated: `10955` + // Minimum execution time: 64_330 nanoseconds. + Weight::from_parts(77_110_000, 10955) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:1) - // Storage: GlobalDisputes Outcomes (r:3 w:2) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:1) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: GlobalDisputes Outcomes (r:250 w:249) + /// Proof: GlobalDisputes Outcomes (max_values: None, max_size: Some(395), added: 2870, mode: MaxEncodedLen) fn purge_outcomes(k: u32, _o: u32) -> Weight { - Weight::from_ref_time(168_932_238) - // Standard Error: 26_203 - .saturating_add(Weight::from_ref_time(19_445_586).saturating_mul(k.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `407 + k * (122 ±0) + o * (32 ±0)` + // Estimated: `8611 + k * (2870 ±0)` + // Minimum execution time: 74_110 nanoseconds. + Weight::from_parts(77_737_658, 8611) + // Standard Error: 16_871 + .saturating_add(Weight::from_ref_time(17_798_938).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(2870).saturating_mul(k.into())) } - // Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) - // Storage: GlobalDisputes Outcomes (r:3 w:2) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: GlobalDisputes Outcomes (r:250 w:249) + /// Proof: GlobalDisputes Outcomes (max_values: None, max_size: Some(395), added: 2870, mode: MaxEncodedLen) fn refund_vote_fees(k: u32, _o: u32) -> Weight { - Weight::from_ref_time(31_076_000) - // Standard Error: 4_000 - .saturating_add(Weight::from_ref_time(13_543_000).saturating_mul(k.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `407 + k * (122 ±0) + o * (32 ±0)` + // Estimated: `8611 + k * (2870 ±0)` + // Minimum execution time: 71_460 nanoseconds. + Weight::from_parts(169_245_397, 8611) + // Standard Error: 20_546 + .saturating_add(Weight::from_ref_time(17_882_530).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(2870).saturating_mul(k.into())) } } diff --git a/zrml/liquidity-mining/Cargo.toml b/zrml/liquidity-mining/Cargo.toml index 8bf7010fa..e8127631b 100644 --- a/zrml/liquidity-mining/Cargo.toml +++ b/zrml/liquidity-mining/Cargo.toml @@ -40,4 +40,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-liquidity-mining" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/liquidity-mining/src/weights.rs b/zrml/liquidity-mining/src/weights.rs index ad8639af2..3049b9cc7 100644 --- a/zrml/liquidity-mining/src/weights.rs +++ b/zrml/liquidity-mining/src/weights.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for zrml_liquidity_mining //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `10`, REPEAT: 1000, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `10`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/weight_template.hbs +// --header=./HEADER_GPL3 // --output=./zrml/liquidity-mining/src/weights.rs #![allow(unused_parens)] @@ -52,8 +55,13 @@ pub trait WeightInfoZeitgeist { /// Weight functions for zrml_liquidity_mining (automatically generated) pub struct WeightInfo(PhantomData); impl WeightInfoZeitgeist for WeightInfo { - // Storage: LiquidityMining PerBlockIncentive (r:0 w:1) + /// Storage: LiquidityMining PerBlockIncentive (r:0 w:1) + /// Proof: LiquidityMining PerBlockIncentive (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) fn set_per_block_distribution() -> Weight { - Weight::from_ref_time(9_400_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_390 nanoseconds. + Weight::from_ref_time(4_790_000).saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/zrml/market-commons/Cargo.toml b/zrml/market-commons/Cargo.toml index 735e6e8a2..cb52f2835 100644 --- a/zrml/market-commons/Cargo.toml +++ b/zrml/market-commons/Cargo.toml @@ -31,4 +31,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-market-commons" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/neo-swaps/Cargo.toml b/zrml/neo-swaps/Cargo.toml new file mode 100644 index 000000000..62f5f1a3b --- /dev/null +++ b/zrml/neo-swaps/Cargo.toml @@ -0,0 +1,109 @@ +[dependencies] +fixed = { workspace = true } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +hydra-dx-math = { workspace = true } +orml-traits = { workspace = true } +parity-scale-codec = { workspace = true, features = ["derive", "max-encoded-len"] } +scale-info = { workspace = true, features = ["derive"] } +sp-runtime = { workspace = true } +typenum = { workspace = true } +zeitgeist-primitives = { workspace = true } +zrml-market-commons = { workspace = true } + +# Mock + +orml-asset-registry = { workspace = true, optional = true } +orml-currencies = { workspace = true, optional = true } +orml-tokens = { workspace = true, optional = true } +pallet-balances = { workspace = true, optional = true } +pallet-randomness-collective-flip = { workspace = true, optional = true } +pallet-timestamp = { workspace = true, optional = true } +pallet-treasury = { workspace = true, optional = true } +pallet-xcm = { workspace = true, optional = true } +serde = { workspace = true, optional = true } +sp-api = { workspace = true, optional = true } +sp-io = { workspace = true, optional = true } +substrate-fixed = { workspace = true, optional = true } +xcm = { workspace = true, optional = true } +xcm-builder = { workspace = true, optional = true } +zrml-authorized = { workspace = true, optional = true } +zrml-court = { workspace = true, optional = true } +zrml-global-disputes = { workspace = true, optional = true } +zrml-liquidity-mining = { workspace = true, optional = true } +zrml-prediction-markets = { workspace = true, optional = true } +zrml-prediction-markets-runtime-api = { workspace = true, optional = true } +zrml-rikiddo = { workspace = true, optional = true } +zrml-simple-disputes = { workspace = true, optional = true } +zrml-swaps = { workspace = true, optional = true } + + +[dev-dependencies] +more-asserts = { workspace = true } +test-case = { workspace = true } +zrml-neo-swaps = { workspace = true, features = ["mock"] } + +[features] +default = ["std"] +mock = [ + "orml-currencies/default", + "orml-tokens/default", + "pallet-balances", + "pallet-randomness-collective-flip/default", + "pallet-timestamp/default", + "pallet-treasury/default", + "sp-api/default", + "sp-io/default", + "substrate-fixed", + "zeitgeist-primitives/mock", + "zrml-prediction-markets-runtime-api/default", + "zrml-rikiddo/default", + "zrml-swaps/default", + "xcm/default", + "orml-asset-registry/default", + "orml-currencies/default", + "orml-tokens/default", + "pallet-balances/default", + "pallet-timestamp/default", + "sp-api/default", + "sp-io/default", + "zrml-court/std", + "zrml-authorized/std", + "zrml-liquidity-mining/std", + "zrml-simple-disputes/std", + "zrml-global-disputes/std", + "zrml-prediction-markets/std", + "zrml-prediction-markets/mock", + "zrml-prediction-markets/default", + "serde/default", +] +parachain = ["zrml-prediction-markets/parachain"] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", +] +std = [ + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "orml-traits/std", + "parity-scale-codec/std", + "sp-runtime/std", + "xcm-builder/std", + "pallet-xcm/std", + "zeitgeist-primitives/std", + "zrml-market-commons/std", +] +try-runtime = [ + "frame-support/try-runtime", +] + +[package] +authors = ["Zeitgeist PM "] +edition = "2021" +name = "zrml-neo-swaps" +version = "0.4.0" diff --git a/zrml/neo-swaps/README.md b/zrml/neo-swaps/README.md new file mode 100644 index 000000000..e2b057c39 --- /dev/null +++ b/zrml/neo-swaps/README.md @@ -0,0 +1,47 @@ +# Neo Swaps Module + +The Neo Swaps module implements liquidity pools which use the Logarithmic Market +Scoring Rule (LMSR) to determine spot prices and swap amounts, and allow users +to dynamically provide liquidity. + +## Overview + +For a detailed description of the underlying mathematics see [here][docslink]. + +### Terminology + +- _Collateral_: The currency type that backs the outcomes in the pool. This is + also called the _base asset_ in other contexts. +- _Exit_: Refers to removing (part of) the liquidity from a liquidity pool in + exchange for burning pool shares. +- _External fees_: After taking swap fees, additional fees can be withdrawn + from an informant's collateral. They might go to the chain's treasury or the + market creator. +- _Join_: Refers to adding more liquidity to a pool and receiving pool shares + in return. +- _Liquidity provider_: A user who owns pool shares indicating their stake in + the liquidity pool. +- _Pool Shares_: A token indicating the owner's per rate share of the + liquidity pool. +- _Reserve_: The balances in the liquidity pool used for trading. +- _Swap fees_: Part of the collateral paid or received by informants that is + moved to a separate account owned by the liquidity providers. They need to + be withdrawn using the `withdraw_fees` extrinsic. + +### Notes + +- The `Pool` struct tracks the reserve held in the pool account. The reserve + changes when trades are executed or the liquidity changes, but the reserve + does not take into account funds that are sent to the pool account + unsolicitedly. This fixes a griefing vector which allows an attacker to + change prices by sending funds to the pool account. +- Pool shares are not recorded using the `ZeitgeistAssetManager` trait. + Instead, they are part of the `Pool` object and can be tracked using events. +- When the native currency is used as collateral, the pallet deposits the + existential deposit to the pool account (which holds the swap fees). This is + done to ensure that small amounts of fees don't cause the entire transaction + to error with `ExistentialDeposit`. This "buffer" is removed when the pool + is destroyed. The pool account is expected to be whitelisted from dusting + for all other assets. + +[docslink]: ./docs/docs.pdf diff --git a/zrml/neo-swaps/docs/docs.pdf b/zrml/neo-swaps/docs/docs.pdf new file mode 100644 index 000000000..f98e4c2bf Binary files /dev/null and b/zrml/neo-swaps/docs/docs.pdf differ diff --git a/zrml/neo-swaps/docs/docs.tex b/zrml/neo-swaps/docs/docs.tex new file mode 100644 index 000000000..a3712d394 --- /dev/null +++ b/zrml/neo-swaps/docs/docs.tex @@ -0,0 +1,260 @@ +\documentclass[12pt]{article} + +% Packages +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\usepackage{graphicx} +\usepackage{hyperref} +\usepackage{geometry} +\usepackage{listings} +\usepackage{xcolor} +\usepackage{parskip} +\geometry{a4paper, margin=1in} +\newtheorem{theorem}{Theorem} +\lstset{ + literate={←}{$\leftarrow$}{1} + {→}{$\rightarrow$}{1}, + basicstyle=\ttfamily\small, + keywordstyle=\color{blue}, + commentstyle=\color{olive}, + numberstyle=\tiny\color{gray}, + numbers=left, + frame=single, + backgroundcolor=\color{yellow!10}, + breaklines=true, + captionpos=b, + tabsize=4 +} + +\title{zrml-neo-swaps Documentation} +\date{0.4.1 (\today)} + +\begin{document} + +\maketitle + +\section{Introduction} + +This document provides the mathematical and technical details for zrml-neo-swaps. The automatic market maker (AMM) implemented by zrml-neo-swaps is a variant of the Logarithmic Market Scoring Rule (LMSR; \cite{hanson_2003}) which was first developed by Gnosis (see \url{https://docs.gnosis.io/conditionaltokens/docs/introduction3/}). We often refer to it as AMM 2.0. + +Unlike the typical implementation using a cost function (see \cite{chen_vaughan_2010}), this implementation of LMSR is a \emph{constant-function market maker} (CFMM), similar to the classical constant product market maker, which allows us to implement \emph{dynamic liquidity}. In other words, liquidity providers (LPs) can come and go as they please, allowing the market to self-regulate how much price resistance the AMM should provide. + +As of v0.4.1, the AMM is only available for markets with two outcomes. This will be mitigated in a future publication. + +\section{The Trading Function} + +We consider a prediction market with $n$ outcomes, denoted by $1, \ldots, n$ for simplicity. Every complete set of outcome tokens is backed a unit of collateral, denotes by \$. The AMM operates on a \emph{liquidity pool} (or just \emph{pool}), which consists of a \emph{reserve} $(r_1, \ldots, r_n)$ of outcome tokens and a \emph{liquidity parameter} $b$. The trading function is defined as +\[ + \varphi(b, r) = \sum_i e^{-r_i/b}. +\] +In fact, $\varphi(b, r)$ must always equal $1$. This means that a trader may change the reserve from $r$ to $r'$ and receive the delta provided that $\varphi(b, r') = 1$. We denote such a trade by $r \rightarrow r'$. We call these outcome-to-outcome (O2O) swaps. + +However, we do not allow users to execute these types of trades. Instead, we only allow \emph{buys} (exchange collateral for outcome tokens) and \emph{sells} (exchange outcome tokens for collateral). + +\section{Buying and Selling} + +\subsection{Buying} + +Buying and selling is implemented by combining complete set operations (exchange $x$ dollars for $x$ units of every outcome) and O2O swaps. + +Alice wants to swap $x$ dollars for units of outcome $i$. This is done by exchanging $x$ dollars for $x$ complete sets and then selling all outcomes $k \neq i$ for more $i$ using an O2O swap $r \rightarrow r'$, which yields $y(x)$ additional units of $i$. \emph{Ignoring swap fees}, this modifies the reserve to $r'$, where $r_k' = r_k + x$ for $k \neq i$ and $r_i' = r_i - y(x)$. As trades don't change the invariant, we have $1 = \sum_k e^{-r_k'/b}$. Thus, using $1 = \varphi(b, r) = \sum_k e^{-r_k/b}$, +\begin{align*} + 1 &= \sum_k e^{-r_k'/b} \\ + &= \sum_{k \neq i} e^{-(r_k + x)/b} + e^{-(r_i-y(x))/b} \\ + &= e^{-x/b} \sum_{k \neq i} e^{-r_k/b} + e^{y(x)/b} e^{-r_i/b} \\ + &= e^{-x/b} (1 - e^{-r_i/b}) + e^{y(x)/b} e^{-r_i/b}. +\end{align*} +Rearranging these terms gives +\[ + e^{y(x)/b} = e^{r_i/b} (1 - e^{-x/b}(1 - e^{-r_i/b})), +\] +and, thus, +\begin{align*} + y(x) &= b \ln(e^{r_i/b} (1 - e^{-x/b}(1 - e^{-r_i/b}))) \\ + &= b \ln (1 - e^{-x/b}(1 - e^{-r_i/b})) + r_i \\ + &= b \ln (e^{x/b} - 1 + e^{-r_i/b}) + r_i - x. +\end{align*} + +Note that the total amount of outcome $i$ that Alice receives is $y(x)$ from the O2O trade and $x$ from the complete set operation. We denote this by $z(x) = y(x) + x$. + +This allows us to calculate the \emph{spot price} of outcome $i$ +\[ + p_i(b, r) = \lim_{x \rightarrow 0} \frac{x}{z(x)} = \frac{1}{z'(0)} = \frac{1}{y'(0) + 1}. +\] +Calculating the derivative of $y$ yields +\[ + y'(x) = \frac{e^{x/b}}{e^{x/b} - 1 + e^{-r_i/b}} - 1 +\] +and thus $y'(0) = e^{r_i/b} - 1$, which yields $p_i(b, r) = e^{-r_i/b}$. + +Note that this means +\[ + 1 = \varphi(b, r) = \sum_i p_i(b, r). +\] +In particular, $(p_1, \ldots, p_n)$ always maps to a probability distribution. + +Trading fees are specified as fractional (a fee of $f = .01$ means that $1\%$ are charged) and deducted from the amount of collateral before the complete set operations are executed. In other words, the liquidity providers receive $fx$ dollars (fees are distributed pro rata amongst the liquidity providers) and Alice goes through the entire process described above with $\tilde x = (1-f)x$ in place of $x$. The spot price taking the fees into account is (as expected) +\[ + \psi(b, r, f) = (1 - f)^{-1}e^{-r_i/b}. +\] + +\subsection{Selling} + +Alice wants to swap $x$ units of $i$ for dollars. This is done by selling $x' < x$ units of $i$ for $v(x) = x - x'$ units of all outcomes $k \neq i$ and then selling $v(x)$ units of complete sets, which yields $v(x)$ dollars. \emph{Ignoring swap fees}, this modifies the reserve from $r$ to $r'$, where $r_k' = r_k - v(x)$ and $r_i = r_i + x'$. Using $1 = \varphi(b, r')$ and $x' = x - v(x)$, we get +\begin{align*} + 1 &= \sum_k e^{-r_k'/b} \\ + &= \sum_{k \neq i} e^{-(r_k - v(x))/b} + e^{-(r_i + x')/b} \\ + &= e^{v(x)/b} \sum_{k \neq i} e^{-r_i/b} + e^{-x'/b} e^{-r_i/b} \\ + &= e^{v(x)/b} (1 - e^{-r_i/b}) + e^{-x/b} e^{v(x)/b} e^{-r_i/b} \\ + &= e^{v(x)/b} ( 1 - e^{-r_i/b} + e^{-(r_i + x)/b} ). +\end{align*} +Thus, we get +$$ + e^{-v(x)/b} = 1 - e^{-r_i/b} + e^{-(r_i + x)/b}, +$$ +which in turn yields \begin{align*} + v(x) &= - b \ln (1 - e^{-r_i/b} + e^{-(x+r_i)/b} \\ + &= -b \ln (e^{r_i/b} - 1 + e^{-x/b}) + r_i \\ &= -b \ln (e^{(x + r_i)/b} - e^{x/b} + 1) + r_i + x. +\end{align*} + +Trading fees are deducted from the amount of collateral received from the complete set operation. In other words, the liquidity providers receive $fv(x)$ dollars and Alice receives $(1-f)v(x)$. The selling price (the amount of collateral received for each unit of $x$), is then (as expected) +\[ + \lim_{x \rightarrow 0} \frac{(1-f)v(x)}{x} = (1-f) v'(0) = (1-f) e^{-r_i/b} = (1-f)p_i(b, r). +\] +This leads to a typical bid-ask spread between buy and sell price. + +\section{Dynamic Liquidity} + +Liquidity may be added or removed dynamically to regulate the market's price resistance. Each LP's share of the pool is tracked using pool share tokens, which record their \emph{pro rata} share of the pool. + +We consider a pool with liquidity parameter $b$, reserve $r$ and a total issuance of $q$ pool shares. + +\subsection{Adding Liquidity} + +Alice wants to add liquidity to the pool. She's willing to pay $x$ dollars. To implement this, she first spends $x$ dollars to buy $x$ complete sets. + +Now let $i$ be so that $r_i = \max_k r_k$. Let $\lambda = x / r_i$ and $\mu = 1 + \lambda$. For each $k$, Alice moves $\lambda r_k$ units of $k$ into the pool and receives $\lambda q$ pool shares. The liquidity parameter changes from $b$ to $b' = \mu b$. Alice's transfers change the reserve from $r$ to $r' = \mu r$. + +The new total issuance of pool shares is $\mu q$ and Alice's share of the pool now is $\lambda / \mu$. Note that Alice retains the balance $(x)^n - \lambda r$ of "left-over tokens". + +\subsection{Withdrawing Liquidity} + +Alice wants to withdraw liquidity from the pool. She's willing to burn $p$ pool shares. + +Let $\lambda = p / q$ and $\mu = 1 - \lambda$. For each $k$, Alice receives $\lambda r_k$ units of $k$ from the pool. The liquidity parameter changes from $b$ to $b' = \mu b$. Alice's transfers change the reserve from $r$ to $r' = \mu r$. + +Alice could now convert $x = \min_i r_i$ complete sets of her newly received funds into $x$ dollars. The remainder of the funds will remain in her wallet until the market resolves or she opts to sell them. + +\subsection{Fee Distribution} + +Fees are distributed pro rata amongst the liquidity providers. These funds are completely separate from the reserve used for trading. Transferring the fees into the pool (like the constant product market maker does) wouldn't make any sense here as collateral is not directly traded on the pool. + +\section{Creating Pools} + +Creating a pool is straightforward. The initial odds are defined by adding different amounts of each outcome to the pool. If Alice wants to deposit liquidity worth $x$ units of collateral with initial probability $p$, then she starts off by buying $x$ complete sets. The following algorithm is used to calculate how many units of each outcome go into the pool. Alice retains the other tokens as "left-overs". + +Let $b = 1$, and let $r_i = - b \ln p_i$ for all $i$. Now let $y = x / \max_i r_i$. Then $y r_i \leq x$ for all $i$ and there exists $i_0$ so that $y r_{i_0} = x$. Set $\tilde r_i = y r_i$ and $\tilde b = yb$. Then +\[ + p_i(\tilde r) = e^{-\tilde r_i/\tilde b} = e^{-r_i/b} = p_i +\] +and $\max_i \tilde r_i = x$ (so Alice uses up at least one of her outcome balances). + +In pseudocode: + +\begin{lstlisting}[language=Pascal, caption=Procedure to Calculate Balances] +Procedure CalculateBalances(p[1...n], x) + b ← 1 // Initialize b, larger values may be picked for numerical stability + For i from 1 to n do + r[i] ← -b * log(p[i]) + End For + y ← x / max(r[1...n]) + For i from 1 to n do + r[i] ← y * r[i] + End For + b ← y * b + Return r, b +End Procedure +\end{lstlisting} + +\section{Additional Formulas} + +\subsection{Estimated Price After Execution} + +After executing a buy for $x$ units of collateral for outcome $i$, the new reserve of $i$ is +\[ + r_i' = r_i - y((1-f)x) = -b \ln (1 - e^{-(1-f)x/b}(1 - e^{-r_i/b})). +\] +Thus, the new price is +\[ + p_i(f, b, r') = \frac{1}{1-f} (1 - e^{-(1-f)x/b}(1 - e^{-r_i/b})). +\] + +After executing a sell of $x$ units of outcome $i$ for collateral, the new reserve of $i$ is +\[ + r_i' = r_i + x' = r_i + x - v(x) = b \ln (e^{(x + r_i)/b} - e^{x/b} + 1). +\] +The new price is therefore +\[ + p_i(f, b, r') = \frac{1}{1-f} (e^{(x + r_i)/b} - e^{x/b} + 1). +\] + +\section{Numerical Issues} + +Special care must be taken to avoid over- and underflows when calculating expressions like +\begin{align*} + y(x) &= b \ln (e^{x/b} - 1 + e^{-r_i/b}) + r_i - x, \\ + v(x) &= -b \ln (e^{r_i/b} - 1 + e^{-x/b}) + r_i. +\end{align*} +The magnitude of $y(x)$ is the same as $x$, but the exponentials $e^{x/b}$ and $e^{-r_i/b}$ over- or underflow easily. + +Let $A = 20$. Python calculates $e^A = 485165195.4097903$ and $e^{-A} = 2.061153622438558 \cdot 10^{-9}$. The fixed crate (see \url{https://crates.io/crates/fixed}) can represent these using \texttt{FixedU128} without considerable loss of precision or risk of over- or underflow. Let $M = e^A$. + +Note that for any number $a$, the following are equivalent: 1) $M^{-1} \leq e^a \leq M$, 2) $M^{-1} \leq e^{-a} \leq M$. Thus, the following restrictions prevent over- and underflows when calculating the exponential expressions: + +\begin{itemize} + \item The amount $x$ must satisfy $x \leq Ab$. + \item The price of $i$ must satisfy $p_i(b, r) = e^{-r_i/b} \geq e^{-A}$. +\end{itemize} + +How "bad" are these restrictions? The first restriction is completely irrelevant: Suppose Alice executes a trade of $y(x)$ units of outcome $i$ for $x = Ab$ dollars, the maximum allowed value. Let $q = 1 - e^{-r_i/b} \in (0, 1)$. Then +\begin{align*} + \ln(e^A) - \ln(e^A - q) &= \ln\left(\frac{e^A}{e^A - q}\right) \\ + &\leq \ln\left(\frac{e^A}{e^A - 1}\right) \\ + &\approx 2.0611536900435727 \cdot 10^{-9} \\ + &\leq 10^{-10}. +\end{align*} +Let $\varepsilon = 10^{-10}$. Then we have +\begin{align*} + y(x) &= b\ln(e^A - 1 + e^{-r_i/b}) + r_i - x \\ + &\geq b(\ln(e^A) - \varepsilon) + r_i - x \\ + &= bA - b\varepsilon + r_i - x \\ + &= r_i - b\varepsilon. +\end{align*} +Thus, Alice receives all funds from the pool except $b \varepsilon$, which is very small unless the pool contains an inordinate amount of liquidity. + +The second restriction means that no trades of outcome $i$ can be executed if the price of $i$ drops below the threshold $\varepsilon = e^{-A}$. On markets with two outcomes (binary or scalar), this is equivalent to the price of the other outcome rising above $1 - \varepsilon$. Due to risk considerations, these are generally scenarios that won't occur. + +For markets with two outcomes (binary or scalar), we therefore make the following restriction: \emph{Any trade that moves the price of an outcome below $\varepsilon = .005$ (or equivalently, moves the price of an outcome above $1 - \varepsilon$) is not allowed.} This will ensure that the pool is always in a valid state where it can execute trades. Note that in the presence of a swap fee of 1\%, this isn't even a restriction. + +Markets with more than two outcomes are currently not allowed to use AMM 2.0 pools. The issue in a market with three or more outcomes $A, B, C, \ldots$ is that if $C$ is a clear underdog and most of the trading happens between the favorites $A$ and $B$, then the price of $C$ might drop below the allowed threshold and \emph{brick} the market of $C$ (all trades involving $C$ must be rejected due to numerical issues). While this is most likely to happen if the market is $C$-weakly trivialized (it is common knowledge that $C$ will almost certainly not materialize), which should never happen on a live market, this is unfortunate. A solution for this issue is provided in the near future. + +\newpage + +\begin{thebibliography}{9} + \bibitem{chen_vaughan_2010} + Yiling Chen and Jennifer Wortman Vaughan, + \emph{A new understanding of prediction markets via no-regret learning}, + EC '10: Proceedings of the 11th ACM conference on Electronic commerce, + June 2010, Pages 189–198. + \url{https://doi.org/10.1145/1807342.1807372} + + \bibitem{hanson_2003} + Robin Hanson, + \emph{Logarithmic Market Scoring Rules for Modular Combinatorial Information Aggregation}, + The Journal of Prediction Markets, 1(1), + May 2003. + \url{https://doi.org/10.5750/jpm.v1i1.417} +\end{thebibliography} + +\end{document} diff --git a/zrml/neo-swaps/src/benchmarking.rs b/zrml/neo-swaps/src/benchmarking.rs new file mode 100644 index 000000000..a2dc0b1ee --- /dev/null +++ b/zrml/neo-swaps/src/benchmarking.rs @@ -0,0 +1,239 @@ +// Copyright 2023 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 . + +#![cfg(feature = "runtime-benchmarks")] + +use super::*; +use crate::{ + consts::*, traits::liquidity_shares_manager::LiquiditySharesManager, AssetOf, BalanceOf, + MarketIdOf, Pallet as NeoSwaps, Pools, +}; +use frame_benchmarking::v2::*; +use frame_support::{ + assert_ok, + storage::{with_transaction, TransactionOutcome::*}, +}; +use frame_system::RawOrigin; +use orml_traits::MultiCurrency; +use sp_runtime::{Perbill, SaturatedConversion}; +use zeitgeist_primitives::{ + constants::CENT, + traits::CompleteSetOperationsApi, + types::{Asset, Market, MarketCreation, MarketPeriod, MarketStatus, MarketType, ScoringRule}, +}; +use zrml_market_commons::MarketCommonsPalletApi; + +macro_rules! assert_ok_with_transaction { + ($expr:expr) => {{ + assert_ok!(with_transaction(|| match $expr { + Ok(val) => Commit(Ok(val)), + Err(err) => Rollback(Err(err)), + })); + }}; +} + +fn create_market( + caller: T::AccountId, + base_asset: AssetOf, + asset_count: AssetIndexType, +) -> MarketIdOf { + let market = Market { + base_asset, + creation: MarketCreation::Permissionless, + creator_fee: Perbill::zero(), + creator: caller.clone(), + oracle: caller, + metadata: vec![0, 50], + market_type: MarketType::Categorical(asset_count), + period: MarketPeriod::Block(0u32.into()..1u32.into()), + deadlines: Default::default(), + scoring_rule: ScoringRule::Lmsr, + status: MarketStatus::Active, + report: None, + resolved_outcome: None, + dispute_mechanism: None, + bonds: Default::default(), + }; + let maybe_market_id = T::MarketCommons::push_market(market); + maybe_market_id.unwrap() +} + +fn create_market_and_deploy_pool( + caller: T::AccountId, + base_asset: AssetOf, + asset_count: AssetIndexType, + amount: BalanceOf, +) -> MarketIdOf { + let market_id = create_market::(caller.clone(), base_asset, asset_count); + let total_cost = amount + T::MultiCurrency::minimum_balance(base_asset); + assert_ok!(T::MultiCurrency::deposit(base_asset, &caller, total_cost)); + assert_ok_with_transaction!(T::CompleteSetOperations::buy_complete_set( + caller.clone(), + market_id, + amount + )); + assert_ok!(NeoSwaps::::deploy_pool( + RawOrigin::Signed(caller).into(), + market_id, + amount, + vec![_1_2.saturated_into(), _1_2.saturated_into()], + CENT.saturated_into(), + )); + market_id +} + +#[benchmarks] +mod benchmarks { + use super::*; + + #[benchmark] + fn buy() { + let alice: T::AccountId = whitelisted_caller(); + let base_asset = Asset::Ztg; + let asset_count = 2u16; + let market_id = create_market_and_deploy_pool::( + alice, + base_asset, + asset_count, + _10.saturated_into(), + ); + let asset_out = Asset::CategoricalOutcome(market_id, 0); + let amount_in = _1.saturated_into(); + let min_amount_out = 0u8.saturated_into(); + + let bob: T::AccountId = whitelisted_caller(); + assert_ok!(T::MultiCurrency::deposit(base_asset, &bob, amount_in)); + + #[extrinsic_call] + _(RawOrigin::Signed(bob), market_id, asset_count, asset_out, amount_in, min_amount_out); + } + + #[benchmark] + fn sell() { + let alice: T::AccountId = whitelisted_caller(); + let base_asset = Asset::Ztg; + let market_id = + create_market_and_deploy_pool::(alice, base_asset, 2u16, _10.saturated_into()); + let asset_in = Asset::CategoricalOutcome(market_id, 0); + let amount_in = _1.saturated_into(); + let min_amount_out = 0u8.saturated_into(); + + let bob: T::AccountId = whitelisted_caller(); + assert_ok!(T::MultiCurrency::deposit(asset_in, &bob, amount_in)); + + #[extrinsic_call] + _(RawOrigin::Signed(bob), market_id, 2, asset_in, amount_in, min_amount_out); + } + + #[benchmark] + fn join() { + let alice: T::AccountId = whitelisted_caller(); + let base_asset = Asset::Ztg; + let market_id = create_market_and_deploy_pool::( + alice.clone(), + base_asset, + 2u16, + _10.saturated_into(), + ); + let pool_shares_amount = _1.saturated_into(); + let max_amounts_in = vec![u128::MAX.saturated_into(), u128::MAX.saturated_into()]; + + assert_ok!(T::MultiCurrency::deposit(base_asset, &alice, pool_shares_amount)); + assert_ok_with_transaction!(T::CompleteSetOperations::buy_complete_set( + alice.clone(), + market_id, + pool_shares_amount + )); + + #[extrinsic_call] + _(RawOrigin::Signed(alice), market_id, pool_shares_amount, max_amounts_in); + } + + // There are two execution paths in `exit`: 1) Keep pool alive or 2) destroy it. Clearly 1) is + // heavier. + #[benchmark] + fn exit() { + let alice: T::AccountId = whitelisted_caller(); + let base_asset = Asset::Ztg; + let market_id = create_market_and_deploy_pool::( + alice.clone(), + base_asset, + 2u16, + _10.saturated_into(), + ); + let pool_shares_amount = _1.saturated_into(); + let min_amounts_out = vec![0u8.saturated_into(), 0u8.saturated_into()]; + + #[extrinsic_call] + _(RawOrigin::Signed(alice), market_id, pool_shares_amount, min_amounts_out); + + assert!(Pools::::contains_key(market_id)); // Ensure we took the right turn. + } + + #[benchmark] + fn withdraw_fees() { + let alice: T::AccountId = whitelisted_caller(); + let base_asset = Asset::Ztg; + let market_id = create_market_and_deploy_pool::( + alice.clone(), + base_asset, + 2u16, + _10.saturated_into(), + ); + let fee_amount = _1.saturated_into(); + + // Mock up some fees. + let mut pool = Pools::::get(market_id).unwrap(); + assert_ok!(T::MultiCurrency::deposit(base_asset, &pool.account_id, fee_amount)); + assert_ok!(pool.liquidity_shares_manager.deposit_fees(fee_amount)); + Pools::::insert(market_id, pool); + + #[extrinsic_call] + _(RawOrigin::Signed(alice), market_id); + } + + #[benchmark] + fn deploy_pool() { + let alice: T::AccountId = whitelisted_caller(); + let base_asset = Asset::Ztg; + let market_id = create_market::(alice.clone(), base_asset, 2); + let amount = _10.saturated_into(); + let total_cost = amount + T::MultiCurrency::minimum_balance(base_asset); + + assert_ok!(T::MultiCurrency::deposit(base_asset, &alice, total_cost)); + assert_ok_with_transaction!(T::CompleteSetOperations::buy_complete_set( + alice.clone(), + market_id, + amount + )); + + #[extrinsic_call] + _( + RawOrigin::Signed(alice), + market_id, + amount, + vec![_1_2.saturated_into(), _1_2.saturated_into()], + CENT.saturated_into(), + ); + } + + impl_benchmark_test_suite!( + NeoSwaps, + crate::mock::ExtBuilder::default().build(), + crate::mock::Runtime + ); +} diff --git a/zrml/neo-swaps/src/consts.rs b/zrml/neo-swaps/src/consts.rs new file mode 100644 index 000000000..cab971b4b --- /dev/null +++ b/zrml/neo-swaps/src/consts.rs @@ -0,0 +1,47 @@ +// Copyright 2023 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 zeitgeist_primitives::constants::BASE; + +pub(crate) const EXP_NUMERICAL_LIMIT: u128 = 20; // Numerical limit for exp arguments. +pub(crate) const MAX_ASSETS: u16 = 128; + +pub(crate) const _1: u128 = BASE; +pub(crate) const _2: u128 = 2 * _1; +pub(crate) const _3: u128 = 3 * _1; +pub(crate) const _4: u128 = 4 * _1; +pub(crate) const _5: u128 = 5 * _1; +pub(crate) const _9: u128 = 9 * _1; +pub(crate) const _10: u128 = 10 * _1; +pub(crate) const _20: u128 = 20 * _1; +pub(crate) const _70: u128 = 70 * _1; +pub(crate) const _80: u128 = 80 * _1; +pub(crate) const _100: u128 = 100 * _1; +pub(crate) const _101: u128 = 101 * _1; + +pub(crate) const _1_2: u128 = _1 / 2; + +pub(crate) const _1_3: u128 = _1 / 3; +pub(crate) const _2_3: u128 = _2 / 3; + +pub(crate) const _1_4: u128 = _1 / 4; +pub(crate) const _3_4: u128 = _3 / 4; + +pub(crate) const _1_5: u128 = _1 / 5; + +pub(crate) const _1_6: u128 = _1 / 6; +pub(crate) const _5_6: u128 = _5 / 6; diff --git a/zrml/neo-swaps/src/lib.rs b/zrml/neo-swaps/src/lib.rs new file mode 100644 index 000000000..a2bf01d6a --- /dev/null +++ b/zrml/neo-swaps/src/lib.rs @@ -0,0 +1,878 @@ +// Copyright 2023 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 . + +#![doc = include_str!("../README.md")] +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; + +mod benchmarking; +mod consts; +mod math; +mod mock; +mod tests; +pub mod traits; +pub mod types; +pub mod weights; + +pub use pallet::*; + +#[frame_support::pallet] +mod pallet { + use crate::{ + consts::MAX_ASSETS, + math::{Math, MathOps}, + traits::{pool_operations::PoolOperations, DistributeFees, LiquiditySharesManager}, + types::{FeeDistribution, Pool, SoloLp}, + weights::*, + }; + use alloc::{collections::BTreeMap, vec, vec::Vec}; + use core::marker::PhantomData; + use frame_support::{ + dispatch::DispatchResultWithPostInfo, + ensure, + pallet_prelude::StorageMap, + require_transactional, + traits::{Get, IsType, StorageVersion}, + transactional, PalletId, Twox64Concat, + }; + use frame_system::{ensure_signed, pallet_prelude::OriginFor}; + use orml_traits::MultiCurrency; + use sp_runtime::{ + traits::{AccountIdConversion, CheckedSub, Saturating, Zero}, + DispatchError, DispatchResult, SaturatedConversion, + }; + use zeitgeist_primitives::{ + constants::{BASE, CENT}, + math::fixed::{bdiv, bmul}, + traits::{CompleteSetOperationsApi, DeployPoolApi}, + types::{Asset, MarketStatus, MarketType, ScalarPosition, ScoringRule}, + }; + use zrml_market_commons::MarketCommonsPalletApi; + + // These should not be config parameters to avoid misconfigurations. + pub(crate) const MIN_SWAP_FEE: u128 = BASE / 1_000; // 0.1%. + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); + pub(crate) const MAX_SPOT_PRICE: u128 = BASE - CENT / 2; + pub(crate) const MIN_SPOT_PRICE: u128 = CENT / 2; + pub(crate) const MIN_LIQUIDITY: u128 = BASE; + + pub(crate) type AccountIdOf = ::AccountId; + pub(crate) type AssetOf = Asset>; + pub(crate) type BalanceOf = + <::MultiCurrency as MultiCurrency>>::Balance; + pub(crate) type AssetIndexType = u16; + pub(crate) type MarketIdOf = + <::MarketCommons as MarketCommonsPalletApi>::MarketId; + pub(crate) type PoolOf = Pool>; + + #[pallet::config] + pub trait Config: frame_system::Config { + type CompleteSetOperations: CompleteSetOperationsApi< + AccountId = Self::AccountId, + Balance = BalanceOf, + MarketId = MarketIdOf, + >; + + /// Distribute external fees. The fees are paid from the pool account, which in turn has + /// received the fees from the trader. + type ExternalFees: DistributeFees< + Asset = AssetOf, + AccountId = AccountIdOf, + Balance = BalanceOf, + MarketId = MarketIdOf, + >; + + type MarketCommons: MarketCommonsPalletApi; + + type MultiCurrency: MultiCurrency>; + + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + type WeightInfo: WeightInfoZeitgeist; + + #[pallet::constant] + type MaxSwapFee: Get>; + + #[pallet::constant] + type PalletId: Get; + } + + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(PhantomData); + + #[pallet::storage] + #[pallet::getter(fn pools)] + pub type Pools = StorageMap<_, Twox64Concat, MarketIdOf, PoolOf>; + + #[pallet::event] + #[pallet::generate_deposit(fn deposit_event)] + pub enum Event + where + T: Config, + { + /// Informant bought a position. + BuyExecuted { + who: T::AccountId, + market_id: MarketIdOf, + asset_out: AssetOf, + amount_in: BalanceOf, + amount_out: BalanceOf, + swap_fee_amount: BalanceOf, + external_fee_amount: BalanceOf, + }, + /// Informant sold a position. + SellExecuted { + who: T::AccountId, + market_id: MarketIdOf, + asset_in: AssetOf, + amount_in: BalanceOf, + amount_out: BalanceOf, + swap_fee_amount: BalanceOf, + external_fee_amount: BalanceOf, + }, + /// Liquidity provider withdrew fees. + FeesWithdrawn { who: T::AccountId, market_id: MarketIdOf, amount: BalanceOf }, + /// Liquidity provider joined the pool. + JoinExecuted { + who: T::AccountId, + market_id: MarketIdOf, + pool_shares_amount: BalanceOf, + amounts_in: Vec>, + new_liquidity_parameter: BalanceOf, + }, + /// Liquidity provider left the pool. + ExitExecuted { + who: T::AccountId, + market_id: MarketIdOf, + pool_shares_amount: BalanceOf, + amounts_out: Vec>, + new_liquidity_parameter: BalanceOf, + }, + /// Pool was createed. + PoolDeployed { + who: T::AccountId, + market_id: MarketIdOf, + pool_shares_amount: BalanceOf, + amounts_in: Vec>, + liquidity_parameter: BalanceOf, + }, + /// Pool was destroyed. + PoolDestroyed { + who: T::AccountId, + market_id: MarketIdOf, + pool_shares_amount: BalanceOf, + amounts_out: Vec>, + }, + } + + #[pallet::error] + pub enum Error { + /// The number of assets in the pool is above the allowed maximum. + AssetCountAboveMax, + /// Amount paid is above the specified maximum. + AmountInAboveMax, + /// Amount received is below the specified minimum. + AmountOutBelowMin, + /// Specified asset was not found in this pool. + AssetNotFound, + /// Market already has an associated pool. + DuplicatePool, + /// Incorrect asset count. + IncorrectAssetCount, + // Length of `max_amounts_in`, `max_amounts_out` or `spot_prices` must be equal to the + // number of outcomes in the market. + IncorrectVecLen, + /// User doesn't own enough pool shares. + InsufficientPoolShares, + /// The liquidity in the pool is too low. + LiquidityTooLow, + /// Sum of spot prices is not `1`. + InvalidSpotPrices, + /// Market's trading mechanism is not LMSR. + InvalidTradingMechanism, + /// Pool can only be traded on if the market is active. + MarketNotActive, + /// Deploying pools is only supported for scalar or binary markets. + MarketNotBinaryOrScalar, + /// Some calculation failed. This shouldn't happen. + MathError, + /// The user is not allowed to execute this command. + NotAllowed, + /// This feature is not yet implemented. + NotImplemented, + /// Some value in the operation is too large or small. + NumericalLimits, + /// Outstanding fees prevent liquidity withdrawal. + OutstandingFees, + /// Specified market does not have a pool. + PoolNotFound, + /// Spot price is above the allowed maximum. + SpotPriceAboveMax, + /// Spot price is below the allowed minimum. + SpotPriceBelowMin, + /// Pool's swap fee exceeds the allowed upper limit. + SwapFeeAboveMax, + /// Pool's swap fee is below the allowed lower limit. + SwapFeeBelowMin, + /// This shouldn't happen. + Unexpected, + /// Specified monetary amount is zero. + ZeroAmount, + } + + #[pallet::call] + impl Pallet { + /// Buy outcome tokens from the specified market. + /// + /// The `amount_in` is paid in collateral. The transaction fails if the amount of outcome + /// tokens received is smaller than `min_amount_out`. The user must correctly specify the + /// number of outcomes for benchmarking reasons. + /// + /// # Parameters + /// + /// - `origin`: The origin account making the purchase. + /// - `market_id`: Identifier for the market related to the trade. + /// - `asset_count`: Number of assets in the pool. + /// - `asset_out`: Asset to be purchased. + /// - `amount_in`: Amount of collateral paid by the user. + /// - `min_amount_out`: Minimum number of outcome tokens the user expects to receive. + /// + /// # Complexity + /// + /// Depends on the implementation of `CompleteSetOperationsApi` and `ExternalFees`; when + /// using the canonical implementations, the runtime complexity is `O(asset_count)`. + #[pallet::call_index(0)] + #[pallet::weight(T::WeightInfo::buy())] + #[transactional] + pub fn buy( + origin: OriginFor, + #[pallet::compact] market_id: MarketIdOf, + asset_count: AssetIndexType, + asset_out: AssetOf, + #[pallet::compact] amount_in: BalanceOf, + #[pallet::compact] min_amount_out: BalanceOf, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let asset_count_real = T::MarketCommons::market(&market_id)?.outcomes(); + ensure!(asset_count == asset_count_real, Error::::IncorrectAssetCount); + Self::do_buy(who, market_id, asset_out, amount_in, min_amount_out)?; + Ok(Some(T::WeightInfo::buy()).into()) + } + + /// Sell outcome tokens to the specified market. + /// + /// The `amount_in` is paid in outcome tokens. The transaction fails if the amount of outcome + /// tokens received is smaller than `min_amount_out`. The user must correctly specify the + /// number of outcomes for benchmarking reasons. + /// + /// # Parameters + /// + /// - `origin`: The origin account making the sale. + /// - `market_id`: Identifier for the market related to the trade. + /// - `asset_count`: Number of assets in the pool. + /// - `asset_in`: Asset to be sold. + /// - `amount_in`: Amount of outcome tokens paid by the user. + /// - `min_amount_out`: Minimum amount of collateral the user expects to receive. + /// + /// # Complexity + /// + /// Depends on the implementation of `CompleteSetOperationsApi` and `ExternalFees`; when + /// using the canonical implementations, the runtime complexity is `O(asset_count)`. + #[pallet::call_index(1)] + #[pallet::weight(T::WeightInfo::sell())] + #[transactional] + pub fn sell( + origin: OriginFor, + #[pallet::compact] market_id: MarketIdOf, + asset_count: AssetIndexType, + asset_in: AssetOf, + #[pallet::compact] amount_in: BalanceOf, + #[pallet::compact] min_amount_out: BalanceOf, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let asset_count_real = T::MarketCommons::market(&market_id)?.outcomes(); + ensure!(asset_count == asset_count_real, Error::::IncorrectAssetCount); + Self::do_sell(who, market_id, asset_in, amount_in, min_amount_out)?; + Ok(Some(T::WeightInfo::sell()).into()) + } + + /// Join the liquidity pool for the specified market. + /// + /// The LP receives pool shares in exchange for staking outcome tokens into the pool. The + /// `max_amounts_in` vector specifies the maximum number of each outcome token that the LP is + /// willing to deposit. These amounts are used to adjust the outcome balances in the pool + /// according to the new proportion of pool shares owned by the LP. + /// + /// Note that the user must acquire the outcome tokens in a separate transaction, either by + /// buying from the pool or by using complete set operations. + /// + /// # Parameters + /// + /// - `market_id`: Identifier for the market related to the pool. + /// - `pool_shares_amount`: The number of new pool shares the LP will receive. + /// - `max_amounts_in`: Vector of the maximum amounts of each outcome token the LP is + /// willing to deposit (with outcomes specified in the order of `MarketCommonsApi`). + /// + /// # Complexity + /// + /// `O(n)` where `n` is the number of assets in the pool. + #[pallet::call_index(2)] + #[pallet::weight(T::WeightInfo::join())] + #[transactional] + pub fn join( + origin: OriginFor, + #[pallet::compact] market_id: MarketIdOf, + #[pallet::compact] pool_shares_amount: BalanceOf, + max_amounts_in: Vec>, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let asset_count = T::MarketCommons::market(&market_id)?.outcomes(); + ensure!(max_amounts_in.len() == asset_count as usize, Error::::IncorrectVecLen); + Self::do_join(who, market_id, pool_shares_amount, max_amounts_in)?; + Ok(Some(T::WeightInfo::join()).into()) + } + + /// Exit the liquidity pool for the specified market. + /// + /// The LP relinquishes pool shares in exchange for withdrawing outcome tokens from the + /// pool. The `min_amounts_out` vector specifies the minimum number of each outcome token + /// that the LP expects to withdraw. These minimum amounts are used to adjust the outcome + /// balances in the pool, taking into account the reduction in the LP's pool share + /// ownership. + /// + /// The transaction will fail unless the LP withdraws their fees from the pool beforehand. A + /// batch transaction is very useful here. + /// + /// If the LP withdraws all pool shares that exist, then the pool is afterwards destroyed. A + /// new pool can be deployed at any time, provided that the market is still open. + /// + /// The LP is not allowed to leave a positive but small amount liquidity in the pool. If the + /// liquidity parameter drops below a certain threshold, the transaction will fail. The only + /// solution is to withdraw _all_ liquidity and let the pool die. + /// + /// # Parameters + /// + /// - `market_id`: Identifier for the market related to the pool. + /// - `pool_shares_amount_out`: The number of pool shares the LP will relinquish. + /// - `min_amounts_out`: Vector of the minimum amounts of each outcome token the LP expects + /// to withdraw (with outcomes specified in the order given by `MarketCommonsApi`). + /// + /// # Complexity + /// + /// `O(n)` where `n` is the number of assets in the pool. + #[pallet::call_index(3)] + #[pallet::weight(T::WeightInfo::exit())] + #[transactional] + pub fn exit( + origin: OriginFor, + #[pallet::compact] market_id: MarketIdOf, + #[pallet::compact] pool_shares_amount_out: BalanceOf, + min_amounts_out: Vec>, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let asset_count = T::MarketCommons::market(&market_id)?.outcomes(); + ensure!(min_amounts_out.len() == asset_count as usize, Error::::IncorrectVecLen); + Self::do_exit(who, market_id, pool_shares_amount_out, min_amounts_out)?; + Ok(Some(T::WeightInfo::exit()).into()) + } + + /// Withdraw swap fees from the specified market. + /// + /// The transaction will fail if the caller is not a liquidity provider. Should always be + /// used before calling `exit`. + /// + /// # Parameters + /// + /// - `market_id`: Identifier for the market related to the pool. + /// + /// # Complexity + /// + /// `O(1)`. + #[pallet::call_index(4)] + #[pallet::weight(T::WeightInfo::withdraw_fees())] + #[transactional] + pub fn withdraw_fees( + origin: OriginFor, + #[pallet::compact] market_id: MarketIdOf, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + Self::do_withdraw_fees(who, market_id)?; + Ok(()) + } + + /// Deploy a pool for the specified market and provide liquidity. + /// + /// The sender specifies a vector of `spot_prices` for the market's outcomes in the order + /// given by the `MarketCommonsApi`. The transaction will fail if the spot prices don't add + /// up to exactly `BASE`. + /// + /// Depending on the values in the `spot_prices`, the transaction will transfer different + /// amounts of each outcome to the pool. The sender specifies a maximum `amount` of outcome + /// tokens to spend. + /// + /// Note that the sender must acquire the outcome tokens in a separate transaction by using + /// complete set operations. It's therefore convenient to batch this function together with + /// a `buy_complete_set` with `amount` as amount of complete sets to buy. + /// + /// Deploying the pool will cost the signer an additional fee to the tune of the + /// collateral's existential deposit. This fee is placed in the pool account and ensures + /// that swap fees can be stored in the pool account without triggering dusting or failed + /// transfers. + /// + /// The operation is currently limited to binary and scalar markets. + /// + /// # Complexity + /// + /// `O(n)` where `n` is the number of outcomes in the specified market. + #[pallet::call_index(5)] + #[pallet::weight(T::WeightInfo::deploy_pool())] + #[transactional] + pub fn deploy_pool( + origin: OriginFor, + #[pallet::compact] market_id: MarketIdOf, + #[pallet::compact] amount: BalanceOf, + spot_prices: Vec>, + #[pallet::compact] swap_fee: BalanceOf, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let asset_count = T::MarketCommons::market(&market_id)?.outcomes() as u32; + ensure!(spot_prices.len() == asset_count as usize, Error::::IncorrectVecLen); + Self::do_deploy_pool(who, market_id, amount, spot_prices, swap_fee)?; + Ok(Some(T::WeightInfo::deploy_pool()).into()) + } + } + + impl Pallet { + #[require_transactional] + fn do_buy( + who: T::AccountId, + market_id: MarketIdOf, + asset_out: AssetOf, + amount_in: BalanceOf, + min_amount_out: BalanceOf, + ) -> DispatchResult { + ensure!(amount_in != Zero::zero(), Error::::ZeroAmount); + let market = T::MarketCommons::market(&market_id)?; + ensure!(market.status == MarketStatus::Active, Error::::MarketNotActive); + Self::try_mutate_pool(&market_id, |pool| { + ensure!(pool.contains(&asset_out), Error::::AssetNotFound); + // Defensive check (shouldn't ever happen)! + ensure!( + pool.calculate_spot_price(asset_out)? <= MAX_SPOT_PRICE.saturated_into(), + Error::::Unexpected + ); + ensure!(amount_in <= pool.calculate_max_amount_in(), Error::::NumericalLimits); + T::MultiCurrency::transfer(pool.collateral, &who, &pool.account_id, amount_in)?; + let FeeDistribution { + remaining: amount_in_minus_fees, + swap_fees: swap_fee_amount, + external_fees: external_fee_amount, + } = Self::distribute_fees(market_id, pool, amount_in)?; + let swap_amount_out = + pool.calculate_swap_amount_out_for_buy(asset_out, amount_in_minus_fees)?; + let amount_out = swap_amount_out.saturating_add(amount_in_minus_fees); + ensure!(amount_out >= min_amount_out, Error::::AmountOutBelowMin); + // Instead of letting `who` buy the complete sets and then transfer almost all of + // the outcomes to the pool account, we prevent `(n-1)` storage reads by using the + // pool account to buy. Note that the fees are already in the pool at this point. + T::CompleteSetOperations::buy_complete_set( + pool.account_id.clone(), + market_id, + amount_in_minus_fees, + )?; + T::MultiCurrency::transfer(asset_out, &pool.account_id, &who, amount_out)?; + for asset in pool.assets().iter() { + pool.increase_reserve(asset, &amount_in_minus_fees)?; + if *asset == asset_out { + pool.decrease_reserve(asset, &amount_out)?; + } + } + let new_price = pool.calculate_spot_price(asset_out)?; + ensure!( + new_price <= MAX_SPOT_PRICE.saturated_into(), + Error::::SpotPriceAboveMax + ); + Self::deposit_event(Event::::BuyExecuted { + who: who.clone(), + market_id, + asset_out, + amount_in, + amount_out, + swap_fee_amount, + external_fee_amount, + }); + Ok(()) + }) + } + + #[require_transactional] + fn do_sell( + who: T::AccountId, + market_id: MarketIdOf, + asset_in: AssetOf, + amount_in: BalanceOf, + min_amount_out: BalanceOf, + ) -> DispatchResult { + ensure!(amount_in != Zero::zero(), Error::::ZeroAmount); + let market = T::MarketCommons::market(&market_id)?; + ensure!(market.status == MarketStatus::Active, Error::::MarketNotActive); + Self::try_mutate_pool(&market_id, |pool| { + ensure!(pool.contains(&asset_in), Error::::AssetNotFound); + // Defensive check (shouldn't ever happen)! + ensure!( + pool.calculate_spot_price(asset_in)? >= MIN_SPOT_PRICE.saturated_into(), + Error::::Unexpected + ); + ensure!(amount_in <= pool.calculate_max_amount_in(), Error::::NumericalLimits); + // Instead of first executing a swap with `(n-1)` transfers from the pool account to + // `who` and then selling complete sets, we prevent `(n-1)` storage reads: 1) + // Transfer `amount_in` units of `asset_in` to the pool account, 2) sell + // `amount_out` complete sets using the pool account, 3) transfer + // `amount_out_minus_fees` units of collateral to `who`. The fees automatically end + // up in the pool. + let amount_out = pool.calculate_swap_amount_out_for_sell(asset_in, amount_in)?; + // Beware! This transfer happen _after_ calculating `amount_out`: + T::MultiCurrency::transfer(asset_in, &who, &pool.account_id, amount_in)?; + T::CompleteSetOperations::sell_complete_set( + pool.account_id.clone(), + market_id, + amount_out, + )?; + let FeeDistribution { + remaining: amount_out_minus_fees, + swap_fees: swap_fee_amount, + external_fees: external_fee_amount, + } = Self::distribute_fees(market_id, pool, amount_out)?; + ensure!(amount_out_minus_fees >= min_amount_out, Error::::AmountOutBelowMin); + T::MultiCurrency::transfer( + pool.collateral, + &pool.account_id, + &who, + amount_out_minus_fees, + )?; + for asset in pool.assets().iter() { + if *asset == asset_in { + pool.increase_reserve(asset, &amount_in)?; + } + pool.decrease_reserve(asset, &amount_out)?; + } + let new_price = pool.calculate_spot_price(asset_in)?; + ensure!( + new_price >= MIN_SPOT_PRICE.saturated_into(), + Error::::SpotPriceBelowMin + ); + Self::deposit_event(Event::::SellExecuted { + who: who.clone(), + market_id, + asset_in, + amount_in, + amount_out, + swap_fee_amount, + external_fee_amount, + }); + Ok(()) + }) + } + + #[require_transactional] + fn do_join( + who: T::AccountId, + market_id: MarketIdOf, + pool_shares_amount: BalanceOf, + max_amounts_in: Vec>, + ) -> DispatchResult { + ensure!(pool_shares_amount != Zero::zero(), Error::::ZeroAmount); + let market = T::MarketCommons::market(&market_id)?; + ensure!(market.status == MarketStatus::Active, Error::::MarketNotActive); + Self::try_mutate_pool(&market_id, |pool| { + // FIXME Round up to avoid exploits. + let ratio = bdiv( + pool_shares_amount.saturated_into(), + pool.liquidity_shares_manager.total_shares()?.saturated_into(), + )?; + let mut amounts_in = vec![]; + for (&asset, &max_amount_in) in pool.assets().iter().zip(max_amounts_in.iter()) { + let balance_in_pool = pool.reserve_of(&asset)?; + // FIXME Round up to avoid exploits. + let amount_in = bmul(ratio, balance_in_pool.saturated_into())?.saturated_into(); + amounts_in.push(amount_in); + ensure!(amount_in <= max_amount_in, Error::::AmountInAboveMax); + T::MultiCurrency::transfer(asset, &who, &pool.account_id, amount_in)?; + } + for ((_, balance), &amount_in) in pool.reserves.iter_mut().zip(amounts_in.iter()) { + *balance = balance.saturating_add(amount_in); + } + pool.liquidity_shares_manager.join(&who, pool_shares_amount)?; + let new_liquidity_parameter = pool.liquidity_parameter.saturating_add( + bmul(ratio.saturated_into(), pool.liquidity_parameter.saturated_into())? + .saturated_into(), + ); + pool.liquidity_parameter = new_liquidity_parameter; + Self::deposit_event(Event::::JoinExecuted { + who: who.clone(), + market_id, + pool_shares_amount, + amounts_in, + new_liquidity_parameter, + }); + Ok(()) + }) + } + + #[require_transactional] + fn do_exit( + who: T::AccountId, + market_id: MarketIdOf, + pool_shares_amount: BalanceOf, + min_amounts_out: Vec>, + ) -> DispatchResult { + ensure!(pool_shares_amount != Zero::zero(), Error::::ZeroAmount); + let _ = T::MarketCommons::market(&market_id)?; + Pools::::try_mutate_exists(market_id, |maybe_pool| { + let pool = + maybe_pool.as_mut().ok_or::(Error::::PoolNotFound.into())?; + ensure!( + pool.liquidity_shares_manager.fees == Zero::zero(), + Error::::OutstandingFees + ); + let ratio = bdiv( + pool_shares_amount.saturated_into(), + pool.liquidity_shares_manager.total_shares()?.saturated_into(), + )?; + let mut amounts_out = vec![]; + for (&asset, &min_amount_out) in pool.assets().iter().zip(min_amounts_out.iter()) { + let balance_in_pool = pool.reserve_of(&asset)?; + let amount_out: BalanceOf = + bmul(ratio, balance_in_pool.saturated_into())?.saturated_into(); + amounts_out.push(amount_out); + ensure!(amount_out >= min_amount_out, Error::::AmountOutBelowMin); + T::MultiCurrency::transfer(asset, &pool.account_id, &who, amount_out)?; + } + for ((_, balance), &amount_out) in pool.reserves.iter_mut().zip(amounts_out.iter()) + { + *balance = balance.saturating_sub(amount_out); + } + pool.liquidity_shares_manager.exit(&who, pool_shares_amount)?; + if pool.liquidity_shares_manager.total_shares()? == Zero::zero() { + // FIXME We will withdraw all remaining funds (the "buffer"). This is an ugly + // hack and system should offer the option to whitelist accounts. + let remaining = + T::MultiCurrency::free_balance(pool.collateral, &pool.account_id); + T::MultiCurrency::withdraw(pool.collateral, &pool.account_id, remaining)?; + *maybe_pool = None; // Delete the storage map entry. + Self::deposit_event(Event::::PoolDestroyed { + who: who.clone(), + market_id, + pool_shares_amount, + amounts_out, + }); + } else { + let liq = pool.liquidity_parameter; + let new_liquidity_parameter = liq.saturating_sub( + bmul(ratio.saturated_into(), liq.saturated_into())?.saturated_into(), + ); + ensure!( + new_liquidity_parameter >= MIN_LIQUIDITY.saturated_into(), + Error::::LiquidityTooLow + ); + pool.liquidity_parameter = new_liquidity_parameter; + Self::deposit_event(Event::::ExitExecuted { + who: who.clone(), + market_id, + pool_shares_amount, + amounts_out, + new_liquidity_parameter, + }); + } + Ok(()) + }) + } + + #[require_transactional] + fn do_withdraw_fees(who: T::AccountId, market_id: MarketIdOf) -> DispatchResult { + Self::try_mutate_pool(&market_id, |pool| { + let amount = pool.liquidity_shares_manager.withdraw_fees(&who)?; + T::MultiCurrency::transfer(pool.collateral, &pool.account_id, &who, amount)?; // Should never fail. + Self::deposit_event(Event::::FeesWithdrawn { + who: who.clone(), + market_id, + amount, + }); + Ok(()) + }) + } + + #[require_transactional] + fn do_deploy_pool( + who: T::AccountId, + market_id: MarketIdOf, + amount: BalanceOf, + spot_prices: Vec>, + swap_fee: BalanceOf, + ) -> DispatchResult { + ensure!(!Pools::::contains_key(market_id), Error::::DuplicatePool); + let market = T::MarketCommons::market(&market_id)?; + ensure!(market.creator == who, Error::::NotAllowed); + ensure!(market.status == MarketStatus::Active, Error::::MarketNotActive); + ensure!(market.scoring_rule == ScoringRule::Lmsr, Error::::InvalidTradingMechanism); + let asset_count = spot_prices.len(); + ensure!(asset_count as u16 == market.outcomes(), Error::::IncorrectVecLen); + ensure!(market.outcomes() == 2, Error::::MarketNotBinaryOrScalar); + ensure!(market.outcomes() <= MAX_ASSETS, Error::::AssetCountAboveMax); + ensure!(swap_fee >= MIN_SWAP_FEE.saturated_into(), Error::::SwapFeeBelowMin); + ensure!(swap_fee <= T::MaxSwapFee::get(), Error::::SwapFeeAboveMax); + ensure!( + spot_prices + .iter() + .fold(Zero::zero(), |acc: BalanceOf, &val| acc.saturating_add(val)) + == BASE.saturated_into(), + Error::::InvalidSpotPrices + ); + for &p in spot_prices.iter() { + ensure!( + p.saturated_into::() >= MIN_SPOT_PRICE, + Error::::SpotPriceBelowMin + ); + ensure!( + p.saturated_into::() <= MAX_SPOT_PRICE, + Error::::SpotPriceAboveMax + ); + } + let (liquidity_parameter, amounts_in) = + Math::::calculate_reserves_from_spot_prices(amount, spot_prices)?; + ensure!( + liquidity_parameter >= MIN_LIQUIDITY.saturated_into(), + Error::::LiquidityTooLow + ); + let pool_account_id = Self::pool_account_id(&market_id); + let assets = Self::outcomes(market_id)?; + let mut reserves = BTreeMap::new(); + for (&amount_in, &asset) in amounts_in.iter().zip(assets.iter()) { + T::MultiCurrency::transfer(asset, &who, &pool_account_id, amount_in)?; + let _ = reserves.insert(asset, amount_in); + } + let pool = Pool { + account_id: pool_account_id, + reserves, + collateral: market.base_asset, + liquidity_parameter, + liquidity_shares_manager: SoloLp::new(who.clone(), amount), + swap_fee, + }; + // FIXME Ensure that the existential deposit doesn't kill fees. This is an ugly hack and + // system should offer the option to whitelist accounts. + T::MultiCurrency::transfer( + pool.collateral, + &who, + &pool.account_id, + T::MultiCurrency::minimum_balance(pool.collateral), + )?; + Pools::::insert(market_id, pool); + Self::deposit_event(Event::::PoolDeployed { + who, + market_id, + pool_shares_amount: amount, + amounts_in, + liquidity_parameter, + }); + Ok(()) + } + + #[inline] + pub(crate) fn pool_account_id(market_id: &MarketIdOf) -> T::AccountId { + T::PalletId::get().into_sub_account_truncating((*market_id).saturated_into::()) + } + + /// Distribute swap fees and external fees and returns the remaining amount. + /// + /// # Arguments + /// + /// - `market_id`: The ID of the market to which the pool belongs. + /// - `pool`: The pool on which the trade was executed. + /// - `amount`: The gross amount from which the fee is deduced. + /// + /// Will fail if the total amount of fees is more than the gross amount. In particular, the + /// function will fail if the external fees exceed the gross amount. + #[require_transactional] + fn distribute_fees( + market_id: MarketIdOf, + pool: &mut PoolOf, + amount: BalanceOf, + ) -> Result, DispatchError> { + let swap_fees_u128 = bmul(pool.swap_fee.saturated_into(), amount.saturated_into())?; + let swap_fees = swap_fees_u128.saturated_into(); + pool.liquidity_shares_manager.deposit_fees(swap_fees)?; // Should only error unexpectedly! + let external_fees = T::ExternalFees::distribute( + market_id, + pool.collateral, + pool.account_id.clone(), + amount, + ); + let total_fees = external_fees.saturating_add(swap_fees); + let remaining = amount.checked_sub(&total_fees).ok_or(Error::::Unexpected)?; + Ok(FeeDistribution { remaining, swap_fees, external_fees }) + } + + // FIXME Carbon copy of a function in prediction-markets. To be removed later. + fn outcomes(market_id: MarketIdOf) -> Result>, DispatchError> { + let market = T::MarketCommons::market(&market_id)?; + Ok(match market.market_type { + MarketType::Categorical(categories) => { + let mut assets = Vec::new(); + for i in 0..categories { + assets.push(Asset::CategoricalOutcome(market_id, i)); + } + assets + } + MarketType::Scalar(_) => { + vec![ + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + Asset::ScalarOutcome(market_id, ScalarPosition::Short), + ] + } + }) + } + + fn try_mutate_pool(market_id: &MarketIdOf, mutator: F) -> DispatchResult + where + F: FnMut(&mut PoolOf) -> DispatchResult, + { + Pools::::try_mutate(market_id, |maybe_pool| { + maybe_pool.as_mut().ok_or(Error::::PoolNotFound.into()).and_then(mutator) + }) + } + } + + impl DeployPoolApi for Pallet { + type AccountId = T::AccountId; + type Balance = BalanceOf; + type MarketId = MarketIdOf; + + fn deploy_pool( + who: Self::AccountId, + market_id: Self::MarketId, + amount: Self::Balance, + spot_prices: Vec, + swap_fee: Self::Balance, + ) -> DispatchResult { + Self::do_deploy_pool(who, market_id, amount, spot_prices, swap_fee) + } + } +} diff --git a/zrml/neo-swaps/src/math.rs b/zrml/neo-swaps/src/math.rs new file mode 100644 index 000000000..f0978deb6 --- /dev/null +++ b/zrml/neo-swaps/src/math.rs @@ -0,0 +1,282 @@ +// Copyright 2023 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::{BalanceOf, Config, Error}; +use alloc::vec::Vec; +use core::marker::PhantomData; +use fixed::FixedU128; +use hydra_dx_math::transcendental::{exp, ln}; +use sp_runtime::{DispatchError, SaturatedConversion}; +use typenum::U80; + +type Fractional = U80; +type Fixed = FixedU128; + +pub(crate) trait MathOps { + fn calculate_swap_amount_out_for_buy( + reserve: BalanceOf, + amount_in: BalanceOf, + liquidity: BalanceOf, + ) -> Result, DispatchError>; + fn calculate_swap_amount_out_for_sell( + reserve: BalanceOf, + amount_in: BalanceOf, + liquidity: BalanceOf, + ) -> Result, DispatchError>; + fn calculate_spot_price( + reserve: BalanceOf, + liquidity: BalanceOf, + ) -> Result, DispatchError>; + fn calculate_reserves_from_spot_prices( + amount: BalanceOf, + spot_prices: Vec>, + ) -> Result<(BalanceOf, Vec>), DispatchError>; +} + +pub(crate) struct Math(PhantomData); + +impl MathOps for Math { + fn calculate_swap_amount_out_for_buy( + reserve: BalanceOf, + amount_in: BalanceOf, + liquidity: BalanceOf, + ) -> Result, DispatchError> { + let reserve = reserve.saturated_into(); + let amount_in = amount_in.saturated_into(); + let liquidity = liquidity.saturated_into(); + detail::calculate_swap_amount_out_for_buy(reserve, amount_in, liquidity) + .map(|result| result.saturated_into()) + .ok_or_else(|| Error::::MathError.into()) + } + + fn calculate_swap_amount_out_for_sell( + reserve: BalanceOf, + amount_in: BalanceOf, + liquidity: BalanceOf, + ) -> Result, DispatchError> { + let reserve = reserve.saturated_into(); + let amount_in = amount_in.saturated_into(); + let liquidity = liquidity.saturated_into(); + detail::calculate_swap_amount_out_for_sell(reserve, amount_in, liquidity) + .map(|result| result.saturated_into()) + .ok_or_else(|| Error::::MathError.into()) + } + + fn calculate_spot_price( + reserve: BalanceOf, + liquidity: BalanceOf, + ) -> Result, DispatchError> { + let reserve = reserve.saturated_into(); + let liquidity = liquidity.saturated_into(); + detail::calculate_spot_price(reserve, liquidity) + .map(|result| result.saturated_into()) + .ok_or_else(|| Error::::MathError.into()) + } + + fn calculate_reserves_from_spot_prices( + amount: BalanceOf, + spot_prices: Vec>, + ) -> Result<(BalanceOf, Vec>), DispatchError> { + let amount = amount.saturated_into(); + let spot_prices = spot_prices.into_iter().map(|p| p.saturated_into()).collect(); + let (liquidity, spot_prices) = + detail::calculate_reserves_from_spot_prices(amount, spot_prices) + .ok_or_else(|| -> DispatchError { Error::::MathError.into() })?; + let liquidity = liquidity.saturated_into(); + let spot_prices = spot_prices.into_iter().map(|p| p.saturated_into()).collect(); + Ok((liquidity, spot_prices)) + } +} + +mod detail { + use super::*; + use zeitgeist_primitives::{ + constants::DECIMALS, + math::fixed::{IntoFixedDecimal, IntoFixedFromDecimal}, + }; + + /// Calculate b * ln( e^(x/b) − 1 + e^(−r_i/b) ) + r_i − x + pub(super) fn calculate_swap_amount_out_for_buy( + reserve: u128, + amount_in: u128, + liquidity: u128, + ) -> Option { + let result_fixed = calculate_swap_amount_out_for_buy_fixed( + to_fixed(reserve)?, + to_fixed(amount_in)?, + to_fixed(liquidity)?, + )?; + from_fixed(result_fixed) + } + + /// Calculate –1 * b * ln( e^(-x/b) − 1 + e^(r_i/b) ) + r_i + pub(super) fn calculate_swap_amount_out_for_sell( + reserve: u128, + amount_in: u128, + liquidity: u128, + ) -> Option { + let result_fixed = calculate_swap_amount_out_for_sell_fixed( + to_fixed(reserve)?, + to_fixed(amount_in)?, + to_fixed(liquidity)?, + )?; + from_fixed(result_fixed) + } + + /// Calculate e^(-r_i/b). + pub(super) fn calculate_spot_price(reserve: u128, liquidity: u128) -> Option { + let result_fixed = calculate_spot_price_fixed(to_fixed(reserve)?, to_fixed(liquidity)?)?; + from_fixed(result_fixed) + } + + pub(super) fn calculate_reserves_from_spot_prices( + amount: u128, + spot_prices: Vec, + ) -> Option<(u128, Vec)> { + let (liquidity_fixed, reserve_fixed) = calculate_reserve_from_spot_prices_fixed( + to_fixed(amount)?, + spot_prices.into_iter().map(to_fixed).collect::>>()?, + )?; + let liquidity = from_fixed(liquidity_fixed)?; + let reserve = reserve_fixed.into_iter().map(from_fixed).collect::>>()?; + Some((liquidity, reserve)) + } + + fn to_fixed(value: B) -> Option + where + B: Into + From, + { + value.to_fixed_from_fixed_decimal(DECIMALS).ok() + } + + fn from_fixed(value: Fixed) -> Option + where + B: Into + From, + { + value.to_fixed_decimal(DECIMALS).ok() + } + + fn calculate_swap_amount_out_for_buy_fixed( + reserve: Fixed, + amount_in: Fixed, + liquidity: Fixed, + ) -> Option { + // FIXME Defensive programming: Check for underflow in x/b and r_i/b. + let exp_x_over_b: Fixed = exp(amount_in.checked_div(liquidity)?, false).ok()?; + let exp_neg_r_over_b = exp(reserve.checked_div(liquidity)?, true).ok()?; + // FIXME Defensive programming: Check for underflow in the exponential expressions. + let inside_ln = + exp_x_over_b.checked_add(exp_neg_r_over_b)?.checked_sub(Fixed::checked_from_num(1)?)?; + let (ln_result, ln_neg) = ln(inside_ln).ok()?; + let blob = liquidity.checked_mul(ln_result)?; + let reserve_plus_blob = + if ln_neg { reserve.checked_sub(blob)? } else { reserve.checked_add(blob)? }; + reserve_plus_blob.checked_sub(amount_in) + } + + fn calculate_swap_amount_out_for_sell_fixed( + reserve: Fixed, + amount_in: Fixed, + liquidity: Fixed, + ) -> Option { + // FIXME Defensive programming: Check for underflow in x/b and r_i/b. + let exp_neg_x_over_b: Fixed = exp(amount_in.checked_div(liquidity)?, true).ok()?; + let exp_r_over_b = exp(reserve.checked_div(liquidity)?, false).ok()?; + // FIXME Defensive programming: Check for underflow in the exponential expressions. + let inside_ln = + exp_neg_x_over_b.checked_add(exp_r_over_b)?.checked_sub(Fixed::checked_from_num(1)?)?; + let (ln_result, ln_neg) = ln(inside_ln).ok()?; + let blob = liquidity.checked_mul(ln_result)?; + if ln_neg { reserve.checked_add(blob) } else { reserve.checked_sub(blob) } + } + + pub(crate) fn calculate_spot_price_fixed(reserve: Fixed, liquidity: Fixed) -> Option { + exp(reserve.checked_div(liquidity)?, true).ok() + } + + fn calculate_reserve_from_spot_prices_fixed( + amount: Fixed, + spot_prices: Vec, + ) -> Option<(Fixed, Vec)> { + // FIXME Defensive programming - ensure against underflows + let tmp_reserves = spot_prices + .iter() + // Drop the bool (second tuple component) as ln(p) is always negative. + .map(|&price| ln(price).map(|(value, _)| value)) + .collect::, _>>() + .ok()?; + let max_value = *tmp_reserves.iter().max()?; + let liquidity = amount.checked_div(max_value)?; + let reserves: Vec = + tmp_reserves.iter().map(|&r| r.checked_mul(liquidity)).collect::>>()?; + Some((liquidity, reserves)) + } + + #[cfg(test)] + mod tests { + use super::*; + use crate::{assert_approx, consts::*}; + use std::str::FromStr; + use test_case::test_case; + + // Example taken from + // https://docs.gnosis.io/conditionaltokens/docs/introduction3/#an-example-with-lmsr + #[test] + fn calculate_swap_amount_out_for_buy_works() { + let liquidity = 144269504088; + assert_eq!( + calculate_swap_amount_out_for_buy(_10, _10, liquidity).unwrap(), + 58496250072 + ); + } + + #[test] + fn calculate_swap_amount_out_for_sell_works() { + let liquidity = 144269504088; + assert_eq!( + calculate_swap_amount_out_for_sell(_10, _10, liquidity).unwrap(), + 41503749928 + ); + } + + #[test] + fn calcuate_spot_price_works() { + let liquidity = 144269504088; + assert_eq!(calculate_spot_price(_10, liquidity).unwrap(), _1_2); + assert_eq!(calculate_spot_price(_10 - 58496250072, liquidity).unwrap(), _3_4); + assert_eq!(calculate_spot_price(_20, liquidity).unwrap(), _1_4); + } + + #[test] + fn calculate_reserves_from_spot_prices_works() { + let expected_liquidity = 144269504088; + let (liquidity, reserves) = + calculate_reserves_from_spot_prices(_10, vec![_1_2, _1_2]).unwrap(); + assert_approx!(liquidity, expected_liquidity, 1); + assert_eq!(reserves, vec![_10, _10]); + } + + // This test ensures that we don't mess anything up when we change precision. + #[test_case(false, Fixed::from_str("10686474581524.462146990468650739308072").unwrap())] + #[test_case(true, Fixed::from_str("0.000000000000093576229688").unwrap())] + fn exp_does_not_overflow_or_underflow(neg: bool, expected: Fixed) { + let value = 30; + let result: Fixed = exp(Fixed::checked_from_num(value).unwrap(), neg).unwrap(); + assert_eq!(result, expected); + } + } +} diff --git a/zrml/neo-swaps/src/mock.rs b/zrml/neo-swaps/src/mock.rs new file mode 100644 index 000000000..5939c574e --- /dev/null +++ b/zrml/neo-swaps/src/mock.rs @@ -0,0 +1,506 @@ +// Copyright 2022-2023 Forecasting Technologies LTD. +// Copyright 2021-2022 Zeitgeist PM LLC. +// +// 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 . + +#![cfg(feature = "mock")] +#![allow( + // Mocks are only used for fuzzing and unit tests + clippy::arithmetic_side_effects, + clippy::too_many_arguments, +)] + +use crate as zrml_neo_swaps; +use crate::{consts::*, AssetOf, MarketIdOf}; +use core::marker::PhantomData; +use frame_support::{ + construct_runtime, ord_parameter_types, parameter_types, + traits::{Contains, Everything, NeverEnsureOrigin}, +}; +use frame_system::{EnsureRoot, EnsureSignedBy}; +#[cfg(feature = "parachain")] +use orml_asset_registry::AssetMetadata; +use orml_traits::MultiCurrency; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, Get, IdentityLookup}, + DispatchResult, Percent, SaturatedConversion, +}; +use substrate_fixed::{types::extra::U33, FixedI128, FixedU128}; +#[cfg(feature = "parachain")] +use zeitgeist_primitives::types::Asset; +use zeitgeist_primitives::{ + constants::mock::{ + AddOutcomePeriod, AggregationPeriod, AppealBond, AppealPeriod, AuthorizedPalletId, + BalanceFractionalDecimals, BlockHashCount, BlocksPerYear, CorrectionPeriod, CourtPalletId, + ExistentialDeposit, ExistentialDeposits, ExitFee, GdVotingPeriod, GetNativeCurrencyId, + GlobalDisputeLockId, GlobalDisputesPalletId, InflationPeriod, LiquidityMiningPalletId, + LockId, MaxAppeals, MaxApprovals, MaxAssets, MaxCourtParticipants, MaxCreatorFee, + MaxDelegations, MaxDisputeDuration, MaxDisputes, MaxEditReasonLen, MaxGlobalDisputeVotes, + MaxGracePeriod, MaxInRatio, MaxLocks, MaxMarketLifetime, MaxOracleDuration, MaxOutRatio, + MaxOwners, MaxRejectReasonLen, MaxReserves, MaxSelectedDraws, MaxSubsidyPeriod, MaxSwapFee, + MaxTotalWeight, MaxWeight, MinAssets, MinCategories, MinDisputeDuration, MinJurorStake, + MinOracleDuration, MinOutcomeVoteAmount, MinSubsidy, MinSubsidyPeriod, MinWeight, + MinimumPeriod, NeoMaxSwapFee, NeoSwapsPalletId, OutcomeBond, OutcomeFactor, OutsiderBond, + PmPalletId, RemoveKeysLimit, RequestInterval, SimpleDisputesPalletId, SwapsPalletId, + TreasuryPalletId, VotePeriod, VotingOutcomeFee, BASE, CENT, + }, + traits::DeployPoolApi, + types::{ + AccountIdTest, Amount, Balance, BasicCurrencyAdapter, BlockNumber, BlockTest, CurrencyId, + Hash, Index, MarketId, Moment, PoolId, UncheckedExtrinsicTest, + }, +}; +use zrml_neo_swaps::{traits::DistributeFees, BalanceOf}; +use zrml_rikiddo::types::{EmaMarketVolume, FeeSigmoid, RikiddoSigmoidMV}; + +pub const ALICE: AccountIdTest = 0; +#[allow(unused)] +pub const BOB: AccountIdTest = 1; +pub const CHARLIE: AccountIdTest = 2; +pub const DAVE: AccountIdTest = 3; +pub const EVE: AccountIdTest = 4; +pub const FEE_ACCOUNT: AccountIdTest = 5; +pub const SUDO: AccountIdTest = 123456; +pub const EXTERNAL_FEES: Balance = CENT; + +#[cfg(feature = "parachain")] +pub const FOREIGN_ASSET: Asset = Asset::ForeignAsset(1); + +parameter_types! { + pub const FeeAccount: AccountIdTest = FEE_ACCOUNT; +} +ord_parameter_types! { + pub const AuthorizedDisputeResolutionUser: AccountIdTest = ALICE; +} +ord_parameter_types! { + pub const Sudo: AccountIdTest = SUDO; +} +parameter_types! { + pub storage NeoMinSwapFee: Balance = 0; +} +parameter_types! { + pub const MinSubsidyPerAccount: Balance = BASE; + pub const AdvisoryBond: Balance = 0; + pub const AdvisoryBondSlashPercentage: Percent = Percent::from_percent(10); + pub const OracleBond: Balance = 0; + pub const ValidityBond: Balance = 0; + pub const DisputeBond: Balance = 0; + pub const MaxCategories: u16 = MAX_ASSETS + 1; +} + +pub struct DeployPoolNoop; + +impl DeployPoolApi for DeployPoolNoop { + type AccountId = AccountIdTest; + type Balance = Balance; + type MarketId = MarketId; + + fn deploy_pool( + _who: Self::AccountId, + _market_id: Self::MarketId, + _amount: Self::Balance, + _swap_prices: Vec, + _swap_fee: Self::Balance, + ) -> DispatchResult { + Ok(()) + } +} + +pub struct ExternalFees(PhantomData, PhantomData); + +impl DistributeFees for ExternalFees +where + F: Get, +{ + type Asset = AssetOf; + type AccountId = T::AccountId; + type Balance = BalanceOf; + type MarketId = MarketIdOf; + + fn distribute( + _market_id: Self::MarketId, + asset: Self::Asset, + account: Self::AccountId, + amount: Self::Balance, + ) -> Self::Balance { + let fees = zeitgeist_primitives::math::fixed::bmul( + amount.saturated_into(), + EXTERNAL_FEES.saturated_into(), + ) + .unwrap() + .saturated_into(); + let _ = T::MultiCurrency::transfer(asset, &account, &F::get(), fees); + fees + } +} + +pub type UncheckedExtrinsic = UncheckedExtrinsicTest; + +pub struct DustRemovalWhitelist; + +impl Contains for DustRemovalWhitelist { + fn contains(account_id: &AccountIdTest) -> bool { + *account_id == FEE_ACCOUNT + } +} + +construct_runtime!( + pub enum Runtime + where + Block = BlockTest, + NodeBlock = BlockTest, + UncheckedExtrinsic = UncheckedExtrinsic, + { + NeoSwaps: zrml_neo_swaps::{Call, Event, Pallet}, + Authorized: zrml_authorized::{Event, Pallet, Storage}, + Balances: pallet_balances::{Call, Config, Event, Pallet, Storage}, + Court: zrml_court::{Event, Pallet, Storage}, + AssetManager: orml_currencies::{Call, Pallet, Storage}, + LiquidityMining: zrml_liquidity_mining::{Config, Event, Pallet}, + MarketCommons: zrml_market_commons::{Pallet, Storage}, + PredictionMarkets: zrml_prediction_markets::{Event, Pallet, Storage}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, + RikiddoSigmoidFeeMarketEma: zrml_rikiddo::{Pallet, Storage}, + SimpleDisputes: zrml_simple_disputes::{Event, Pallet, Storage}, + GlobalDisputes: zrml_global_disputes::{Event, Pallet, Storage}, + Swaps: zrml_swaps::{Call, Event, Pallet}, + System: frame_system::{Call, Config, Event, Pallet, Storage}, + Timestamp: pallet_timestamp::{Pallet}, + Tokens: orml_tokens::{Config, Event, Pallet, Storage}, + Treasury: pallet_treasury::{Call, Event, Pallet, Storage}, + } +); + +impl crate::Config for Runtime { + type MultiCurrency = AssetManager; + type CompleteSetOperations = PredictionMarkets; + type ExternalFees = ExternalFees; + type MarketCommons = MarketCommons; + type RuntimeEvent = RuntimeEvent; + type MaxSwapFee = NeoMaxSwapFee; + type PalletId = NeoSwapsPalletId; + type WeightInfo = zrml_neo_swaps::weights::WeightInfo; +} + +impl pallet_randomness_collective_flip::Config for Runtime {} + +impl zrml_rikiddo::Config for Runtime { + type Timestamp = Timestamp; + type Balance = Balance; + type FixedTypeU = FixedU128; + type FixedTypeS = FixedI128; + type BalanceFractionalDecimals = BalanceFractionalDecimals; + type PoolId = PoolId; + type Rikiddo = RikiddoSigmoidMV< + Self::FixedTypeU, + Self::FixedTypeS, + FeeSigmoid, + EmaMarketVolume, + >; +} + +impl zrml_prediction_markets::Config for Runtime { + type AdvisoryBond = AdvisoryBond; + type AdvisoryBondSlashPercentage = AdvisoryBondSlashPercentage; + type ApproveOrigin = EnsureSignedBy; + #[cfg(feature = "parachain")] + type AssetRegistry = MockRegistry; + type Authorized = Authorized; + type CloseOrigin = EnsureSignedBy; + type Court = Court; + type DeployPool = DeployPoolNoop; + type DestroyOrigin = EnsureSignedBy; + type DisputeBond = DisputeBond; + type RuntimeEvent = RuntimeEvent; + type GlobalDisputes = GlobalDisputes; + type LiquidityMining = LiquidityMining; + type MaxCategories = MaxCategories; + type MaxDisputes = MaxDisputes; + type MinDisputeDuration = MinDisputeDuration; + type MinOracleDuration = MinOracleDuration; + type MaxCreatorFee = MaxCreatorFee; + type MaxDisputeDuration = MaxDisputeDuration; + type MaxGracePeriod = MaxGracePeriod; + type MaxOracleDuration = MaxOracleDuration; + type MaxSubsidyPeriod = MaxSubsidyPeriod; + type MaxMarketLifetime = MaxMarketLifetime; + type MinCategories = MinCategories; + type MinSubsidyPeriod = MinSubsidyPeriod; + type MaxEditReasonLen = MaxEditReasonLen; + type MaxRejectReasonLen = MaxRejectReasonLen; + type OracleBond = OracleBond; + type OutsiderBond = OutsiderBond; + type PalletId = PmPalletId; + type RejectOrigin = EnsureSignedBy; + type RequestEditOrigin = EnsureSignedBy; + type ResolveOrigin = EnsureSignedBy; + type AssetManager = AssetManager; + type SimpleDisputes = SimpleDisputes; + type Slash = Treasury; + type Swaps = Swaps; + type ValidityBond = ValidityBond; + type WeightInfo = zrml_prediction_markets::weights::WeightInfo; +} + +impl zrml_authorized::Config for Runtime { + type AuthorizedDisputeResolutionOrigin = + EnsureSignedBy; + type CorrectionPeriod = CorrectionPeriod; + type RuntimeEvent = RuntimeEvent; + type DisputeResolution = zrml_prediction_markets::Pallet; + type MarketCommons = MarketCommons; + type PalletId = AuthorizedPalletId; + type WeightInfo = zrml_authorized::weights::WeightInfo; +} + +impl zrml_court::Config for Runtime { + type AppealBond = AppealBond; + type BlocksPerYear = BlocksPerYear; + type DisputeResolution = zrml_prediction_markets::Pallet; + type VotePeriod = VotePeriod; + type AggregationPeriod = AggregationPeriod; + type AppealPeriod = AppealPeriod; + type LockId = LockId; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + type InflationPeriod = InflationPeriod; + type MarketCommons = MarketCommons; + type MaxAppeals = MaxAppeals; + type MaxDelegations = MaxDelegations; + type MaxSelectedDraws = MaxSelectedDraws; + type MaxCourtParticipants = MaxCourtParticipants; + type MinJurorStake = MinJurorStake; + type MonetaryGovernanceOrigin = EnsureRoot; + type PalletId = CourtPalletId; + type Random = RandomnessCollectiveFlip; + type RequestInterval = RequestInterval; + type Slash = Treasury; + type TreasuryPalletId = TreasuryPalletId; + type WeightInfo = zrml_court::weights::WeightInfo; +} + +impl zrml_liquidity_mining::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type MarketCommons = MarketCommons; + type MarketId = MarketId; + type PalletId = LiquidityMiningPalletId; + type WeightInfo = zrml_liquidity_mining::weights::WeightInfo; +} + +impl frame_system::Config for Runtime { + type AccountData = pallet_balances::AccountData; + type AccountId = AccountIdTest; + type BaseCallFilter = Everything; + type BlockHashCount = BlockHashCount; + type BlockLength = (); + type BlockNumber = BlockNumber; + type BlockWeights = (); + type RuntimeCall = RuntimeCall; + type DbWeight = (); + type RuntimeEvent = RuntimeEvent; + type Hash = Hash; + type Hashing = BlakeTwo256; + type Header = Header; + type Index = Index; + type Lookup = IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type RuntimeOrigin = RuntimeOrigin; + type PalletInfo = PalletInfo; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +impl orml_currencies::Config for Runtime { + type GetNativeCurrencyId = GetNativeCurrencyId; + type MultiCurrency = Tokens; + type NativeCurrency = BasicCurrencyAdapter; + type WeightInfo = (); +} + +impl orml_tokens::Config for Runtime { + type Amount = Amount; + type Balance = Balance; + type CurrencyId = CurrencyId; + type DustRemovalWhitelist = DustRemovalWhitelist; + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposits = ExistentialDeposits; + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; + type CurrencyHooks = (); + type ReserveIdentifier = [u8; 8]; + type WeightInfo = (); +} + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ExistentialDeposit; + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; + type ReserveIdentifier = [u8; 8]; + type WeightInfo = (); +} + +impl zrml_market_commons::Config for Runtime { + type Currency = Balances; + type MarketId = MarketId; + type PredictionMarketsPalletId = PmPalletId; + type Timestamp = Timestamp; +} + +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = MinimumPeriod; + type Moment = Moment; + type OnTimestampSet = (); + type WeightInfo = (); +} + +impl zrml_simple_disputes::Config for Runtime { + type AssetManager = AssetManager; + type RuntimeEvent = RuntimeEvent; + type OutcomeBond = OutcomeBond; + type OutcomeFactor = OutcomeFactor; + type DisputeResolution = zrml_prediction_markets::Pallet; + type MarketCommons = MarketCommons; + type MaxDisputes = MaxDisputes; + type PalletId = SimpleDisputesPalletId; + type WeightInfo = zrml_simple_disputes::weights::WeightInfo; +} + +impl zrml_global_disputes::Config for Runtime { + type AddOutcomePeriod = AddOutcomePeriod; + type RuntimeEvent = RuntimeEvent; + type DisputeResolution = zrml_prediction_markets::Pallet; + type MarketCommons = MarketCommons; + type Currency = Balances; + type GlobalDisputeLockId = GlobalDisputeLockId; + type GlobalDisputesPalletId = GlobalDisputesPalletId; + type MaxGlobalDisputeVotes = MaxGlobalDisputeVotes; + type MaxOwners = MaxOwners; + type MinOutcomeVoteAmount = MinOutcomeVoteAmount; + type RemoveKeysLimit = RemoveKeysLimit; + type GdVotingPeriod = GdVotingPeriod; + type VotingOutcomeFee = VotingOutcomeFee; + type WeightInfo = zrml_global_disputes::weights::WeightInfo; +} + +impl zrml_swaps::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ExitFee = ExitFee; + type FixedTypeU = ::FixedTypeU; + type FixedTypeS = ::FixedTypeS; + type LiquidityMining = LiquidityMining; + type MarketCommons = MarketCommons; + type MaxAssets = MaxAssets; + type MaxInRatio = MaxInRatio; + type MaxOutRatio = MaxOutRatio; + type MaxSwapFee = MaxSwapFee; + type MaxTotalWeight = MaxTotalWeight; + type MaxWeight = MaxWeight; + type MinAssets = MinAssets; + type MinSubsidy = MinSubsidy; + type MinSubsidyPerAccount = MinSubsidyPerAccount; + type MinWeight = MinWeight; + type PalletId = SwapsPalletId; + type RikiddoSigmoidFeeMarketEma = RikiddoSigmoidFeeMarketEma; + type AssetManager = AssetManager; + type WeightInfo = zrml_swaps::weights::WeightInfo; +} + +impl pallet_treasury::Config for Runtime { + type ApproveOrigin = EnsureSignedBy; + type Burn = (); + type BurnDestination = (); + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + type MaxApprovals = MaxApprovals; + type OnSlash = (); + type PalletId = TreasuryPalletId; + type ProposalBond = (); + type ProposalBondMinimum = (); + type ProposalBondMaximum = (); + type RejectOrigin = EnsureSignedBy; + type SpendFunds = (); + type SpendOrigin = NeverEnsureOrigin; + type SpendPeriod = (); + type WeightInfo = (); +} + +#[cfg(feature = "parachain")] +zrml_prediction_markets::impl_mock_registry! { + MockRegistry, + CurrencyId, + Balance, + zeitgeist_primitives::types::CustomMetadata +} + +#[allow(unused)] +pub struct ExtBuilder { + balances: Vec<(AccountIdTest, Balance)>, +} + +// FIXME Remove this in favor of adding whatever the account need in the individual tests. +#[allow(unused)] +impl Default for ExtBuilder { + fn default() -> Self { + Self { balances: vec![(ALICE, _101), (CHARLIE, _1), (DAVE, _1), (EVE, _1)] } + } +} + +#[allow(unused)] +impl ExtBuilder { + pub fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + pallet_balances::GenesisConfig:: { balances: self.balances } + .assimilate_storage(&mut t) + .unwrap(); + #[cfg(feature = "parachain")] + use frame_support::traits::GenesisBuild; + #[cfg(feature = "parachain")] + orml_tokens::GenesisConfig:: { balances: vec![(ALICE, FOREIGN_ASSET, _101)] } + .assimilate_storage(&mut t) + .unwrap(); + #[cfg(feature = "parachain")] + let custom_metadata = zeitgeist_primitives::types::CustomMetadata { + allow_as_base_asset: true, + ..Default::default() + }; + #[cfg(feature = "parachain")] + orml_asset_registry_mock::GenesisConfig { + metadata: vec![( + FOREIGN_ASSET, + AssetMetadata { + decimals: 18, + name: "MKL".as_bytes().to_vec(), + symbol: "MKL".as_bytes().to_vec(), + existential_deposit: 0, + location: None, + additional: custom_metadata, + }, + )], + } + .assimilate_storage(&mut t) + .unwrap(); + t.into() + } +} diff --git a/zrml/neo-swaps/src/tests/buy.rs b/zrml/neo-swaps/src/tests/buy.rs new file mode 100644 index 000000000..d93aa5ce8 --- /dev/null +++ b/zrml/neo-swaps/src/tests/buy.rs @@ -0,0 +1,355 @@ +// Copyright 2023 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 super::*; +use test_case::test_case; + +// Example taken from +// https://docs.gnosis.io/conditionaltokens/docs/introduction3/#an-example-with-lmsr +#[test] +fn buy_works() { + ExtBuilder::default().build().execute_with(|| { + frame_system::Pallet::::set_block_number(1); + let liquidity = _10; + let spot_prices = vec![_1_2, _1_2]; + let swap_fee = CENT; + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Categorical(2), + liquidity, + spot_prices.clone(), + swap_fee, + ); + let pool = Pools::::get(market_id).unwrap(); + let total_fee_percentage = swap_fee + EXTERNAL_FEES; + let amount_in_minus_fees = _10; + let amount_in = bdiv(amount_in_minus_fees, _1 - total_fee_percentage).unwrap(); // This is exactly _10 after deducting fees. + let expected_fees = amount_in - amount_in_minus_fees; + let expected_swap_fee_amount = expected_fees / 2; + let expected_external_fee_amount = expected_fees / 2; + let pool_outcomes_before: Vec<_> = + pool.assets().iter().map(|a| pool.reserve_of(a).unwrap()).collect(); + let pool_liquidity_before = pool.liquidity_parameter; + let asset_out = pool.assets()[0]; + assert_ok!(AssetManager::deposit(BASE_ASSET, &BOB, amount_in)); + // Deposit some stuff in the pool account to check that the pools `reserves` fields tracks + // the reserve correctly. + assert_ok!(AssetManager::deposit(asset_out, &pool.account_id, _100)); + assert_ok!(NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 2, + asset_out, + amount_in, + 0, + )); + let pool = Pools::::get(market_id).unwrap(); + assert_eq!(pool.liquidity_parameter, pool_liquidity_before); + assert_eq!(pool.liquidity_shares_manager.owner, ALICE); + assert_eq!(pool.liquidity_shares_manager.total_shares, liquidity); + assert_eq!(pool.liquidity_shares_manager.fees, expected_swap_fee_amount); + let pool_outcomes_after: Vec<_> = pool + .assets() + .iter() + .map(|a| pool.reserve_of(a).unwrap()) + .collect(); + let expected_swap_amount_out = 58496250072; + let expected_amount_in_minus_fees = _10 + 1; // Note: This is 1 Pennock of the correct result. + let expected_amount_out = expected_swap_amount_out + expected_amount_in_minus_fees; + assert_eq!(AssetManager::free_balance(BASE_ASSET, &BOB), 0); + assert_eq!(AssetManager::free_balance(asset_out, &BOB), expected_amount_out); + assert_eq!(pool_outcomes_after[0], pool_outcomes_before[0] - expected_swap_amount_out); + assert_eq!( + pool_outcomes_after[1], + pool_outcomes_before[0] + expected_amount_in_minus_fees, + ); + let expected_pool_account_balance = + expected_swap_fee_amount + AssetManager::minimum_balance(pool.collateral); + assert_eq!( + AssetManager::free_balance(BASE_ASSET, &pool.account_id), + expected_pool_account_balance + ); + assert_eq!( + AssetManager::free_balance(BASE_ASSET, &FEE_ACCOUNT), + expected_external_fee_amount + ); + let price_sum = pool + .assets() + .iter() + .map(|&a| pool.calculate_spot_price(a).unwrap()) + .sum::(); + assert_eq!(price_sum, _1); + System::assert_last_event( + Event::BuyExecuted { + who: BOB, + market_id, + asset_out, + amount_in, + amount_out: expected_amount_out, + swap_fee_amount: expected_swap_fee_amount, + external_fee_amount: expected_external_fee_amount, + } + .into(), + ); + }); +} + +#[test] +fn buy_fails_on_incorrect_asset_count() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 1, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + _1, + 0 + ), + Error::::IncorrectAssetCount + ); + }); +} + +#[test] +fn buy_fails_on_market_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + Markets::::remove(market_id); + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + _1, + 0 + ), + zrml_market_commons::Error::::MarketDoesNotExist, + ); + }); +} + +#[test_case(MarketStatus::Proposed)] +#[test_case(MarketStatus::Suspended)] +#[test_case(MarketStatus::Closed)] +#[test_case(MarketStatus::CollectingSubsidy)] +#[test_case(MarketStatus::InsufficientSubsidy)] +#[test_case(MarketStatus::Reported)] +#[test_case(MarketStatus::Disputed)] +#[test_case(MarketStatus::Resolved)] +fn buy_fails_on_inactive_market(market_status: MarketStatus) { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + MarketCommons::mutate_market(&market_id, |market| { + market.status = market_status; + Ok(()) + }) + .unwrap(); + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + _1, + 0 + ), + Error::::MarketNotActive, + ); + }); +} + +#[test] +fn buy_fails_on_pool_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + _1, + 0 + ), + Error::::PoolNotFound, + ); + }); +} + +#[test_case(MarketType::Categorical(2))] +#[test_case(MarketType::Scalar(0..=1))] +fn buy_fails_on_asset_not_found(market_type: MarketType) { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + market_type, + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::CategoricalOutcome(market_id, 2), + _1, + 0 + ), + Error::::AssetNotFound, + ); + }); +} + +#[test] +fn buy_fails_on_numerical_limits() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + let pool = Pools::::get(market_id).unwrap(); + let amount_in = 100 * pool.liquidity_parameter; + assert_ok!(AssetManager::deposit(BASE_ASSET, &BOB, amount_in)); + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + amount_in, + 0, + ), + Error::::NumericalLimits, + ); + }); +} + +#[test] +fn buy_fails_on_insufficient_funds() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + let amount_in = _10; + #[cfg(not(feature = "parachain"))] + let expected_error = pallet_balances::Error::::InsufficientBalance; + #[cfg(feature = "parachain")] + let expected_error = orml_tokens::Error::::BalanceTooLow; + assert_ok!(AssetManager::deposit(BASE_ASSET, &BOB, amount_in - 1)); + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + amount_in, + 0, + ), + expected_error, + ); + }); +} + +#[test] +fn buy_fails_on_amount_out_below_min() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + let amount_in = _1; + assert_ok!(AssetManager::deposit(BASE_ASSET, &BOB, amount_in)); + // Buying 1 at price of .5 will return less than 2 outcomes due to slippage. + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + amount_in, + _2, + ), + Error::::AmountOutBelowMin, + ); + }); +} + +#[test] +fn buy_fails_on_spot_price_above_max() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Categorical(2), + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::buy( + RuntimeOrigin::signed(ALICE), + market_id, + 2, + Asset::CategoricalOutcome(market_id, 0), + _70, + 0, + ), + Error::::SpotPriceAboveMax + ); + }); +} diff --git a/zrml/neo-swaps/src/tests/deploy_pool.rs b/zrml/neo-swaps/src/tests/deploy_pool.rs new file mode 100644 index 000000000..59a98522d --- /dev/null +++ b/zrml/neo-swaps/src/tests/deploy_pool.rs @@ -0,0 +1,481 @@ +// Copyright 2023 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 super::*; +use test_case::test_case; + +#[test] +fn deploy_pool_works_with_binary_markets() { + ExtBuilder::default().build().execute_with(|| { + frame_system::Pallet::::set_block_number(1); + let alice_before = AssetManager::free_balance(BASE_ASSET, &ALICE); + let amount = _10; + let spot_prices = vec![_1_2, _1_2]; + let swap_fee = CENT; + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Categorical(2), + amount, + spot_prices.clone(), + swap_fee, + ); + let assets = + vec![Asset::CategoricalOutcome(market_id, 0), Asset::CategoricalOutcome(market_id, 1)]; + let pool = Pools::::get(market_id).unwrap(); + let expected_liquidity = 144269504088; + let buffer = AssetManager::minimum_balance(pool.collateral); + assert_eq!(pool.assets(), assets); + assert_approx!(pool.liquidity_parameter, expected_liquidity, 1); + assert_eq!(pool.collateral, BASE_ASSET); + assert_eq!(pool.liquidity_shares_manager.owner, ALICE); + assert_eq!(pool.liquidity_shares_manager.total_shares, amount); + assert_eq!(pool.liquidity_shares_manager.fees, 0); + assert_eq!(pool.swap_fee, swap_fee); + assert_eq!(AssetManager::free_balance(pool.collateral, &pool.account_id), buffer); + assert_eq!(AssetManager::free_balance(assets[0], &pool.account_id), amount); + assert_eq!(AssetManager::free_balance(assets[1], &pool.account_id), amount); + assert_eq!(pool.reserve_of(&assets[0]).unwrap(), amount); + assert_eq!(pool.reserve_of(&assets[1]).unwrap(), amount); + assert_eq!(pool.calculate_spot_price(assets[0]).unwrap(), spot_prices[0]); + assert_eq!(pool.calculate_spot_price(assets[1]).unwrap(), spot_prices[1]); + assert_eq!(AssetManager::free_balance(BASE_ASSET, &ALICE), alice_before - amount - buffer); + assert_eq!(AssetManager::free_balance(assets[0], &ALICE), 0); + assert_eq!(AssetManager::free_balance(assets[1], &ALICE), 0); + System::assert_last_event( + Event::PoolDeployed { + who: ALICE, + market_id, + pool_shares_amount: amount, + amounts_in: vec![amount, amount], + liquidity_parameter: pool.liquidity_parameter, + } + .into(), + ); + }); +} + +#[test] +fn deploy_pool_works_with_scalar_marktes() { + ExtBuilder::default().build().execute_with(|| { + frame_system::Pallet::::set_block_number(1); + let alice_before = AssetManager::free_balance(BASE_ASSET, &ALICE); + let amount = _100; + let spot_prices = vec![_1_6, _5_6 + 1]; + let swap_fee = CENT; + let market_id: MarketId = 0; + let assets = vec![ + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + Asset::ScalarOutcome(market_id, ScalarPosition::Short), + ]; + // Deploy some funds in the pool account to ensure that rogue funds don't screw up price + // calculatings. + let rogue_funds = _100; + assert_ok!(AssetManager::deposit( + assets[0], + &Pallet::::pool_account_id(&market_id), + rogue_funds + )); + let _ = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + amount, + spot_prices.clone(), + swap_fee, + ); + let pool = Pools::::get(market_id).unwrap(); + let expected_liquidity = 558110626551; + let expected_amounts = vec![amount, 101755598229]; + let buffer = AssetManager::minimum_balance(pool.collateral); + assert_eq!(pool.assets(), assets); + assert_approx!(pool.liquidity_parameter, expected_liquidity, 1_000); + assert_eq!(pool.collateral, BASE_ASSET); + assert_eq!(pool.liquidity_shares_manager.owner, ALICE); + assert_eq!(pool.liquidity_shares_manager.total_shares, amount); + assert_eq!(pool.liquidity_shares_manager.fees, 0); + assert_eq!(pool.swap_fee, swap_fee); + assert_eq!( + AssetManager::free_balance(assets[0], &pool.account_id), + expected_amounts[0] + rogue_funds + ); + assert_eq!(AssetManager::free_balance(assets[1], &pool.account_id), expected_amounts[1]); + assert_eq!(pool.reserve_of(&assets[0]).unwrap(), expected_amounts[0]); + assert_eq!(pool.reserve_of(&assets[1]).unwrap(), expected_amounts[1]); + assert_eq!(pool.calculate_spot_price(assets[0]).unwrap(), spot_prices[0]); + assert_eq!(pool.calculate_spot_price(assets[1]).unwrap(), spot_prices[1]); + assert_eq!(AssetManager::free_balance(BASE_ASSET, &ALICE), alice_before - amount - buffer); + assert_eq!(AssetManager::free_balance(assets[0], &ALICE), 0); + assert_eq!(AssetManager::free_balance(assets[1], &ALICE), amount - expected_amounts[1]); + let price_sum = + pool.assets().iter().map(|&a| pool.calculate_spot_price(a).unwrap()).sum::(); + assert_eq!(price_sum, _1); + System::assert_last_event( + Event::PoolDeployed { + who: ALICE, + market_id, + pool_shares_amount: amount, + amounts_in: expected_amounts, + liquidity_parameter: pool.liquidity_parameter, + } + .into(), + ); + }); +} + +#[test] +fn deploy_pool_fails_on_incorrect_vec_len() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + assert_noop!( + NeoSwaps::deploy_pool(RuntimeOrigin::signed(ALICE), market_id, _10, vec![_1_3], CENT), + Error::::IncorrectVecLen + ); + }); +} + +#[test] +fn deploy_pool_fails_on_market_not_found() { + ExtBuilder::default().build().execute_with(|| { + assert_noop!( + NeoSwaps::deploy_pool(RuntimeOrigin::signed(ALICE), 0, _10, vec![_1_4, _3_4], CENT), + zrml_market_commons::Error::::MarketDoesNotExist, + ); + }); +} + +#[test_case(MarketStatus::Proposed)] +#[test_case(MarketStatus::Suspended)] +#[test_case(MarketStatus::Closed)] +#[test_case(MarketStatus::CollectingSubsidy)] +#[test_case(MarketStatus::InsufficientSubsidy)] +#[test_case(MarketStatus::Reported)] +#[test_case(MarketStatus::Disputed)] +#[test_case(MarketStatus::Resolved)] +fn deploy_pool_fails_on_inactive_market(market_status: MarketStatus) { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + MarketCommons::mutate_market(&market_id, |market| { + market.status = market_status; + Ok(()) + }) + .unwrap(); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + _1, + vec![_1_2, _1_2], + CENT, + ), + Error::::MarketNotActive, + ); + }); +} + +#[test] +fn deploy_pool_fails_on_duplicate_pool() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + _2, + vec![_1_2, _1_2], + CENT, + ), + Error::::DuplicatePool, + ); + }); +} + +#[test] +fn deploy_pool_fails_on_not_allowed() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(BOB), + market_id, + _10, + vec![_1_4, _3_4], + CENT + ), + Error::::NotAllowed + ); + }); +} + +#[test] +fn deploy_pool_fails_on_invalid_trading_mechanism() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::CPMM); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + _10, + vec![_1_4, _3_4], + CENT + ), + Error::::InvalidTradingMechanism + ); + }); +} + +#[test] +fn deploy_pool_fails_on_market_is_not_binary_or_scalar() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Categorical(3), ScoringRule::Lmsr); + let liquidity = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + )); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + vec![_1_3, _1_3, _1_3], + CENT + ), + Error::::MarketNotBinaryOrScalar + ); + }); +} + +// FIXME This test currently fails because the `ensure!` throwing `AssetCountAboveMax` is +// currently unreachable if the market is not binary/scalar. +#[test] +#[should_panic] +fn deploy_pool_fails_on_asset_count_above_max() { + ExtBuilder::default().build().execute_with(|| { + let category_count = MAX_ASSETS + 1; + let market_id = create_market( + ALICE, + BASE_ASSET, + MarketType::Categorical(category_count), + ScoringRule::Lmsr, + ); + let liquidity = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + )); + // Depending on the value of MAX_ASSETS and PRICE_BARRIER_*, this `spot_prices` vector + // might violate some other rules for deploying pools. + let mut spot_prices = vec![_1 / category_count as u128; category_count as usize - 1]; + spot_prices.push(_1 - spot_prices.iter().sum::()); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + spot_prices, + CENT + ), + Error::::AssetCountAboveMax + ); + }); +} + +#[test] +fn deploy_pool_fails_on_swap_fee_below_min() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Categorical(2), ScoringRule::Lmsr); + let liquidity = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + )); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + vec![_1_4, _3_4], + MIN_SWAP_FEE - 1, + ), + Error::::SwapFeeBelowMin + ); + }); +} + +#[test] +fn deploy_pool_fails_on_swap_fee_above_max() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Categorical(2), ScoringRule::Lmsr); + let liquidity = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + )); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + vec![_1_4, _3_4], + ::MaxSwapFee::get() + 1, + ), + Error::::SwapFeeAboveMax + ); + }); +} + +#[test_case(vec![_1_4, _3_4 - 1])] +#[test_case(vec![_1_4 + 1, _3_4])] +fn deploy_pool_fails_on_invalid_spot_prices(spot_prices: Vec>) { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Categorical(2), ScoringRule::Lmsr); + let liquidity = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + )); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + spot_prices, + CENT + ), + Error::::InvalidSpotPrices + ); + }); +} + +#[test] +fn deploy_pool_fails_on_spot_price_below_min() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Categorical(2), ScoringRule::Lmsr); + let liquidity = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + )); + let spot_price = MIN_SPOT_PRICE - 1; + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + vec![spot_price, _1 - spot_price], + CENT + ), + Error::::SpotPriceBelowMin + ); + }); +} + +#[test] +fn deploy_pool_fails_on_spot_price_above_max() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Categorical(2), ScoringRule::Lmsr); + let liquidity = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + )); + let spot_price = MAX_SPOT_PRICE + 1; + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + vec![spot_price, _1 - spot_price], + CENT + ), + Error::::SpotPriceAboveMax + ); + }); +} + +#[test] +fn deploy_pool_fails_on_insufficient_funds() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Categorical(2), ScoringRule::Lmsr); + let liquidity = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity - 1, + )); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity, + vec![_3_4, _1_4], + CENT + ), + orml_tokens::Error::::BalanceTooLow + ); + }); +} + +#[test] +fn deploy_pool_fails_on_liquidity_too_low() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + let amount = _1_2; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + amount, + )); + assert_noop!( + NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + amount, + vec![_1_2, _1_2], + CENT + ), + Error::::LiquidityTooLow + ); + }); +} diff --git a/zrml/neo-swaps/src/tests/exit.rs b/zrml/neo-swaps/src/tests/exit.rs new file mode 100644 index 000000000..0bfe15412 --- /dev/null +++ b/zrml/neo-swaps/src/tests/exit.rs @@ -0,0 +1,317 @@ +// Copyright 2023 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 super::*; + +#[test] +fn exit_works() { + ExtBuilder::default().build().execute_with(|| { + frame_system::Pallet::::set_block_number(1); + let liquidity = _10; + let spot_prices = vec![_1_6, _5_6 + 1]; + let swap_fee = CENT; + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + liquidity, + spot_prices.clone(), + swap_fee, + ); + let pool_shares_amount = _4; // Remove 40% to the pool. + let pool_before = Pools::::get(market_id).unwrap(); + let alice_outcomes_before = [ + AssetManager::free_balance(pool_before.assets()[0], &ALICE), + AssetManager::free_balance(pool_before.assets()[1], &ALICE), + ]; + let pool_outcomes_before: Vec<_> = + pool_before.assets().iter().map(|a| pool_before.reserve_of(a).unwrap()).collect(); + assert_ok!(NeoSwaps::exit( + RuntimeOrigin::signed(ALICE), + market_id, + pool_shares_amount, + vec![0, 0], + )); + let pool_after = Pools::::get(market_id).unwrap(); + let ratio = bdiv(pool_shares_amount, liquidity).unwrap(); + let pool_outcomes_after: Vec<_> = + pool_after.assets().iter().map(|a| pool_after.reserve_of(a).unwrap()).collect(); + let expected_pool_diff = vec![ + bmul(ratio, pool_outcomes_before[0]).unwrap(), + bmul(ratio, pool_outcomes_before[1]).unwrap(), + ]; + let alice_outcomes_after = [ + AssetManager::free_balance(pool_after.assets()[0], &ALICE), + AssetManager::free_balance(pool_after.assets()[1], &ALICE), + ]; + assert_eq!(pool_outcomes_after[0], pool_outcomes_before[0] - expected_pool_diff[0]); + assert_eq!(pool_outcomes_after[1], pool_outcomes_before[1] - expected_pool_diff[1]); + assert_eq!(alice_outcomes_after[0], alice_outcomes_before[0] + expected_pool_diff[0]); + assert_eq!(alice_outcomes_after[1], alice_outcomes_before[1] + expected_pool_diff[1]); + assert_eq!( + pool_after.liquidity_parameter, + bmul(_1 - ratio, pool_before.liquidity_parameter).unwrap() + ); + assert_eq!( + pool_after.liquidity_shares_manager.shares_of(&ALICE).unwrap(), + liquidity - pool_shares_amount + ); + System::assert_last_event( + Event::ExitExecuted { + who: ALICE, + market_id, + pool_shares_amount, + amounts_out: expected_pool_diff, + new_liquidity_parameter: pool_after.liquidity_parameter, + } + .into(), + ); + }); +} + +#[test] +fn exit_destroys_pool() { + ExtBuilder::default().build().execute_with(|| { + frame_system::Pallet::::set_block_number(1); + let liquidity = _10; + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + liquidity, + vec![_1_6, _5_6 + 1], + CENT, + ); + let pool = Pools::::get(market_id).unwrap(); + let amounts_out = vec![ + pool.reserve_of(&pool.assets()[0]).unwrap(), + pool.reserve_of(&pool.assets()[1]).unwrap(), + ]; + let alice_before = [ + AssetManager::free_balance(pool.assets()[0], &ALICE), + AssetManager::free_balance(pool.assets()[1], &ALICE), + ]; + assert_ok!(NeoSwaps::exit(RuntimeOrigin::signed(ALICE), market_id, liquidity, vec![0, 0])); + assert!(!Pools::::contains_key(market_id)); + assert_eq!(AssetManager::free_balance(pool.collateral, &pool.account_id), 0); + assert_eq!(AssetManager::free_balance(pool.assets()[0], &pool.account_id), 0); + assert_eq!(AssetManager::free_balance(pool.assets()[1], &pool.account_id), 0); + assert_eq!( + AssetManager::free_balance(pool.assets()[0], &ALICE), + alice_before[0] + amounts_out[0] + ); + assert_eq!( + AssetManager::free_balance(pool.assets()[1], &ALICE), + alice_before[1] + amounts_out[1] + ); + System::assert_last_event( + Event::PoolDestroyed { + who: ALICE, + market_id, + pool_shares_amount: liquidity, + amounts_out, + } + .into(), + ); + }); +} + +#[test] +fn exit_fails_on_incorrect_vec_len() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::exit(RuntimeOrigin::signed(ALICE), market_id, _1, vec![0]), + Error::::IncorrectVecLen + ); + }); +} + +#[test] +fn exit_fails_on_market_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + Markets::::remove(market_id); + assert_noop!( + NeoSwaps::exit(RuntimeOrigin::signed(ALICE), market_id, _1, vec![0, 0]), + zrml_market_commons::Error::::MarketDoesNotExist + ); + }); +} + +#[test] +fn exit_fails_on_pool_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + assert_noop!( + NeoSwaps::exit(RuntimeOrigin::signed(ALICE), market_id, _1, vec![0, 0]), + Error::::PoolNotFound, + ); + }); +} + +#[test] +fn exit_fails_on_insufficient_funds() { + ExtBuilder::default().build().execute_with(|| { + let liquidity = _10; + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + liquidity, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::exit( + RuntimeOrigin::signed(ALICE), + market_id, + liquidity + 1, // One more than Alice has. + vec![0, 0] + ), + Error::::InsufficientPoolShares, + ); + }); +} + +#[test] +fn exit_fails_on_amount_out_below_min() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _20, + vec![_1_2, _1_2], + CENT, + ); + let pool_shares_amount = _5; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + pool_shares_amount, + )); + assert_noop!( + NeoSwaps::exit( + RuntimeOrigin::signed(ALICE), + market_id, + pool_shares_amount, + vec![pool_shares_amount + 1, pool_shares_amount] + ), + Error::::AmountOutBelowMin + ); + }); +} + +#[test] +fn exit_fails_if_not_allowed() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _20, + vec![_1_2, _1_2], + CENT, + ); + let pool_shares_amount = _5; + assert_ok!(AssetManager::deposit(BASE_ASSET, &BOB, pool_shares_amount)); + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(BOB), + market_id, + pool_shares_amount, + )); + assert_noop!( + NeoSwaps::exit( + RuntimeOrigin::signed(BOB), + market_id, + pool_shares_amount, + vec![pool_shares_amount, pool_shares_amount] + ), + Error::::NotAllowed + ); + }); +} + +#[test] +fn exit_fails_on_outstanding_fees() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _20, + vec![_1_2, _1_2], + CENT, + ); + let pool_shares_amount = _20; + assert_ok!(AssetManager::deposit(BASE_ASSET, &BOB, pool_shares_amount)); + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(BOB), + market_id, + pool_shares_amount, + )); + assert_ok!(Pools::::try_mutate(market_id, |pool| pool + .as_mut() + .unwrap() + .liquidity_shares_manager + .deposit_fees(1))); + assert_noop!( + NeoSwaps::exit( + RuntimeOrigin::signed(BOB), + market_id, + pool_shares_amount, + vec![pool_shares_amount, pool_shares_amount] + ), + Error::::OutstandingFees + ); + }); +} + +#[test] +fn exit_pool_fails_on_liquidity_too_low() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + // Will result in liquidity of about 0.7213475204444817. + assert_noop!( + NeoSwaps::exit(RuntimeOrigin::signed(ALICE), market_id, _10 - _1_2, vec![0, 0]), + Error::::LiquidityTooLow + ); + }); +} diff --git a/zrml/neo-swaps/src/tests/join.rs b/zrml/neo-swaps/src/tests/join.rs new file mode 100644 index 000000000..ff07328af --- /dev/null +++ b/zrml/neo-swaps/src/tests/join.rs @@ -0,0 +1,249 @@ +// Copyright 2023 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 super::*; +use test_case::test_case; + +#[test] +fn join_works() { + ExtBuilder::default().build().execute_with(|| { + frame_system::Pallet::::set_block_number(1); + let liquidity = _10; + let spot_prices = vec![_1_6, _5_6 + 1]; + let swap_fee = CENT; + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + liquidity, + spot_prices.clone(), + swap_fee, + ); + let pool_shares_amount = _4; // Add 40% to the pool. + assert_ok!(AssetManager::deposit(BASE_ASSET, &ALICE, pool_shares_amount)); + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + pool_shares_amount, + )); + let pool_before = Pools::::get(market_id).unwrap(); + let alice_long_before = AssetManager::free_balance(pool_before.assets()[1], &ALICE); + let pool_outcomes_before: Vec<_> = + pool_before.assets().iter().map(|a| pool_before.reserve_of(a).unwrap()).collect(); + assert_ok!(NeoSwaps::join( + RuntimeOrigin::signed(ALICE), + market_id, + pool_shares_amount, + vec![u128::MAX, u128::MAX], + )); + let pool_after = Pools::::get(market_id).unwrap(); + let ratio = bdiv(liquidity + pool_shares_amount, liquidity).unwrap(); + let pool_outcomes_after: Vec<_> = + pool_after.assets().iter().map(|a| pool_after.reserve_of(a).unwrap()).collect(); + assert_eq!(pool_outcomes_after[0], bmul(ratio, pool_outcomes_before[0]).unwrap()); + assert_eq!(pool_outcomes_after[1], bmul(ratio, pool_outcomes_before[1]).unwrap()); + let long_diff = pool_outcomes_after[1] - pool_outcomes_before[1]; + assert_eq!(AssetManager::free_balance(pool_after.assets()[0], &ALICE), 0); + assert_eq!( + AssetManager::free_balance(pool_after.assets()[1], &ALICE), + alice_long_before - long_diff + ); + assert_eq!( + pool_after.liquidity_parameter, + bmul(ratio, pool_before.liquidity_parameter).unwrap() + ); + assert_eq!( + pool_after.liquidity_shares_manager.shares_of(&ALICE).unwrap(), + liquidity + pool_shares_amount + ); + System::assert_last_event( + Event::JoinExecuted { + who: ALICE, + market_id, + pool_shares_amount, + amounts_in: vec![pool_shares_amount, long_diff], + new_liquidity_parameter: pool_after.liquidity_parameter, + } + .into(), + ); + }); +} + +#[test] +fn join_fails_on_incorrect_vec_len() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::join(RuntimeOrigin::signed(ALICE), market_id, _1, vec![0]), + Error::::IncorrectVecLen + ); + }); +} + +#[test] +fn join_fails_on_market_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + Markets::::remove(market_id); + assert_noop!( + NeoSwaps::join(RuntimeOrigin::signed(ALICE), market_id, _1, vec![u128::MAX, u128::MAX]), + zrml_market_commons::Error::::MarketDoesNotExist + ); + }); +} + +#[test_case(MarketStatus::Proposed)] +#[test_case(MarketStatus::Suspended)] +#[test_case(MarketStatus::Closed)] +#[test_case(MarketStatus::CollectingSubsidy)] +#[test_case(MarketStatus::InsufficientSubsidy)] +#[test_case(MarketStatus::Reported)] +#[test_case(MarketStatus::Disputed)] +#[test_case(MarketStatus::Resolved)] +fn join_fails_on_inactive_market(market_status: MarketStatus) { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + MarketCommons::mutate_market(&market_id, |market| { + market.status = market_status; + Ok(()) + }) + .unwrap(); + assert_noop!( + NeoSwaps::join(RuntimeOrigin::signed(BOB), market_id, _1, vec![u128::MAX, u128::MAX]), + Error::::MarketNotActive, + ); + }); +} + +#[test] +fn join_fails_on_pool_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + assert_noop!( + NeoSwaps::join( + RuntimeOrigin::signed(ALICE), + market_id, + _1, + vec![u128::MAX, u128::MAX], + ), + Error::::PoolNotFound, + ); + }); +} + +#[test] +fn join_fails_on_insufficient_funds() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::join( + RuntimeOrigin::signed(ALICE), + market_id, + _100, + vec![u128::MAX, u128::MAX] + ), + orml_tokens::Error::::BalanceTooLow + ); + }); +} + +#[test] +fn join_fails_on_amount_in_above_max() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _20, + vec![_1_2, _1_2], + CENT, + ); + let pool_shares_amount = _10; + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + pool_shares_amount, + )); + assert_noop!( + NeoSwaps::join( + RuntimeOrigin::signed(ALICE), + market_id, + pool_shares_amount, + vec![pool_shares_amount - 1, pool_shares_amount] + ), + Error::::AmountInAboveMax + ); + }); +} + +#[test] +fn join_fails_if_not_allowed() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _20, + vec![_1_2, _1_2], + CENT, + ); + let pool_shares_amount = _5; + assert_ok!(AssetManager::deposit(BASE_ASSET, &BOB, pool_shares_amount)); + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(BOB), + market_id, + pool_shares_amount, + )); + assert_noop!( + NeoSwaps::join( + RuntimeOrigin::signed(BOB), + market_id, + pool_shares_amount, + vec![pool_shares_amount, pool_shares_amount] + ), + Error::::NotAllowed + ); + }); +} diff --git a/zrml/neo-swaps/src/tests/mod.rs b/zrml/neo-swaps/src/tests/mod.rs new file mode 100644 index 000000000..0e2633f84 --- /dev/null +++ b/zrml/neo-swaps/src/tests/mod.rs @@ -0,0 +1,120 @@ +// Copyright 2023 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 . + +#![cfg(all(feature = "mock", test))] + +mod buy; +mod deploy_pool; +mod exit; +mod join; +mod sell; +mod withdraw_fees; + +use crate::{consts::*, mock::*, traits::*, *}; +use frame_support::{assert_noop, assert_ok}; +use orml_traits::MultiCurrency; +use sp_runtime::Perbill; +use zeitgeist_primitives::{ + constants::CENT, + math::fixed::{bdiv, bmul}, + types::{ + AccountIdTest, Asset, Deadlines, MarketCreation, MarketId, MarketPeriod, MarketStatus, + MarketType, MultiHash, ScalarPosition, ScoringRule, + }, +}; +use zrml_market_commons::{MarketCommonsPalletApi, Markets}; + +#[cfg(not(feature = "parachain"))] +const BASE_ASSET: Asset = Asset::Ztg; +#[cfg(feature = "parachain")] +const BASE_ASSET: Asset = FOREIGN_ASSET; + +fn create_market( + creator: AccountIdTest, + base_asset: Asset, + market_type: MarketType, + scoring_rule: ScoringRule, +) -> MarketId { + let mut metadata = [2u8; 50]; + metadata[0] = 0x15; + metadata[1] = 0x30; + assert_ok!(PredictionMarkets::create_market( + RuntimeOrigin::signed(creator), + base_asset, + Perbill::zero(), + EVE, + MarketPeriod::Block(0..2), + Deadlines { + grace_period: 0_u32.into(), + oracle_duration: ::MinOracleDuration::get(), + dispute_duration: 0_u32.into(), + }, + MultiHash::Sha3_384(metadata), + MarketCreation::Permissionless, + market_type, + None, + scoring_rule, + )); + MarketCommons::latest_market_id().unwrap() +} + +fn create_market_and_deploy_pool( + creator: AccountIdTest, + base_asset: Asset, + market_type: MarketType, + amount: BalanceOf, + spot_prices: Vec>, + swap_fee: BalanceOf, +) -> MarketId { + let market_id = create_market(creator, base_asset, market_type, ScoringRule::Lmsr); + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(ALICE), + market_id, + amount, + )); + println!("{:?}", AssetManager::free_balance(base_asset, &ALICE)); + assert_ok!(NeoSwaps::deploy_pool( + RuntimeOrigin::signed(ALICE), + market_id, + amount, + spot_prices.clone(), + swap_fee, + )); + market_id +} + +#[macro_export] +macro_rules! assert_approx { + ($left:expr, $right:expr, $precision:expr $(,)?) => { + match (&$left, &$right, &$precision) { + (left_val, right_val, precision_val) => { + let diff = if *left_val > *right_val { + *left_val - *right_val + } else { + *right_val - *left_val + }; + if diff > *precision_val { + panic!( + "assertion `left approx== right` failed\n left: {}\n right: {}\n \ + precision: {}\ndifference: {}", + *left_val, *right_val, *precision_val, diff + ); + } + } + } + }; +} diff --git a/zrml/neo-swaps/src/tests/sell.rs b/zrml/neo-swaps/src/tests/sell.rs new file mode 100644 index 000000000..58cdd4ba5 --- /dev/null +++ b/zrml/neo-swaps/src/tests/sell.rs @@ -0,0 +1,336 @@ +// Copyright 2023 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 super::*; +use test_case::test_case; + +#[test] +fn sell_works() { + ExtBuilder::default().build().execute_with(|| { + frame_system::Pallet::::set_block_number(1); + let liquidity = _10; + let spot_prices = vec![_1_4, _3_4]; + let swap_fee = CENT; + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + liquidity, + spot_prices.clone(), + swap_fee, + ); + let pool = Pools::::get(market_id).unwrap(); + let amount_in = _10; + let pool_outcomes_before: Vec<_> = + pool.assets().iter().map(|a| pool.reserve_of(a).unwrap()).collect(); + let pool_liquidity_before = pool.liquidity_parameter; + AssetManager::deposit(BASE_ASSET, &BOB, amount_in).unwrap(); + assert_ok!(PredictionMarkets::buy_complete_set( + RuntimeOrigin::signed(BOB), + market_id, + amount_in, + )); + let asset_in = pool.assets()[1]; + assert_ok!(NeoSwaps::sell( + RuntimeOrigin::signed(BOB), + market_id, + 2, + asset_in, + amount_in, + 0, + )); + let total_fee_percentage = swap_fee + EXTERNAL_FEES; + let expected_amount_out = 59632253897u128; + let expected_fees = bmul(total_fee_percentage, expected_amount_out).unwrap(); + let expected_swap_fee_amount = expected_fees / 2; + let expected_external_fee_amount = expected_fees - expected_swap_fee_amount; + let expected_amount_out_minus_fees = expected_amount_out - expected_fees; + assert_eq!(AssetManager::free_balance(BASE_ASSET, &BOB), expected_amount_out_minus_fees); + assert_eq!(AssetManager::free_balance(asset_in, &BOB), 0); + let pool = Pools::::get(market_id).unwrap(); + assert_eq!(pool.liquidity_parameter, pool_liquidity_before); + assert_eq!(pool.liquidity_shares_manager.owner, ALICE); + assert_eq!(pool.liquidity_shares_manager.total_shares, liquidity); + assert_eq!(pool.liquidity_shares_manager.fees, expected_swap_fee_amount); + let pool_outcomes_after: Vec<_> = + pool.assets().iter().map(|a| pool.reserve_of(a).unwrap()).collect(); + assert_eq!(pool_outcomes_after[0], pool_outcomes_before[0] - expected_amount_out); + assert_eq!( + pool_outcomes_after[1], + pool_outcomes_before[1] + (amount_in - expected_amount_out) + ); + let expected_pool_account_balance = + expected_swap_fee_amount + AssetManager::minimum_balance(pool.collateral); + assert_eq!( + AssetManager::free_balance(BASE_ASSET, &pool.account_id), + expected_pool_account_balance + ); + assert_eq!( + AssetManager::free_balance(BASE_ASSET, &FEE_ACCOUNT), + expected_external_fee_amount + ); + assert_eq!( + AssetManager::total_issuance(pool.assets()[0]), + liquidity + amount_in - expected_amount_out + ); + assert_eq!( + AssetManager::total_issuance(pool.assets()[1]), + liquidity + amount_in - expected_amount_out + ); + let price_sum = + pool.assets().iter().map(|&a| pool.calculate_spot_price(a).unwrap()).sum::(); + assert_eq!(price_sum, _1); + System::assert_last_event( + Event::SellExecuted { + who: BOB, + market_id, + asset_in, + amount_in, + amount_out: expected_amount_out, + swap_fee_amount: expected_swap_fee_amount, + external_fee_amount: expected_external_fee_amount, + } + .into(), + ); + }); +} + +#[test] +fn sell_fails_on_incorrect_asset_count() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::sell( + RuntimeOrigin::signed(BOB), + market_id, + 1, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + _1, + 0 + ), + Error::::IncorrectAssetCount + ); + }); +} + +#[test] +fn sell_fails_on_market_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + Markets::::remove(market_id); + assert_noop!( + NeoSwaps::sell( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + _1, + 0 + ), + zrml_market_commons::Error::::MarketDoesNotExist, + ); + }); +} + +#[test_case(MarketStatus::Proposed)] +#[test_case(MarketStatus::Suspended)] +#[test_case(MarketStatus::Closed)] +#[test_case(MarketStatus::CollectingSubsidy)] +#[test_case(MarketStatus::InsufficientSubsidy)] +#[test_case(MarketStatus::Reported)] +#[test_case(MarketStatus::Disputed)] +#[test_case(MarketStatus::Resolved)] +fn sell_fails_on_inactive_market(market_status: MarketStatus) { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + MarketCommons::mutate_market(&market_id, |market| { + market.status = market_status; + Ok(()) + }) + .unwrap(); + assert_noop!( + NeoSwaps::sell( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + _1, + 0 + ), + Error::::MarketNotActive, + ); + }); +} + +#[test] +fn sell_fails_on_pool_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + assert_noop!( + NeoSwaps::sell( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::ScalarOutcome(market_id, ScalarPosition::Long), + _1, + 0 + ), + Error::::PoolNotFound, + ); + }); +} + +#[test_case(MarketType::Categorical(2))] +#[test_case(MarketType::Scalar(0..=1))] +fn sell_fails_on_asset_not_found(market_type: MarketType) { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + market_type, + _10, + vec![_1_2, _1_2], + CENT, + ); + assert_noop!( + NeoSwaps::sell( + RuntimeOrigin::signed(BOB), + market_id, + 2, + Asset::CategoricalOutcome(market_id, 2), + _1, + u128::MAX, + ), + Error::::AssetNotFound, + ); + }); +} + +#[test] +fn sell_fails_on_numerical_limits() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + let pool = Pools::::get(market_id).unwrap(); + let asset_in = Asset::ScalarOutcome(market_id, ScalarPosition::Long); + let amount_in = 100 * pool.liquidity_parameter; + assert_ok!(AssetManager::deposit(asset_in, &BOB, amount_in)); + assert_noop!( + NeoSwaps::buy(RuntimeOrigin::signed(BOB), market_id, 2, asset_in, amount_in, 0), + Error::::NumericalLimits, + ); + }); +} + +#[test] +fn sell_fails_on_insufficient_funds() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _10, + vec![_1_2, _1_2], + CENT, + ); + let amount_in = _10; + let asset_in = Asset::ScalarOutcome(market_id, ScalarPosition::Long); + assert_ok!(AssetManager::deposit(asset_in, &BOB, amount_in - 1)); + assert_noop!( + NeoSwaps::sell( + RuntimeOrigin::signed(BOB), + market_id, + 2, + asset_in, + amount_in, + u128::MAX, + ), + orml_tokens::Error::::BalanceTooLow, + ); + }); +} + +#[test] +fn sell_fails_on_amount_out_below_min() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + _100, + vec![_1_2, _1_2], + CENT, + ); + let amount_in = _20; + let asset_in = Asset::ScalarOutcome(market_id, ScalarPosition::Long); + assert_ok!(AssetManager::deposit(asset_in, &BOB, amount_in)); + // Selling 20 at price of .5 will return less than 10 dollars due to slippage. + assert_noop!( + NeoSwaps::sell(RuntimeOrigin::signed(BOB), market_id, 2, asset_in, amount_in, _10), + Error::::AmountOutBelowMin, + ); + }); +} + +#[test] +fn sell_fails_on_spot_price_below_min() { + ExtBuilder::default().build().execute_with(|| { + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Categorical(2), + _10, + vec![_1_2, _1_2], + CENT, + ); + let asset_in = Asset::CategoricalOutcome(market_id, 0); + let amount_in = _80; + assert_ok!(AssetManager::deposit(asset_in, &BOB, amount_in)); + assert_noop!( + NeoSwaps::sell(RuntimeOrigin::signed(BOB), market_id, 2, asset_in, amount_in, 0), + Error::::SpotPriceBelowMin + ); + }); +} diff --git a/zrml/neo-swaps/src/tests/withdraw_fees.rs b/zrml/neo-swaps/src/tests/withdraw_fees.rs new file mode 100644 index 000000000..3fc71d6d2 --- /dev/null +++ b/zrml/neo-swaps/src/tests/withdraw_fees.rs @@ -0,0 +1,67 @@ +// Copyright 2023 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 super::*; + +#[test] +fn withdraw_fees_works() { + ExtBuilder::default().build().execute_with(|| { + frame_system::Pallet::::set_block_number(1); + let liquidity = _10; + let spot_prices = vec![_1_6, _5_6 + 1]; + let swap_fee = CENT; + let market_id = create_market_and_deploy_pool( + ALICE, + BASE_ASSET, + MarketType::Scalar(0..=1), + liquidity, + spot_prices.clone(), + swap_fee, + ); + // Mock up some fees for Alice to withdraw. + let mut pool = Pools::::get(market_id).unwrap(); + let fees = 123456789; + assert_ok!(AssetManager::deposit(pool.collateral, &pool.account_id, fees)); + pool.liquidity_shares_manager.fees = fees; + Pools::::insert(market_id, pool.clone()); + let alice_before = AssetManager::free_balance(pool.collateral, &ALICE); + assert_ok!(NeoSwaps::withdraw_fees(RuntimeOrigin::signed(ALICE), market_id)); + let expected_pool_account_balance = AssetManager::minimum_balance(pool.collateral); + assert_eq!( + AssetManager::free_balance(pool.collateral, &pool.account_id), + expected_pool_account_balance + ); + assert_eq!(AssetManager::free_balance(pool.collateral, &ALICE), alice_before + fees); + let pool_after = Pools::::get(market_id).unwrap(); + assert_eq!(pool_after.liquidity_shares_manager.fees, 0); + System::assert_last_event( + Event::FeesWithdrawn { who: ALICE, market_id, amount: fees }.into(), + ); + }); +} + +#[test] +fn withdraw_fees_fails_on_pool_not_found() { + ExtBuilder::default().build().execute_with(|| { + let market_id = + create_market(ALICE, BASE_ASSET, MarketType::Scalar(0..=1), ScoringRule::Lmsr); + assert_noop!( + NeoSwaps::withdraw_fees(RuntimeOrigin::signed(ALICE), market_id), + Error::::PoolNotFound + ); + }); +} diff --git a/zrml/neo-swaps/src/traits/distribute_fees.rs b/zrml/neo-swaps/src/traits/distribute_fees.rs new file mode 100644 index 000000000..a6b67ad50 --- /dev/null +++ b/zrml/neo-swaps/src/traits/distribute_fees.rs @@ -0,0 +1,43 @@ +// Copyright 2023 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 . + +/// Trait for distributing fees collected from trading to external recipients like the treasury. +pub trait DistributeFees { + type Asset; + type AccountId; + type Balance; + type MarketId; + + /// Deduct and distribute the swap fees of the pool from the specified amount and returns the + /// deducted fees. + /// + /// # Arguments + /// + /// - `market_id`: The market on which the fees are taken. + /// - `asset`: The asset the fee is paid in. + /// - `account`: The account which pays the fees. + /// - `amount`: The gross amount from which fees are deducted. + /// + /// Note that this function is infallible. If distribution is impossible or fails midway, it + /// should return the balance of the already successfully deducted fees. + fn distribute( + market_id: Self::MarketId, + asset: Self::Asset, + account: Self::AccountId, + amount: Self::Balance, + ) -> Self::Balance; +} diff --git a/zrml/neo-swaps/src/traits/liquidity_shares_manager.rs b/zrml/neo-swaps/src/traits/liquidity_shares_manager.rs new file mode 100644 index 000000000..97ad3f333 --- /dev/null +++ b/zrml/neo-swaps/src/traits/liquidity_shares_manager.rs @@ -0,0 +1,49 @@ +// Copyright 2023 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::{BalanceOf, Config}; +use sp_runtime::{DispatchError, DispatchResult}; + +/// Trait for managing pool share tokens and distributing fees to LPs according to their share of +/// the total issuance of pool share tokens. +pub trait LiquiditySharesManager { + /// Add `amount` units of pool shares to the account of `who`. + fn join(&mut self, who: &T::AccountId, amount: BalanceOf) -> DispatchResult; + + /// Remove `amount` units of pool shares from the account of `who`. + fn exit(&mut self, who: &T::AccountId, amount: BalanceOf) -> DispatchResult; + + /// Transfer `amount` units of pool shares from `sender` to `receiver`. + fn split( + &mut self, + sender: &T::AccountId, + receiver: &T::AccountId, + amount: BalanceOf, + ) -> DispatchResult; + + /// Deposit a lump sum of fees `amount` to the pool share holders. + fn deposit_fees(&mut self, amount: BalanceOf) -> DispatchResult; + + /// Withdraw and return the share of the fees belonging to `who`. + fn withdraw_fees(&mut self, who: &T::AccountId) -> Result, DispatchError>; + + /// Return the pool shares balance of `who`. + fn shares_of(&self, who: &T::AccountId) -> Result, DispatchError>; + + /// Return the total issuance of pool shares. + fn total_shares(&self) -> Result, DispatchError>; +} diff --git a/zrml/neo-swaps/src/traits/mod.rs b/zrml/neo-swaps/src/traits/mod.rs new file mode 100644 index 000000000..061239e9f --- /dev/null +++ b/zrml/neo-swaps/src/traits/mod.rs @@ -0,0 +1,24 @@ +// Copyright 2023 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 mod distribute_fees; +pub(crate) mod liquidity_shares_manager; +pub(crate) mod pool_operations; + +pub use distribute_fees::DistributeFees; +pub(crate) use liquidity_shares_manager::LiquiditySharesManager; +pub(crate) use pool_operations::PoolOperations; diff --git a/zrml/neo-swaps/src/traits/pool_operations.rs b/zrml/neo-swaps/src/traits/pool_operations.rs new file mode 100644 index 000000000..e187361c8 --- /dev/null +++ b/zrml/neo-swaps/src/traits/pool_operations.rs @@ -0,0 +1,83 @@ +// Copyright 2023 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::{AssetOf, BalanceOf, Config}; +use alloc::vec::Vec; +use sp_runtime::{DispatchError, DispatchResult}; + +/// Trait for LMSR calculations and access to pool data. +pub(crate) trait PoolOperations { + /// Return an ordered vector containing the assets held in the pool. + fn assets(&self) -> Vec>; + + /// Return `true` if the pool holds `asset`. + fn contains(&self, asset: &AssetOf) -> bool; + + /// Return the reserve of `asset` held in the pool. + /// + /// Beware! The reserve need not coincide with the balance in the pool account. + fn reserve_of(&self, asset: &AssetOf) -> Result, DispatchError>; + + /// Perform a checked addition to the balance of `asset`. + fn increase_reserve( + &mut self, + asset: &AssetOf, + increase_amount: &BalanceOf, + ) -> DispatchResult; + + /// Perform a checked subtraction from the balance of `asset`. + fn decrease_reserve( + &mut self, + asset: &AssetOf, + decrease_amount: &BalanceOf, + ) -> DispatchResult; + + /// Calculate the amount received from the swap that is executed when buying (the function + /// `y(x)` from the documentation). + /// + /// Note that `y(x)` does not include the amount of `asset_out` received from buying complete + /// sets and is therefore _not_ the total amount received from the buy. + /// + /// # Parameters + /// + /// - `asset_out`: The outcome being bought. + /// - `amount_in`: The amount of collateral paid. + fn calculate_swap_amount_out_for_buy( + &self, + asset_out: AssetOf, + amount_in: BalanceOf, + ) -> Result, DispatchError>; + + /// Calculate the amount receives from selling an outcome to the pool. + /// + /// # Parameters + /// + /// - `asset_in`: The outcome being sold. + /// - `amount_in`: The amount of `asset_in` sold. + fn calculate_swap_amount_out_for_sell( + &self, + asset_in: AssetOf, + amount_in: BalanceOf, + ) -> Result, DispatchError>; + + /// Calculate the spot price of `asset`. + fn calculate_spot_price(&self, asset: AssetOf) -> Result, DispatchError>; + + /// Calculate the maximum number of units of outcomes anyone is allowed to swap in or out of the + /// pool. + fn calculate_max_amount_in(&self) -> BalanceOf; +} diff --git a/zrml/neo-swaps/src/types/fee_distribution.rs b/zrml/neo-swaps/src/types/fee_distribution.rs new file mode 100644 index 000000000..25ff4a09e --- /dev/null +++ b/zrml/neo-swaps/src/types/fee_distribution.rs @@ -0,0 +1,24 @@ +// Copyright 2023 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::{BalanceOf, Config}; + +pub(crate) struct FeeDistribution { + pub(crate) remaining: BalanceOf, + pub(crate) swap_fees: BalanceOf, + pub(crate) external_fees: BalanceOf, +} diff --git a/zrml/neo-swaps/src/types/market_creator_fee.rs b/zrml/neo-swaps/src/types/market_creator_fee.rs new file mode 100644 index 000000000..087627267 --- /dev/null +++ b/zrml/neo-swaps/src/types/market_creator_fee.rs @@ -0,0 +1,59 @@ +// Copyright 2023 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::{traits::DistributeFees, AssetOf, BalanceOf, Config, MarketIdOf}; +use core::marker::PhantomData; +use orml_traits::MultiCurrency; +use sp_runtime::{DispatchError, SaturatedConversion}; +use zrml_market_commons::MarketCommonsPalletApi; + +pub struct MarketCreatorFee(PhantomData); + +/// Uses the `creator_fee` field defined by the specified market to deduct a fee for the market's +/// creator. Calling `distribute` is noop if the market doesn't exist or the transfer fails for any +/// reason. +impl DistributeFees for MarketCreatorFee { + type Asset = AssetOf; + type AccountId = T::AccountId; + type Balance = BalanceOf; + type MarketId = MarketIdOf; + + fn distribute( + market_id: Self::MarketId, + asset: Self::Asset, + account: Self::AccountId, + amount: Self::Balance, + ) -> Self::Balance { + Self::impl_distribute(market_id, asset, account, amount) + .unwrap_or_else(|_| 0u8.saturated_into()) + } +} + +impl MarketCreatorFee { + fn impl_distribute( + market_id: MarketIdOf, + asset: AssetOf, + account: T::AccountId, + amount: BalanceOf, + ) -> Result, DispatchError> { + let market = T::MarketCommons::market(&market_id)?; // Should never fail + let fee_amount = market.creator_fee.mul_floor(amount); + // Might fail if the transaction is too small + T::MultiCurrency::transfer(asset, &account, &market.creator, fee_amount)?; + Ok(fee_amount) + } +} diff --git a/zrml/neo-swaps/src/types/mod.rs b/zrml/neo-swaps/src/types/mod.rs new file mode 100644 index 000000000..dc0c4aaf9 --- /dev/null +++ b/zrml/neo-swaps/src/types/mod.rs @@ -0,0 +1,26 @@ +// Copyright 2023 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 fee_distribution; +mod market_creator_fee; +mod pool; +mod solo_lp; + +pub(crate) use fee_distribution::*; +pub use market_creator_fee::*; +pub(crate) use pool::*; +pub(crate) use solo_lp::*; diff --git a/zrml/neo-swaps/src/types/pool.rs b/zrml/neo-swaps/src/types/pool.rs new file mode 100644 index 000000000..c9cec18d8 --- /dev/null +++ b/zrml/neo-swaps/src/types/pool.rs @@ -0,0 +1,135 @@ +// Copyright 2023 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::{ + consts::{EXP_NUMERICAL_LIMIT, MAX_ASSETS}, + math::{Math, MathOps}, + pallet::{AssetOf, BalanceOf, Config}, + traits::{LiquiditySharesManager, PoolOperations}, + Error, +}; +use alloc::{collections::BTreeMap, vec::Vec}; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; +use sp_runtime::{ + traits::{CheckedAdd, CheckedSub}, + DispatchError, DispatchResult, RuntimeDebug, SaturatedConversion, Saturating, +}; + +#[derive(TypeInfo, Clone, Encode, Eq, Decode, PartialEq, RuntimeDebug)] +#[scale_info(skip_type_params(T))] +pub struct Pool +where + LSM: LiquiditySharesManager, +{ + pub account_id: T::AccountId, + pub reserves: BTreeMap, BalanceOf>, + pub collateral: AssetOf, + pub liquidity_parameter: BalanceOf, + pub liquidity_shares_manager: LSM, + pub swap_fee: BalanceOf, +} + +impl + TypeInfo> PoolOperations for Pool +where + BalanceOf: SaturatedConversion, +{ + fn assets(&self) -> Vec> { + self.reserves.keys().cloned().collect() + } + + fn contains(&self, asset: &AssetOf) -> bool { + self.reserves.contains_key(asset) + } + + fn reserve_of(&self, asset: &AssetOf) -> Result, DispatchError> { + Ok(*self.reserves.get(asset).ok_or(Error::::AssetNotFound)?) + } + + fn increase_reserve( + &mut self, + asset: &AssetOf, + increase_amount: &BalanceOf, + ) -> DispatchResult { + let value = self.reserves.get_mut(asset).ok_or(Error::::AssetNotFound)?; + *value = value.checked_add(increase_amount).ok_or(Error::::MathError)?; + Ok(()) + } + + fn decrease_reserve( + &mut self, + asset: &AssetOf, + decrease_amount: &BalanceOf, + ) -> DispatchResult { + let value = self.reserves.get_mut(asset).ok_or(Error::::AssetNotFound)?; + *value = value.checked_sub(decrease_amount).ok_or(Error::::MathError)?; + Ok(()) + } + + fn calculate_swap_amount_out_for_buy( + &self, + asset_out: AssetOf, + amount_in: BalanceOf, + ) -> Result, DispatchError> { + let reserve = self.reserve_of(&asset_out)?; + Math::::calculate_swap_amount_out_for_buy(reserve, amount_in, self.liquidity_parameter) + } + + fn calculate_swap_amount_out_for_sell( + &self, + asset_in: AssetOf, + amount_in: BalanceOf, + ) -> Result, DispatchError> { + let reserve = self.reserve_of(&asset_in)?; + Math::::calculate_swap_amount_out_for_sell(reserve, amount_in, self.liquidity_parameter) + } + + fn calculate_spot_price(&self, asset: AssetOf) -> Result, DispatchError> { + let reserve = self.reserve_of(&asset)?; + Math::::calculate_spot_price(reserve, self.liquidity_parameter) + } + + fn calculate_max_amount_in(&self) -> BalanceOf { + // Saturation is OK. If this saturates, the maximum amount in is just the numerical limit. + self.liquidity_parameter.saturating_mul(EXP_NUMERICAL_LIMIT.saturated_into()) + } +} + +impl> MaxEncodedLen for Pool +where + T::AccountId: MaxEncodedLen, + AssetOf: MaxEncodedLen, + BalanceOf: MaxEncodedLen, + LSM: MaxEncodedLen, +{ + fn max_encoded_len() -> usize { + let len_account_id = T::AccountId::max_encoded_len(); + let len_reserves = 1usize.saturating_add((MAX_ASSETS as usize).saturating_mul( + >::max_encoded_len().saturating_add(BalanceOf::::max_encoded_len()), + )); + let len_collateral = AssetOf::::max_encoded_len(); + let len_liquidity_parameter = BalanceOf::::max_encoded_len(); + let len_liquidity_shares_manager = LSM::max_encoded_len(); + let len_swap_fee = BalanceOf::::max_encoded_len(); + len_account_id + .saturating_add(len_reserves) + .saturating_add(len_collateral) + .saturating_add(len_liquidity_parameter) + .saturating_add(len_liquidity_shares_manager) + .saturating_add(len_swap_fee) + } +} diff --git a/zrml/neo-swaps/src/types/solo_lp.rs b/zrml/neo-swaps/src/types/solo_lp.rs new file mode 100644 index 000000000..02cbed618 --- /dev/null +++ b/zrml/neo-swaps/src/types/solo_lp.rs @@ -0,0 +1,88 @@ +// Copyright 2023 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::{traits::LiquiditySharesManager, BalanceOf, Config, Error}; +use frame_support::ensure; +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; +use sp_runtime::{ + traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Zero}, + DispatchError, DispatchResult, RuntimeDebug, +}; + +#[derive(TypeInfo, MaxEncodedLen, Clone, Encode, Eq, Decode, PartialEq, RuntimeDebug)] +#[scale_info(skip_type_params(T))] +pub struct SoloLp { + pub owner: T::AccountId, + pub total_shares: BalanceOf, + pub fees: BalanceOf, +} + +impl SoloLp { + pub(crate) fn new(owner: T::AccountId, total_shares: BalanceOf) -> SoloLp { + SoloLp { owner, total_shares, fees: Zero::zero() } + } +} + +impl LiquiditySharesManager for SoloLp +where + T::AccountId: PartialEq, + BalanceOf: AtLeast32BitUnsigned + Copy + Zero, +{ + fn join(&mut self, who: &T::AccountId, shares: BalanceOf) -> DispatchResult { + ensure!(*who == self.owner, Error::::NotAllowed); + self.total_shares = self.total_shares.checked_add(&shares).ok_or(Error::::MathError)?; + Ok(()) + } + + fn exit(&mut self, who: &T::AccountId, shares: BalanceOf) -> DispatchResult { + ensure!(*who == self.owner, Error::::NotAllowed); + ensure!(shares <= self.total_shares, Error::::InsufficientPoolShares); + self.total_shares = self.total_shares.checked_sub(&shares).ok_or(Error::::MathError)?; + Ok(()) + } + + fn split( + &mut self, + _sender: &T::AccountId, + _receiver: &T::AccountId, + _amount: BalanceOf, + ) -> DispatchResult { + Err(Error::::NotImplemented.into()) + } + + fn deposit_fees(&mut self, amount: BalanceOf) -> DispatchResult { + self.fees = self.fees.checked_add(&amount).ok_or(Error::::MathError)?; + Ok(()) + } + + fn withdraw_fees(&mut self, who: &T::AccountId) -> Result, DispatchError> { + ensure!(*who == self.owner, Error::::NotAllowed); + let result = self.fees; + self.fees = Zero::zero(); + Ok(result) + } + + fn shares_of(&self, who: &T::AccountId) -> Result, DispatchError> { + ensure!(*who == self.owner, Error::::NotAllowed); + Ok(self.total_shares) + } + + fn total_shares(&self) -> Result, DispatchError> { + Ok(self.total_shares) + } +} diff --git a/zrml/neo-swaps/src/weights.rs b/zrml/neo-swaps/src/weights.rs new file mode 100644 index 000000000..618636182 --- /dev/null +++ b/zrml/neo-swaps/src/weights.rs @@ -0,0 +1,163 @@ +// Copyright 2022-2023 Forecasting Technologies LTD. +// Copyright 2021-2022 Zeitgeist PM LLC. +// +// 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 . + +//! Autogenerated weights for zrml_neo_swaps +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: `2023-09-15`, STEPS: `2`, REPEAT: `0`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `mkl-mac`, CPU: `` +//! EXECUTION: `Some(Native)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/zeitgeist +// benchmark +// pallet +// --chain=dev +// --steps=2 +// --repeat=0 +// --pallet=zrml_neo_swaps +// --extrinsic=* +// --execution=native +// --wasm-execution=compiled +// --heap-pages=4096 +// --template=./misc/weight_template.hbs +// --header=./HEADER_GPL3 +// --output=./zrml/neo-swaps/src/weights.rs + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use core::marker::PhantomData; +use frame_support::{traits::Get, weights::Weight}; + +/// Trait containing the required functions for weight retrival within +/// zrml_neo_swaps (automatically generated) +pub trait WeightInfoZeitgeist { + fn buy() -> Weight; + fn sell() -> Weight; + fn join() -> Weight; + fn exit() -> Weight; + fn withdraw_fees() -> Weight; + fn deploy_pool() -> Weight; +} + +/// Weight functions for zrml_neo_swaps (automatically generated) +pub struct WeightInfo(PhantomData); +impl WeightInfoZeitgeist for WeightInfo { + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: NeoSwaps Pools (r:1 w:1) + /// Proof: NeoSwaps Pools (max_values: None, max_size: Some(4652), added: 7127, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:3 w:3) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:2 w:2) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + fn buy() -> Weight { + // Proof Size summary in bytes: + // Measured: `2868` + // Estimated: `28187` + // Minimum execution time: 234_000 nanoseconds. + Weight::from_parts(234_000_000, 28187) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: NeoSwaps Pools (r:1 w:1) + /// Proof: NeoSwaps Pools (max_values: None, max_size: Some(4652), added: 7127, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:3 w:3) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:2 w:2) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + fn sell() -> Weight { + // Proof Size summary in bytes: + // Measured: `3034` + // Estimated: `28187` + // Minimum execution time: 296_000 nanoseconds. + Weight::from_parts(296_000_000, 28187) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: NeoSwaps Pools (r:1 w:1) + /// Proof: NeoSwaps Pools (max_values: None, max_size: Some(4652), added: 7127, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:4 w:4) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + fn join() -> Weight { + // Proof Size summary in bytes: + // Measured: `2756` + // Estimated: `20535` + // Minimum execution time: 118_000 nanoseconds. + Weight::from_parts(118_000_000, 20535) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: NeoSwaps Pools (r:1 w:1) + /// Proof: NeoSwaps Pools (max_values: None, max_size: Some(4652), added: 7127, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:4 w:4) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn exit() -> Weight { + // Proof Size summary in bytes: + // Measured: `2524` + // Estimated: `23142` + // Minimum execution time: 116_000 nanoseconds. + Weight::from_parts(116_000_000, 23142) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: NeoSwaps Pools (r:1 w:1) + /// Proof: NeoSwaps Pools (max_values: None, max_size: Some(4652), added: 7127, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn withdraw_fees() -> Weight { + // Proof Size summary in bytes: + // Measured: `1819` + // Estimated: `9734` + // Minimum execution time: 73_000 nanoseconds. + Weight::from_parts(73_000_000, 9734) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: NeoSwaps Pools (r:1 w:1) + /// Proof: NeoSwaps Pools (max_values: None, max_size: Some(4652), added: 7127, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:4 w:4) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + fn deploy_pool() -> Weight { + // Proof Size summary in bytes: + // Measured: `2241` + // Estimated: `23142` + // Minimum execution time: 149_000 nanoseconds. + Weight::from_parts(149_000_000, 23142) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } +} diff --git a/zrml/orderbook-v1/Cargo.toml b/zrml/orderbook-v1/Cargo.toml index da2e40ef6..6c0223b9d 100644 --- a/zrml/orderbook-v1/Cargo.toml +++ b/zrml/orderbook-v1/Cargo.toml @@ -54,4 +54,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-orderbook-v1" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/prediction-markets/Cargo.toml b/zrml/prediction-markets/Cargo.toml index f1e8a5cdc..3e4348879 100644 --- a/zrml/prediction-markets/Cargo.toml +++ b/zrml/prediction-markets/Cargo.toml @@ -95,4 +95,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-prediction-markets" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/prediction-markets/runtime-api/Cargo.toml b/zrml/prediction-markets/runtime-api/Cargo.toml index 255435d0d..3fe4d8f3b 100644 --- a/zrml/prediction-markets/runtime-api/Cargo.toml +++ b/zrml/prediction-markets/runtime-api/Cargo.toml @@ -15,4 +15,4 @@ std = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-prediction-markets-runtime-api" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/prediction-markets/src/benchmarks.rs b/zrml/prediction-markets/src/benchmarks.rs index 777bff022..b914ce9a3 100644 --- a/zrml/prediction-markets/src/benchmarks.rs +++ b/zrml/prediction-markets/src/benchmarks.rs @@ -154,7 +154,8 @@ fn setup_redeem_shares_common( panic!("setup_redeem_shares_common: Unsupported market type: {market_type:?}"); } - Pallet::::do_buy_complete_set(caller.clone(), market_id, LIQUIDITY.saturated_into())?; + Call::::buy_complete_set { market_id, amount: LIQUIDITY.saturated_into() } + .dispatch_bypass_filter(RawOrigin::Signed(caller.clone()).into())?; let close_origin = T::CloseOrigin::try_successful_origin().unwrap(); let resolve_origin = T::ResolveOrigin::try_successful_origin().unwrap(); Call::::admin_move_market_to_closed { market_id }.dispatch_bypass_filter(close_origin)?; @@ -1286,6 +1287,44 @@ benchmarks! { let _ = >::process_subsidy_collecting_markets(current_block, current_time); } + create_market_and_deploy_pool { + let m in 0..63; // Number of markets closing on the same block. + + let base_asset = Asset::Ztg; + let range_start = (5 * MILLISECS_PER_BLOCK) as u64; + let range_end = (100 * MILLISECS_PER_BLOCK) as u64; + let period = MarketPeriod::Timestamp(range_start..range_end); + let market_type = MarketType::Categorical(2); + let (caller, oracle, deadlines, metadata) = create_market_common_parameters::()?; + let price = (BASE / 2).saturated_into(); + let amount = (10u128 * BASE).saturated_into(); + + ::AssetManager::deposit( + base_asset, + &caller, + amount, + )?; + for i in 0..m { + MarketIdsPerCloseTimeFrame::::try_mutate( + Pallet::::calculate_time_frame_of_moment(range_end), + |ids| ids.try_push(i.into()), + ).unwrap(); + } + }: _( + RawOrigin::Signed(caller), + base_asset, + Perbill::zero(), + oracle, + period, + deadlines, + metadata, + MarketType::Categorical(2), + Some(MarketDisputeMechanism::Court), + amount, + vec![price, price], + (BASE / 100).saturated_into() + ) + impl_benchmark_test_suite!( PredictionMarket, crate::mock::ExtBuilder::default().build(), diff --git a/zrml/prediction-markets/src/lib.rs b/zrml/prediction-markets/src/lib.rs index c64011997..5b9ff3233 100644 --- a/zrml/prediction-markets/src/lib.rs +++ b/zrml/prediction-markets/src/lib.rs @@ -40,6 +40,7 @@ mod pallet { dispatch::{DispatchResultWithPostInfo, Pays, Weight}, ensure, log, pallet_prelude::{ConstU32, StorageMap, StorageValue, ValueQuery}, + require_transactional, storage::{with_transaction, TransactionOutcome}, traits::{ tokens::BalanceStatus, Currency, EnsureOrigin, Get, Hooks, Imbalance, IsType, @@ -62,7 +63,8 @@ mod pallet { use zeitgeist_primitives::{ constants::MILLISECS_PER_BLOCK, traits::{ - DisputeApi, DisputeMaxWeightApi, DisputeResolutionApi, Swaps, ZeitgeistAssetManager, + CompleteSetOperationsApi, DeployPoolApi, DisputeApi, DisputeMaxWeightApi, + DisputeResolutionApi, Swaps, ZeitgeistAssetManager, }, types::{ Asset, Bond, Deadlines, GlobalDisputeItem, Market, MarketBonds, MarketCreation, @@ -526,7 +528,7 @@ mod pallet { ); match m.scoring_rule { - ScoringRule::CPMM | ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { m.status = MarketStatus::Active; } ScoringRule::RikiddoSigmoidFeeMarketEma => { @@ -614,7 +616,11 @@ mod pallet { #[pallet::compact] amount: BalanceOf, ) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; - Self::do_buy_complete_set(sender, market_id, amount) + Self::do_buy_complete_set(sender, market_id, amount)?; + let market = >::market(&market_id)?; + let assets = Self::outcome_assets(market_id, &market); + let assets_len: u32 = assets.len().saturated_into(); + Ok(Some(T::WeightInfo::buy_complete_set(assets_len)).into()) } /// Dispute on a market that has been reported or already disputed. @@ -784,57 +790,20 @@ mod pallet { ) -> DispatchResultWithPostInfo { // TODO(#787): Handle Rikiddo benchmarks! let sender = ensure_signed(origin)?; - - let bonds = match creation { - MarketCreation::Advised => MarketBonds { - creation: Some(Bond::new(sender.clone(), T::AdvisoryBond::get())), - oracle: Some(Bond::new(sender.clone(), T::OracleBond::get())), - ..Default::default() - }, - MarketCreation::Permissionless => MarketBonds { - creation: Some(Bond::new(sender.clone(), T::ValidityBond::get())), - oracle: Some(Bond::new(sender.clone(), T::OracleBond::get())), - ..Default::default() - }, - }; - - let market = Self::construct_market( + let (ids_len, _) = Self::do_create_market( + sender, base_asset, - sender.clone(), creator_fee, oracle, period, deadlines, metadata, - creation.clone(), + creation, market_type, dispute_mechanism, scoring_rule, - None, - None, - bonds.clone(), )?; - - T::AssetManager::reserve_named( - &Self::reserve_id(), - Asset::Ztg, - &sender, - bonds.total_amount_bonded(&sender), - )?; - - let market_id = >::push_market(market.clone())?; - let market_account = >::market_account(market_id); - let mut extra_weight = Weight::zero(); - - if market.status == MarketStatus::CollectingSubsidy { - extra_weight = Self::start_subsidy(&market, market_id)?; - } - - let ids_amount: u32 = Self::insert_auto_close(&market_id)?; - - Self::deposit_event(Event::MarketCreated(market_id, market_account, market)); - - Ok(Some(T::WeightInfo::create_market(ids_amount).saturating_add(extra_weight)).into()) + Ok(Some(T::WeightInfo::create_market(ids_len)).into()) } /// Edit a proposed market for which request is made. @@ -1325,9 +1294,7 @@ mod pallet { /// /// Complexity: `O(n)`, where `n` is the number of assets for a categorical market. #[pallet::call_index(15)] - #[pallet::weight( - T::WeightInfo::sell_complete_set(T::MaxCategories::get().into()) - )] + #[pallet::weight(T::WeightInfo::sell_complete_set(T::MaxCategories::get().into()))] #[transactional] pub fn sell_complete_set( origin: OriginFor, @@ -1335,41 +1302,9 @@ mod pallet { #[pallet::compact] amount: BalanceOf, ) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; - ensure!(amount != BalanceOf::::zero(), Error::::ZeroAmount); - + Self::do_sell_complete_set(sender, market_id, amount)?; let market = >::market(&market_id)?; - ensure!( - matches!(market.scoring_rule, ScoringRule::CPMM | ScoringRule::Orderbook), - Error::::InvalidScoringRule - ); - Self::ensure_market_is_active(&market)?; - - let market_account = >::market_account(market_id); - ensure!( - T::AssetManager::free_balance(market.base_asset, &market_account) >= amount, - "Market account does not have sufficient reserves.", - ); - let assets = Self::outcome_assets(market_id, &market); - - // verify first. - for asset in assets.iter() { - // Ensures that the sender has sufficient amount of each - // share in the set. - ensure!( - T::AssetManager::free_balance(*asset, &sender) >= amount, - Error::::InsufficientShareBalance, - ); - } - - // write last. - for asset in assets.iter() { - T::AssetManager::slash(*asset, &sender, amount); - } - - T::AssetManager::transfer(market.base_asset, &market_account, &sender, amount)?; - - Self::deposit_event(Event::SoldCompleteSet(market_id, amount, sender)); let assets_len: u32 = assets.len().saturated_into(); Ok(Some(T::WeightInfo::sell_complete_set(assets_len)).into()) } @@ -1477,6 +1412,50 @@ mod pallet { Ok(Some(T::WeightInfo::start_global_dispute(ids_len_1, ids_len_2)).into()) } + + /// Create a market, deploy a LMSR pool, and buy outcome tokens and provide liquidity to the + /// market. + /// + /// # Weight + /// + /// `O(n)` where `n` is the number of markets which close on the same block, plus the + /// resources consumed by `DeployPool::create_pool`. In the standard implementation using + /// neo-swaps, this is `O(m)` where `m` is the number of assets in the market. + #[pallet::weight(T::WeightInfo::create_market_and_deploy_pool(CacheSize::get()))] + #[transactional] + #[pallet::call_index(17)] + pub fn create_market_and_deploy_pool( + origin: OriginFor, + base_asset: Asset>, + creator_fee: Perbill, + oracle: T::AccountId, + period: MarketPeriod>, + deadlines: Deadlines, + metadata: MultiHash, + market_type: MarketType, + dispute_mechanism: Option, + #[pallet::compact] amount: BalanceOf, + spot_prices: Vec>, + #[pallet::compact] swap_fee: BalanceOf, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let (ids_len, market_id) = Self::do_create_market( + who.clone(), + base_asset, + creator_fee, + oracle, + period, + deadlines, + metadata, + MarketCreation::Permissionless, + market_type, + dispute_mechanism, + ScoringRule::Lmsr, + )?; + Self::do_buy_complete_set(who.clone(), market_id, amount)?; + T::DeployPool::deploy_pool(who, market_id, amount, spot_prices, swap_fee)?; + Ok(Some(T::WeightInfo::create_market_and_deploy_pool(ids_len)).into()) + } } #[pallet::config] @@ -1539,6 +1518,13 @@ mod pallet { Origin = Self::RuntimeOrigin, >; + /// Used to deploy neo-swaps pools. + type DeployPool: DeployPoolApi< + AccountId = Self::AccountId, + Balance = BalanceOf, + MarketId = MarketIdOf, + >; + /// The origin that is allowed to destroy markets. type DestroyOrigin: EnsureOrigin; @@ -2028,7 +2014,7 @@ mod pallet { #[pallet::storage] pub type MarketsCollectingSubsidy = StorageValue< _, - BoundedVec, MarketIdOf>, ConstU32<1_048_576>>, + BoundedVec, MarketIdOf>, ConstU32<16>>, ValueQuery, >; @@ -2069,6 +2055,71 @@ mod pallet { Ok(()) } + #[require_transactional] + fn do_create_market( + who: T::AccountId, + base_asset: Asset>, + creator_fee: Perbill, + oracle: T::AccountId, + period: MarketPeriod>, + deadlines: Deadlines, + metadata: MultiHash, + creation: MarketCreation, + market_type: MarketType, + dispute_mechanism: Option, + scoring_rule: ScoringRule, + ) -> Result<(u32, MarketIdOf), DispatchError> { + let bonds = match creation { + MarketCreation::Advised => MarketBonds { + creation: Some(Bond::new(who.clone(), T::AdvisoryBond::get())), + oracle: Some(Bond::new(who.clone(), T::OracleBond::get())), + ..Default::default() + }, + MarketCreation::Permissionless => MarketBonds { + creation: Some(Bond::new(who.clone(), T::ValidityBond::get())), + oracle: Some(Bond::new(who.clone(), T::OracleBond::get())), + ..Default::default() + }, + }; + + let market = Self::construct_market( + base_asset, + who.clone(), + creator_fee, + oracle, + period, + deadlines, + metadata, + creation.clone(), + market_type, + dispute_mechanism, + scoring_rule, + None, + None, + bonds.clone(), + )?; + + T::AssetManager::reserve_named( + &Self::reserve_id(), + Asset::Ztg, + &who, + bonds.total_amount_bonded(&who), + )?; + + let market_id = >::push_market(market.clone())?; + let market_account = >::market_account(market_id); + + if market.status == MarketStatus::CollectingSubsidy { + let _ = Self::start_subsidy(&market, market_id)?; + } + + let ids_amount: u32 = Self::insert_auto_close(&market_id)?; + + Self::deposit_event(Event::MarketCreated(market_id, market_account, market)); + + Ok((ids_amount, market_id)) + } + pub fn outcome_assets( market_id: MarketIdOf, market: &MarketOf, @@ -2238,11 +2289,60 @@ mod pallet { Ok(()) } + #[require_transactional] + pub(crate) fn do_sell_complete_set( + who: T::AccountId, + market_id: MarketIdOf, + amount: BalanceOf, + ) -> DispatchResult { + ensure!(amount != BalanceOf::::zero(), Error::::ZeroAmount); + + let market = >::market(&market_id)?; + ensure!( + matches!( + market.scoring_rule, + ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Orderbook + ), + Error::::InvalidScoringRule + ); + Self::ensure_market_is_active(&market)?; + + let market_account = >::market_account(market_id); + ensure!( + T::AssetManager::free_balance(market.base_asset, &market_account) >= amount, + "Market account does not have sufficient reserves.", + ); + + let assets = Self::outcome_assets(market_id, &market); + + // verify first. + for asset in assets.iter() { + // Ensures that the sender has sufficient amount of each + // share in the set. + ensure!( + T::AssetManager::free_balance(*asset, &who) >= amount, + Error::::InsufficientShareBalance, + ); + } + + // write last. + for asset in assets.iter() { + T::AssetManager::slash(*asset, &who, amount); + } + + T::AssetManager::transfer(market.base_asset, &market_account, &who, amount)?; + + Self::deposit_event(Event::SoldCompleteSet(market_id, amount, who)); + + Ok(()) + } + + #[require_transactional] pub(crate) fn do_buy_complete_set( who: T::AccountId, market_id: MarketIdOf, amount: BalanceOf, - ) -> DispatchResultWithPostInfo { + ) -> DispatchResult { ensure!(amount != BalanceOf::::zero(), Error::::ZeroAmount); let market = >::market(&market_id)?; ensure!( @@ -2250,7 +2350,10 @@ mod pallet { Error::::NotEnoughBalance ); ensure!( - matches!(market.scoring_rule, ScoringRule::CPMM | ScoringRule::Orderbook), + matches!( + market.scoring_rule, + ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Orderbook + ), Error::::InvalidScoringRule ); Self::ensure_market_is_active(&market)?; @@ -2265,8 +2368,7 @@ mod pallet { Self::deposit_event(Event::BoughtCompleteSet(market_id, amount, who)); - let assets_len: u32 = assets.len().saturated_into(); - Ok(Some(T::WeightInfo::buy_complete_set(assets_len)).into()) + Ok(()) } pub(crate) fn do_reject_market( @@ -3073,7 +3175,7 @@ mod pallet { } let status: MarketStatus = match creation { MarketCreation::Permissionless => match scoring_rule { - ScoringRule::CPMM | ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { MarketStatus::Active } ScoringRule::RikiddoSigmoidFeeMarketEma => MarketStatus::CollectingSubsidy, @@ -3258,4 +3360,29 @@ mod pallet { remove_auto_resolve::(market_id, resolve_at) } } + + impl CompleteSetOperationsApi for Pallet + where + T: Config, + { + type AccountId = T::AccountId; + type Balance = BalanceOf; + type MarketId = MarketIdOf; + + fn buy_complete_set( + who: Self::AccountId, + market_id: Self::MarketId, + amount: Self::Balance, + ) -> DispatchResult { + Self::do_buy_complete_set(who, market_id, amount) + } + + fn sell_complete_set( + who: Self::AccountId, + market_id: Self::MarketId, + amount: Self::Balance, + ) -> DispatchResult { + Self::do_sell_complete_set(who, market_id, amount) + } + } } diff --git a/zrml/prediction-markets/src/mock.rs b/zrml/prediction-markets/src/mock.rs index a66f78e0f..c891f5f21 100644 --- a/zrml/prediction-markets/src/mock.rs +++ b/zrml/prediction-markets/src/mock.rs @@ -34,34 +34,32 @@ use sp_arithmetic::per_things::Percent; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, + DispatchError, DispatchResult, }; +use std::cell::RefCell; use substrate_fixed::{types::extra::U33, FixedI128, FixedU128}; use zeitgeist_primitives::{ constants::mock::{ - AggregationPeriod, AppealBond, AppealPeriod, AuthorizedPalletId, BalanceFractionalDecimals, - BlockHashCount, BlocksPerYear, CorrectionPeriod, CourtPalletId, ExistentialDeposit, - ExistentialDeposits, ExitFee, GetNativeCurrencyId, InflationPeriod, - LiquidityMiningPalletId, LockId, MaxAppeals, MaxApprovals, MaxAssets, MaxCategories, - MaxCourtParticipants, MaxCreatorFee, MaxDelegations, MaxDisputeDuration, MaxDisputes, - MaxEditReasonLen, MaxGracePeriod, MaxInRatio, MaxMarketLifetime, MaxOracleDuration, - MaxOutRatio, MaxRejectReasonLen, MaxReserves, MaxSelectedDraws, MaxSubsidyPeriod, - MaxSwapFee, MaxTotalWeight, MaxWeight, MinAssets, MinCategories, MinDisputeDuration, - MinJurorStake, MinOracleDuration, MinSubsidy, MinSubsidyPeriod, MinWeight, MinimumPeriod, - OutcomeBond, OutcomeFactor, OutsiderBond, PmPalletId, RequestInterval, - SimpleDisputesPalletId, SwapsPalletId, TreasuryPalletId, VotePeriod, BASE, CENT, - MILLISECS_PER_BLOCK, + AddOutcomePeriod, AggregationPeriod, AppealBond, AppealPeriod, AuthorizedPalletId, + BalanceFractionalDecimals, BlockHashCount, BlocksPerYear, CorrectionPeriod, CourtPalletId, + ExistentialDeposit, ExistentialDeposits, ExitFee, GdVotingPeriod, GetNativeCurrencyId, + GlobalDisputeLockId, GlobalDisputesPalletId, InflationPeriod, LiquidityMiningPalletId, + LockId, MaxAppeals, MaxApprovals, MaxAssets, MaxCategories, MaxCourtParticipants, + MaxCreatorFee, MaxDelegations, MaxDisputeDuration, MaxDisputes, MaxEditReasonLen, + MaxGlobalDisputeVotes, MaxGracePeriod, MaxInRatio, MaxMarketLifetime, MaxOracleDuration, + MaxOutRatio, MaxOwners, MaxRejectReasonLen, MaxReserves, MaxSelectedDraws, + MaxSubsidyPeriod, MaxSwapFee, MaxTotalWeight, MaxWeight, MinAssets, MinCategories, + MinDisputeDuration, MinJurorStake, MinOracleDuration, MinOutcomeVoteAmount, MinSubsidy, + MinSubsidyPeriod, MinWeight, MinimumPeriod, OutcomeBond, OutcomeFactor, OutsiderBond, + PmPalletId, RemoveKeysLimit, RequestInterval, SimpleDisputesPalletId, SwapsPalletId, + TreasuryPalletId, VotePeriod, VotingOutcomeFee, BASE, CENT, MILLISECS_PER_BLOCK, }, + traits::DeployPoolApi, types::{ AccountIdTest, Amount, Asset, Balance, BasicCurrencyAdapter, BlockNumber, BlockTest, CurrencyId, Hash, Index, MarketId, Moment, PoolId, SerdeWrapper, UncheckedExtrinsicTest, }, }; - -use zeitgeist_primitives::constants::mock::{ - AddOutcomePeriod, GdVotingPeriod, GlobalDisputeLockId, GlobalDisputesPalletId, - MaxGlobalDisputeVotes, MaxOwners, MinOutcomeVoteAmount, RemoveKeysLimit, VotingOutcomeFee, -}; - use zrml_rikiddo::types::{EmaMarketVolume, FeeSigmoid, RikiddoSigmoidMV}; pub const ALICE: AccountIdTest = 0; @@ -74,6 +72,76 @@ pub const SUDO: AccountIdTest = 69; pub const INITIAL_BALANCE: u128 = 1_000 * BASE; +#[allow(unused)] +pub struct DeployPoolMock; + +#[allow(unused)] +#[derive(Clone)] +pub struct DeployPoolArgs { + who: AccountIdTest, + market_id: MarketId, + amount: Balance, + swap_prices: Vec, + swap_fee: Balance, +} + +thread_local! { + pub static DEPLOY_POOL_CALL_DATA: RefCell> = RefCell::new(vec![]); + pub static DEPLOY_POOL_RETURN_VALUE: RefCell = RefCell::new(Ok(())); +} + +#[allow(unused)] +impl DeployPoolApi for DeployPoolMock { + type AccountId = AccountIdTest; + type Balance = Balance; + type MarketId = MarketId; + + fn deploy_pool( + who: Self::AccountId, + market_id: Self::MarketId, + amount: Self::Balance, + swap_prices: Vec, + swap_fee: Self::Balance, + ) -> DispatchResult { + DEPLOY_POOL_CALL_DATA.with(|value| { + value.borrow_mut().push(DeployPoolArgs { + who, + market_id, + amount, + swap_prices, + swap_fee, + }) + }); + DEPLOY_POOL_RETURN_VALUE.with(|v| *v.borrow()) + } +} + +#[allow(unused)] +impl DeployPoolMock { + pub fn called_once_with( + who: AccountIdTest, + market_id: MarketId, + amount: Balance, + swap_prices: Vec, + swap_fee: Balance, + ) -> bool { + if DEPLOY_POOL_CALL_DATA.with(|value| value.borrow().len()) != 1 { + return false; + } + let args = DEPLOY_POOL_CALL_DATA.with(|value| value.borrow()[0].clone()); + args.who == who + && args.market_id == market_id + && args.amount == amount + && args.swap_prices == swap_prices + && args.swap_fee == swap_fee + } + + pub fn return_error() { + DEPLOY_POOL_RETURN_VALUE + .with(|value| *value.borrow_mut() = Err(DispatchError::Other("neo-swaps"))); + } +} + ord_parameter_types! { pub const Sudo: AccountIdTest = SUDO; } @@ -124,6 +192,7 @@ impl crate::Config for Runtime { type MaxCreatorFee = MaxCreatorFee; type Court = Court; type DestroyOrigin = EnsureSignedBy; + type DeployPool = DeployPoolMock; type DisputeBond = DisputeBond; type RuntimeEvent = RuntimeEvent; type GlobalDisputes = GlobalDisputes; @@ -382,6 +451,7 @@ pub struct ExtBuilder { impl Default for ExtBuilder { fn default() -> Self { + DEPLOY_POOL_CALL_DATA.with(|value| value.borrow_mut().clear()); Self { balances: vec![ (ALICE, INITIAL_BALANCE), diff --git a/zrml/prediction-markets/src/tests.rs b/zrml/prediction-markets/src/tests.rs index f2825f3ff..d7675fefc 100644 --- a/zrml/prediction-markets/src/tests.rs +++ b/zrml/prediction-markets/src/tests.rs @@ -5753,6 +5753,76 @@ fn create_market_sets_the_correct_market_parameters_and_reserves_the_correct_amo }); } +#[test] +fn create_market_and_deploy_pool_works() { + ExtBuilder::default().build().execute_with(|| { + let creator = ALICE; + let creator_fee = Perbill::from_parts(1); + let oracle = BOB; + let period = MarketPeriod::Block(1..2); + let deadlines = Deadlines { + grace_period: 1, + oracle_duration: ::MinOracleDuration::get() + 2, + dispute_duration: ::MinDisputeDuration::get() + 3, + }; + let metadata = gen_metadata(0x99); + let MultiHash::Sha3_384(multihash) = metadata; + let market_type = MarketType::Categorical(7); + let dispute_mechanism = Some(MarketDisputeMechanism::Authorized); + let amount = 1234567890; + let swap_prices = vec![50 * CENT, 50 * CENT]; + let swap_fee = CENT; + let market_id = 0; + assert_ok!(PredictionMarkets::create_market_and_deploy_pool( + RuntimeOrigin::signed(creator), + Asset::Ztg, + creator_fee, + oracle, + period.clone(), + deadlines, + metadata, + market_type.clone(), + dispute_mechanism.clone(), + amount, + swap_prices.clone(), + swap_fee, + )); + let market = MarketCommons::market(&0).unwrap(); + let bonds = MarketBonds { + creation: Some(Bond::new(ALICE, ::ValidityBond::get())), + oracle: Some(Bond::new(ALICE, ::OracleBond::get())), + outsider: None, + dispute: None, + }; + assert_eq!(market.creator, creator); + assert_eq!(market.creation, MarketCreation::Permissionless); + assert_eq!(market.creator_fee, creator_fee); + assert_eq!(market.oracle, oracle); + assert_eq!(market.metadata, multihash); + assert_eq!(market.market_type, market_type); + assert_eq!(market.period, period); + assert_eq!(market.deadlines, deadlines); + assert_eq!(market.scoring_rule, ScoringRule::Lmsr); + assert_eq!(market.status, MarketStatus::Active); + assert_eq!(market.report, None); + assert_eq!(market.resolved_outcome, None); + assert_eq!(market.dispute_mechanism, dispute_mechanism); + assert_eq!(market.bonds, bonds); + // Check that the correct amount of full sets were bought. + assert_eq!( + AssetManager::free_balance(Asset::CategoricalOutcome(market_id, 0), &ALICE), + amount + ); + assert!(DeployPoolMock::called_once_with( + creator, + market_id, + amount, + swap_prices, + swap_fee + )); + }); +} + #[test] fn create_cpmm_market_and_deploy_assets_sets_the_correct_market_parameters_and_reserves_the_correct_amount() { @@ -5812,6 +5882,44 @@ fn create_cpmm_market_and_deploy_assets_sets_the_correct_market_parameters_and_r }); } +#[test] +fn create_market_and_deploy_pool_errors() { + ExtBuilder::default().build().execute_with(|| { + let creator = ALICE; + let oracle = BOB; + let period = MarketPeriod::Block(1..2); + let deadlines = Deadlines { + grace_period: 1, + oracle_duration: ::MinOracleDuration::get() + 2, + dispute_duration: ::MinDisputeDuration::get() + 3, + }; + let metadata = gen_metadata(0x99); + let market_type = MarketType::Categorical(7); + let dispute_mechanism = Some(MarketDisputeMechanism::Authorized); + let amount = 1234567890; + let swap_prices = vec![50 * CENT, 50 * CENT]; + let swap_fee = CENT; + DeployPoolMock::return_error(); + assert_noop!( + PredictionMarkets::create_market_and_deploy_pool( + RuntimeOrigin::signed(creator), + Asset::Ztg, + Perbill::zero(), + oracle, + period.clone(), + deadlines, + metadata, + market_type.clone(), + dispute_mechanism.clone(), + amount, + swap_prices.clone(), + swap_fee, + ), + DispatchError::Other("neo-swaps"), + ); + }); +} + #[test] fn create_market_functions_respect_fee_boundaries() { ExtBuilder::default().build().execute_with(|| { diff --git a/zrml/prediction-markets/src/weights.rs b/zrml/prediction-markets/src/weights.rs index d7f01477a..a2ea80eed 100644 --- a/zrml/prediction-markets/src/weights.rs +++ b/zrml/prediction-markets/src/weights.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for zrml_prediction_markets //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `10`, REPEAT: 1000, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-19`, STEPS: `10`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/weight_template.hbs +// --header=./HEADER_GPL3 // --output=./zrml/prediction-markets/src/weights.rs #![allow(unused_parens)] @@ -79,339 +82,571 @@ pub trait WeightInfoZeitgeist { fn market_status_manager(b: u32, f: u32) -> Weight; fn market_resolution_manager(r: u32, d: u32) -> Weight; fn process_subsidy_collecting_markets_dummy() -> Weight; + fn create_market_and_deploy_pool(m: u32) -> Weight; } /// Weight functions for zrml_prediction_markets (automatically generated) pub struct WeightInfo(PhantomData); impl WeightInfoZeitgeist for WeightInfo { - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: Balances Reserves (r:2 w:2) - // Storage: System Account (r:3 w:3) - // Storage: MarketCommons MarketPool (r:1 w:1) - // Storage: Swaps Pools (r:1 w:1) - // Storage: Tokens Accounts (r:2 w:2) - // Storage: Tokens TotalIssuance (r:2 w:2) - // Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:2 w:2) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: System Account (r:3 w:3) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:1) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:64 w:64) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:64 w:64) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) fn admin_destroy_disputed_market(a: u32, o: u32, c: u32, r: u32) -> Weight { - Weight::from_ref_time(138_848_000) - // Standard Error: 35_000 - .saturating_add(Weight::from_ref_time(20_922_000)) - .saturating_mul(a.into()) - // Standard Error: 34_000 - .saturating_add(Weight::from_ref_time(1_091_000).saturating_mul(o.into())) - // Standard Error: 34_000 - .saturating_add(Weight::from_ref_time(984_000).saturating_mul(c.into())) - // Standard Error: 34_000 - .saturating_add(Weight::from_ref_time(1_026_000).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(10)) + // Proof Size summary in bytes: + // Measured: `2060 + a * (215 ±0) + r * (16 ±0)` + // Estimated: `35846 + a * (5116 ±0)` + // Minimum execution time: 275_961 nanoseconds. + Weight::from_parts(223_802_648, 35846) + // Standard Error: 39_490 + .saturating_add(Weight::from_ref_time(29_860_680).saturating_mul(a.into())) + // Standard Error: 39_293 + .saturating_add(Weight::from_ref_time(133_295).saturating_mul(o.into())) + // Standard Error: 39_293 + .saturating_add(Weight::from_ref_time(199_113).saturating_mul(c.into())) + // Standard Error: 39_293 + .saturating_add(Weight::from_ref_time(205_263).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(10)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: System Account (r:2 w:2) - // Storage: MarketCommons MarketPool (r:1 w:1) - // Storage: Swaps Pools (r:1 w:1) - // Storage: Tokens Accounts (r:2 w:2) - // Storage: Tokens TotalIssuance (r:2 w:2) - // Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) - // Storage: PredictionMarkets Disputes (r:0 w:1) + .saturating_add(T::DbWeight::get().writes(10_u64)) + .saturating_add(Weight::from_proof_size(5116).saturating_mul(a.into())) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:1) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:64 w:64) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:64 w:64) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerReportBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) fn admin_destroy_reported_market(a: u32, _o: u32, _c: u32, r: u32) -> Weight { - Weight::from_ref_time(254_878_657) - // Standard Error: 42_573 - .saturating_add(Weight::from_ref_time(31_788_735).saturating_mul(a.into())) - // Standard Error: 42_361 - .saturating_add(Weight::from_ref_time(169_371).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(7)) + // Proof Size summary in bytes: + // Measured: `1691 + a * (215 ±0) + r * (16 ±0)` + // Estimated: `26991 + a * (5116 ±0)` + // Minimum execution time: 241_041 nanoseconds. + Weight::from_parts(196_167_863, 26991) + // Standard Error: 42_480 + .saturating_add(Weight::from_ref_time(30_146_656).saturating_mul(a.into())) + // Standard Error: 42_269 + .saturating_add(Weight::from_ref_time(177_697).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(8)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(Weight::from_proof_size(5116).saturating_mul(a.into())) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerOpenTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerCloseTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) fn admin_move_market_to_closed(_o: u32, c: u32) -> Weight { - Weight::from_ref_time(86_309_324) - // Standard Error: 3_132 - .saturating_add(Weight::from_ref_time(44_207).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: PredictionMarkets Disputes (r:0 w:1) - fn admin_move_market_to_resolved_scalar_reported(_r: u32) -> Weight { - Weight::from_ref_time(126_709_407) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: Swaps Pools (r:1 w:1) - // Storage: PredictionMarkets Disputes (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `788 + o * (16 ±0) + c * (16 ±0)` + // Estimated: `13092` + // Minimum execution time: 54_890 nanoseconds. + Weight::from_parts(63_112_401, 13092) + // Standard Error: 2_775 + .saturating_add(Weight::from_ref_time(31_849).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerReportBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + fn admin_move_market_to_resolved_scalar_reported(r: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `785 + r * (16 ±0)` + // Estimated: `12780` + // Minimum execution time: 81_821 nanoseconds. + Weight::from_parts(89_305_749, 12780) + // Standard Error: 5_012 + .saturating_add(Weight::from_ref_time(38_041).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerReportBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn admin_move_market_to_resolved_categorical_reported(r: u32) -> Weight { - Weight::from_ref_time(195_525_547) - // Standard Error: 7_775 - .saturating_add(Weight::from_ref_time(86_275).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: PredictionMarkets Disputes (r:1 w:1) - // Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) - // Storage: Balances Reserves (r:2 w:2) - // Storage: GlobalDisputes Winners (r:1 w:0) - // Storage: System Account (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `4478 + r * (16 ±0)` + // Estimated: `18906` + // Minimum execution time: 131_161 nanoseconds. + Weight::from_parts(145_030_674, 18906) + // Standard Error: 7_894 + .saturating_add(Weight::from_ref_time(17_273).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:2 w:2) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) fn admin_move_market_to_resolved_scalar_disputed(_r: u32) -> Weight { - Weight::from_ref_time(201_819_789) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(7)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: PredictionMarkets Disputes (r:1 w:1) - // Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) - // Storage: Balances Reserves (r:2 w:2) - // Storage: GlobalDisputes Winners (r:1 w:0) - // Storage: System Account (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: Swaps Pools (r:1 w:1) - fn admin_move_market_to_resolved_categorical_disputed(r: u32) -> Weight { - Weight::from_ref_time(274_621_947) - // Standard Error: 38_767 - .saturating_add(Weight::from_ref_time(381_876).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(10)) - .saturating_add(T::DbWeight::get().writes(8)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: PredictionMarkets MarketIdsForEdit (r:1 w:0) - // Storage: Balances Reserves (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `1311 + r * (16 ±0)` + // Estimated: `24506` + // Minimum execution time: 136_731 nanoseconds. + Weight::from_parts(153_221_659, 24506) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:2 w:2) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + fn admin_move_market_to_resolved_categorical_disputed(_r: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `4989 + r * (16 ±0)` + // Estimated: `30632` + // Minimum execution time: 187_561 nanoseconds. + Weight::from_parts(209_238_581, 30632) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsForEdit (r:1 w:0) + /// Proof: PredictionMarkets MarketIdsForEdit (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) fn approve_market() -> Weight { - Weight::from_ref_time(83_850_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: PredictionMarkets MarketIdsForEdit (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `576` + // Estimated: `10265` + // Minimum execution time: 50_180 nanoseconds. + Weight::from_parts(56_000_000, 10265) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsForEdit (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsForEdit (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) fn request_edit(r: u32) -> Weight { - Weight::from_ref_time(48_649_545) - // Standard Error: 147 - .saturating_add(Weight::from_ref_time(2_616).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: System Account (r:1 w:1) - // Storage: Tokens Accounts (r:2 w:2) - // Storage: Tokens TotalIssuance (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `515` + // Estimated: `6541` + // Minimum execution time: 25_330 nanoseconds. + Weight::from_parts(27_716_399, 6541) + // Standard Error: 93 + .saturating_add(Weight::from_ref_time(3_016).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:64 w:64) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:64 w:64) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) fn buy_complete_set(a: u32) -> Weight { - Weight::from_ref_time(84_414_899) - // Standard Error: 26_920 - .saturating_add(Weight::from_ref_time(23_198_063).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `516` + // Estimated: `5623 + a * (5116 ±0)` + // Minimum execution time: 94_390 nanoseconds. + Weight::from_parts(49_976_568, 5623) + // Standard Error: 34_483 + .saturating_add(Weight::from_ref_time(20_543_093).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) - } - // Storage: Timestamp Now (r:1 w:0) - // Storage: Balances Reserves (r:1 w:1) - // Storage: MarketCommons MarketCounter (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) - // Storage: MarketCommons Markets (r:0 w:1) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(5116).saturating_mul(a.into())) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketCounter (r:1 w:1) + /// Proof: MarketCommons MarketCounter (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerCloseTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:0 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) fn create_market(m: u32) -> Weight { - Weight::from_ref_time(90_275_808) - // Standard Error: 4_205 - .saturating_add(Weight::from_ref_time(22_734).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: PredictionMarkets MarketIdsForEdit (r:1 w:1) - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) - // Storage: Timestamp Now (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `240 + m * (16 ±0)` + // Estimated: `8263` + // Minimum execution time: 51_590 nanoseconds. + Weight::from_parts(58_403_973, 8263) + // Standard Error: 3_407 + .saturating_add(Weight::from_ref_time(72_624).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: PredictionMarkets MarketIdsForEdit (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsForEdit (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerCloseTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) fn edit_market(m: u32) -> Weight { - Weight::from_ref_time(81_809_671) - // Standard Error: 3_972 - .saturating_add(Weight::from_ref_time(10_058).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Swaps NextPoolId (r:1 w:1) - // Storage: Tokens Accounts (r:5 w:5) - // Storage: System Account (r:1 w:1) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: Timestamp Now (r:1 w:0) - // Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:1) - // Storage: Swaps Pools (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `731 + m * (16 ±0)` + // Estimated: `10569` + // Minimum execution time: 50_340 nanoseconds. + Weight::from_parts(55_894_142, 10569) + // Standard Error: 3_233 + .saturating_add(Weight::from_ref_time(65_400).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Swaps NextPoolId (r:1 w:1) + /// Proof: Swaps NextPoolId (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:129 w:129) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, 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: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerOpenTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:1) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:0 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn deploy_swap_pool_for_market_future_pool(a: u32, _o: u32) -> Weight { - Weight::from_ref_time(209_455_152) - // Standard Error: 51_016 - .saturating_add(Weight::from_ref_time(36_647_481).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(8)) + // Proof Size summary in bytes: + // Measured: `1208 + a * (118 ±0) + o * (16 ±0)` + // Estimated: `17801 + a * (5196 ±0)` + // Minimum execution time: 183_711 nanoseconds. + Weight::from_parts(125_849_185, 17801) + // Standard Error: 50_587 + .saturating_add(Weight::from_ref_time(34_168_218).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(7)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) - } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Swaps NextPoolId (r:1 w:1) - // Storage: Tokens Accounts (r:5 w:5) - // Storage: System Account (r:1 w:1) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: Timestamp Now (r:1 w:0) - // Storage: MarketCommons MarketPool (r:1 w:1) - // Storage: Swaps Pools (r:0 w:1) + .saturating_add(T::DbWeight::get().writes(7_u64)) + .saturating_add(Weight::from_proof_size(5196).saturating_mul(a.into())) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Swaps NextPoolId (r:1 w:1) + /// Proof: Swaps NextPoolId (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:129 w:129) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, 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: MarketCommons MarketPool (r:1 w:1) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:0 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn deploy_swap_pool_for_market_open_pool(a: u32) -> Weight { - Weight::from_ref_time(149_637_355) - // Standard Error: 45_016 - .saturating_add(Weight::from_ref_time(38_164_789).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(7)) + // Proof Size summary in bytes: + // Measured: `1074 + a * (119 ±0)` + // Estimated: `14276 + a * (5196 ±0)` + // Minimum execution time: 185_270 nanoseconds. + Weight::from_parts(121_585_882, 14276) + // Standard Error: 50_458 + .saturating_add(Weight::from_ref_time(34_187_947).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(6)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) - } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: GlobalDisputes Winners (r:1 w:1) - // Storage: Court MarketIdToCourtId (r:1 w:0) - // Storage: Court JurorPool (r:1 w:0) - // Storage: Court Courts (r:1 w:1) - // Storage: Court CourtIdToMarketId (r:1 w:0) - // Storage: Court SelectedDraws (r:1 w:1) - // Storage: Court Jurors (r:30 w:30) - // Storage: GlobalDisputes Outcomes (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + .saturating_add(T::DbWeight::get().writes(6_u64)) + .saturating_add(Weight::from_proof_size(5196).saturating_mul(a.into())) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:1) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: Court MarketIdToCourtId (r:1 w:0) + /// Proof: Court MarketIdToCourtId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court CourtPool (r:1 w:0) + /// Proof: Court CourtPool (max_values: Some(1), max_size: Some(72002), added: 72497, mode: MaxEncodedLen) + /// Storage: Court Courts (r:1 w:1) + /// Proof: Court Courts (max_values: None, max_size: Some(349), added: 2824, mode: MaxEncodedLen) + /// Storage: Court CourtIdToMarketId (r:1 w:0) + /// Proof: Court CourtIdToMarketId (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Court SelectedDraws (r:1 w:1) + /// Proof: Court SelectedDraws (max_values: None, max_size: Some(149974), added: 152449, mode: MaxEncodedLen) + /// Storage: Court Participants (r:31 w:31) + /// Proof: Court Participants (max_values: None, max_size: Some(251), added: 2726, mode: MaxEncodedLen) + /// Storage: GlobalDisputes Outcomes (r:1 w:1) + /// Proof: GlobalDisputes Outcomes (max_values: None, max_size: Some(395), added: 2870, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) fn start_global_dispute(m: u32, n: u32) -> Weight { - Weight::from_ref_time(203_655_000) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(67_000).saturating_mul(m.into())) - // Standard Error: 1_000 - .saturating_add(Weight::from_ref_time(15_000).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(39)) - .saturating_add(T::DbWeight::get().writes(35)) - } - // Storage: PredictionMarkets Disputes (r:1 w:1) - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `9153 + m * (16 ±0)` + // Estimated: `329580` + // Minimum execution time: 318_381 nanoseconds. + Weight::from_parts(343_839_230, 329580) + // Standard Error: 15_691 + .saturating_add(Weight::from_ref_time(141_874).saturating_mul(m.into())) + // Standard Error: 15_691 + .saturating_add(Weight::from_ref_time(107_823).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(40_u64)) + .saturating_add(T::DbWeight::get().writes(36_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) fn dispute_authorized() -> Weight { - Weight::from_ref_time(90_441_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: PredictionMarkets MarketIdsForEdit (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `622` + // Estimated: `6740` + // Minimum execution time: 42_720 nanoseconds. + Weight::from_parts(44_301_000, 6740) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsForEdit (r:0 w:1) + /// Proof: PredictionMarkets MarketIdsForEdit (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) fn handle_expired_advised_market() -> Weight { - Weight::from_ref_time(88_150_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: Swaps Pools (r:1 w:1) - // Storage: PredictionMarkets Disputes (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `535` + // Estimated: `6740` + // Minimum execution time: 55_820 nanoseconds. + Weight::from_parts(57_280_000, 6740) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn internal_resolve_categorical_reported() -> Weight { - Weight::from_ref_time(173_470_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: PredictionMarkets Disputes (r:1 w:1) - // Storage: GlobalDisputes Winners (r:1 w:0) - // Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: Swaps Pools (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `4315` + // Estimated: `15389` + // Minimum execution time: 107_820 nanoseconds. + Weight::from_parts(123_431_000, 15389) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn internal_resolve_categorical_disputed() -> Weight { - Weight::from_ref_time(234_201_000) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: PredictionMarkets Disputes (r:0 w:1) + // Proof Size summary in bytes: + // Measured: `4570` + // Estimated: `20784` + // Minimum execution time: 155_591 nanoseconds. + Weight::from_parts(162_400_000, 20784) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) fn internal_resolve_scalar_reported() -> Weight { - Weight::from_ref_time(98_370_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: PredictionMarkets Disputes (r:1 w:1) - // Storage: GlobalDisputes Winners (r:1 w:0) - // Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:0) + // Proof Size summary in bytes: + // Measured: `622` + // Estimated: `9263` + // Minimum execution time: 59_350 nanoseconds. + Weight::from_parts(66_380_000, 9263) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: GlobalDisputes GlobalDisputesInfo (r:1 w:0) + /// Proof: GlobalDisputes GlobalDisputesInfo (max_values: None, max_size: Some(396), added: 2871, mode: MaxEncodedLen) + /// Storage: Authorized AuthorizedOutcomeReports (r:1 w:1) + /// Proof: Authorized AuthorizedOutcomeReports (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) fn internal_resolve_scalar_disputed() -> Weight { - Weight::from_ref_time(163_490_000) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: Timestamp Now (r:1 w:0) - // Storage: PredictionMarkets MarketsCollectingSubsidy (r:1 w:1) - // Storage: PredictionMarkets LastTimeFrame (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerOpenBlock (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerCloseBlock (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `892` + // Estimated: `14658` + // Minimum execution time: 101_650 nanoseconds. + Weight::from_parts(123_340_000, 14658) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketsCollectingSubsidy (r:1 w:1) + /// Proof: PredictionMarkets MarketsCollectingSubsidy (max_values: Some(1), max_size: Some(529), added: 1024, mode: MaxEncodedLen) + /// Storage: PredictionMarkets LastTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets LastTimeFrame (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerOpenBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerOpenBlock (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerOpenTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerCloseBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerCloseBlock (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerCloseTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerReportBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) fn on_initialize_resolve_overhead() -> Weight { - Weight::from_ref_time(42_890_000) - .saturating_add(T::DbWeight::get().reads(9)) - .saturating_add(T::DbWeight::get().writes(8)) - } - // Storage: PredictionMarkets MarketsCollectingSubsidy (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `79` + // Estimated: `23164` + // Minimum execution time: 33_180 nanoseconds. + Weight::from_parts(34_210_000, 23164) + .saturating_add(T::DbWeight::get().reads(9_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } + /// Storage: PredictionMarkets MarketsCollectingSubsidy (r:1 w:1) + /// Proof: PredictionMarkets MarketsCollectingSubsidy (max_values: Some(1), max_size: Some(529), added: 1024, mode: MaxEncodedLen) fn process_subsidy_collecting_markets_raw(a: u32) -> Weight { - Weight::from_ref_time(10_084_035) - // Standard Error: 3_989 - .saturating_add(Weight::from_ref_time(344_346).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Tokens Accounts (r:1 w:1) - // Storage: System Account (r:1 w:1) - // Storage: Tokens TotalIssuance (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `63 + a * (33 ±0)` + // Estimated: `1024` + // Minimum execution time: 5_290 nanoseconds. + Weight::from_parts(7_432_139, 1024) + // Standard Error: 6_874 + .saturating_add(Weight::from_ref_time(481_432).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:1 w:1) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) fn redeem_shares_categorical() -> Weight { - Weight::from_ref_time(138_340_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Account (r:1 w:1) - // Storage: Tokens TotalIssuance (r:2 w:2) + // Proof Size summary in bytes: + // Measured: `2024` + // Estimated: `10739` + // Minimum execution time: 92_690 nanoseconds. + Weight::from_parts(96_821_000, 10739) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:2 w:2) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:2 w:2) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) fn redeem_shares_scalar() -> Weight { - Weight::from_ref_time(149_531_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: MarketCommons Markets (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) - // Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) - // Storage: Balances Reserves (r:1 w:1) - // Storage: PredictionMarkets MarketIdsForEdit (r:0 w:1) - fn reject_market(c: u32, o: u32, _r: u32) -> Weight { - Weight::from_ref_time(146_031_046) - // Standard Error: 4_161 - .saturating_add(Weight::from_ref_time(27_268).saturating_mul(c.into())) - // Standard Error: 4_161 - .saturating_add(Weight::from_ref_time(2_604).saturating_mul(o.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `1171` + // Estimated: `15855` + // Minimum execution time: 117_211 nanoseconds. + Weight::from_parts(133_970_000, 15855) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: MarketCommons Markets (r:1 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerOpenTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerCloseTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsForEdit (r:0 w:1) + /// Proof: PredictionMarkets MarketIdsForEdit (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + fn reject_market(_c: u32, _o: u32, r: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `719 + c * (16 ±0) + o * (16 ±0)` + // Estimated: `13790` + // Minimum execution time: 94_260 nanoseconds. + Weight::from_parts(106_089_785, 13790) + // Standard Error: 266 + .saturating_add(Weight::from_ref_time(1_689).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } // Storage: MarketCommons Markets (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) @@ -429,59 +664,123 @@ impl WeightInfoZeitgeist for WeightInfo { // Storage: Tokens Accounts (r:2 w:2) // Storage: Tokens TotalIssuance (r:2 w:2) fn sell_complete_set(a: u32) -> Weight { - Weight::from_ref_time(87_488_793) - // Standard Error: 42_709 - .saturating_add(Weight::from_ref_time(29_813_566).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `756 + a * (161 ±0)` + // Estimated: `5623 + a * (5116 ±0)` + // Minimum execution time: 108_711 nanoseconds. + Weight::from_parts(62_607_060, 5623) + // Standard Error: 40_843 + .saturating_add(Weight::from_ref_time(27_796_650).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) - } - // Storage: Swaps NextPoolId (r:1 w:1) - // Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:1) - // Storage: MarketCommons MarketPool (r:1 w:1) - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: PredictionMarkets MarketsCollectingSubsidy (r:1 w:1) - // Storage: Swaps Pools (r:0 w:1) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(5116).saturating_mul(a.into())) + } + /// Storage: Swaps NextPoolId (r:1 w:1) + /// Proof: Swaps NextPoolId (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:1) + /// Proof: RikiddoSigmoidFeeMarketEma RikiddoPerPool (max_values: None, max_size: Some(320), added: 2795, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:1) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketsCollectingSubsidy (r:1 w:1) + /// Proof: PredictionMarkets MarketsCollectingSubsidy (max_values: Some(1), max_size: Some(529), added: 1024, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:0 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn start_subsidy(a: u32) -> Weight { - Weight::from_ref_time(69_820_887) - // Standard Error: 3_025 - .saturating_add(Weight::from_ref_time(57_981).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) - } - // Storage: PredictionMarkets MarketIdsPerOpenBlock (r:1 w:1) - // Storage: MarketCommons Markets (r:32 w:0) - // Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) + // Proof Size summary in bytes: + // Measured: `525` + // Estimated: `9869` + // Minimum execution time: 44_180 nanoseconds. + Weight::from_parts(48_544_019, 9869) + // Standard Error: 2_939 + .saturating_add(Weight::from_ref_time(91_778).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: PredictionMarkets MarketIdsPerOpenBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerOpenBlock (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:62 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerOpenTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerOpenTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) fn market_status_manager(b: u32, f: u32) -> Weight { - Weight::from_ref_time(63_219_770) - // Standard Error: 20_913 - .saturating_add(Weight::from_ref_time(3_795_278).saturating_mul(b.into())) - // Standard Error: 20_913 - .saturating_add(Weight::from_ref_time(3_912_732).saturating_mul(f.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `2536 + b * (325 ±0) + f * (327 ±0)` + // Estimated: `7050 + b * (3016 ±0) + f * (3016 ±0)` + // Minimum execution time: 159_270 nanoseconds. + Weight::from_parts(54_901_658, 7050) + // Standard Error: 22_664 + .saturating_add(Weight::from_ref_time(3_831_565).saturating_mul(b.into())) + // Standard Error: 22_664 + .saturating_add(Weight::from_ref_time(3_813_691).saturating_mul(f.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(f.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) - // Storage: MarketCommons Markets (r:32 w:0) - // Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(3016).saturating_mul(b.into())) + .saturating_add(Weight::from_proof_size(3016).saturating_mul(f.into())) + } + /// Storage: PredictionMarkets MarketIdsPerReportBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerReportBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:62 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerDisputeBlock (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerDisputeBlock (max_values: None, max_size: Some(1042), added: 3517, mode: MaxEncodedLen) fn market_resolution_manager(r: u32, d: u32) -> Weight { - Weight::from_ref_time(55_644_134) - // Standard Error: 20_376 - .saturating_add(Weight::from_ref_time(3_909_790).saturating_mul(r.into())) - // Standard Error: 20_376 - .saturating_add(Weight::from_ref_time(4_055_491).saturating_mul(d.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `2487 + r * (325 ±0) + d * (327 ±0)` + // Estimated: `7034 + r * (3016 ±0) + d * (3016 ±0)` + // Minimum execution time: 157_310 nanoseconds. + Weight::from_parts(52_065_042, 7034) + // Standard Error: 22_349 + .saturating_add(Weight::from_ref_time(3_800_277).saturating_mul(r.into())) + // Standard Error: 22_349 + .saturating_add(Weight::from_ref_time(3_858_826).saturating_mul(d.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().reads((1_u64).saturating_mul(d.into()))) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(3016).saturating_mul(r.into())) + .saturating_add(Weight::from_proof_size(3016).saturating_mul(d.into())) } - // Storage: PredictionMarkets MarketsCollectingSubsidy (r:1 w:1) + /// Storage: PredictionMarkets MarketsCollectingSubsidy (r:1 w:1) + /// Proof: PredictionMarkets MarketsCollectingSubsidy (max_values: Some(1), max_size: Some(529), added: 1024, mode: MaxEncodedLen) fn process_subsidy_collecting_markets_dummy() -> Weight { - Weight::from_ref_time(9_390_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `27` + // Estimated: `1024` + // Minimum execution time: 5_120 nanoseconds. + Weight::from_parts(5_900_000, 1024) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketCounter (r:1 w:1) + /// Proof: MarketCommons MarketCounter (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: PredictionMarkets MarketIdsPerCloseTimeFrame (r:1 w:1) + /// Proof: PredictionMarkets MarketIdsPerCloseTimeFrame (max_values: None, max_size: Some(1050), added: 3525, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:4 w:4) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:2 w:2) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: NeoSwaps Pools (r:1 w:1) + /// Proof: NeoSwaps Pools (max_values: None, max_size: Some(4652), added: 7127, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:0 w:1) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + fn create_market_and_deploy_pool(_m: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `291 + m * (17 ±0)` + // Estimated: `36032` + // Minimum execution time: 166_000 nanoseconds. + Weight::from_parts(172_000_000, 36032) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) } } diff --git a/zrml/rikiddo/Cargo.toml b/zrml/rikiddo/Cargo.toml index 37ecc1c7c..d4e752bf5 100644 --- a/zrml/rikiddo/Cargo.toml +++ b/zrml/rikiddo/Cargo.toml @@ -42,4 +42,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-rikiddo" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/simple-disputes/Cargo.toml b/zrml/simple-disputes/Cargo.toml index d84a51431..23f6d4323 100644 --- a/zrml/simple-disputes/Cargo.toml +++ b/zrml/simple-disputes/Cargo.toml @@ -41,4 +41,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-simple-disputes" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/styx/Cargo.toml b/zrml/styx/Cargo.toml index c7690f628..994818ab1 100644 --- a/zrml/styx/Cargo.toml +++ b/zrml/styx/Cargo.toml @@ -36,4 +36,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-styx" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/styx/src/weights.rs b/zrml/styx/src/weights.rs index 0b0bd96c3..bbfa956a4 100644 --- a/zrml/styx/src/weights.rs +++ b/zrml/styx/src/weights.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for zrml_styx //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `10`, REPEAT: 1000, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-20`, STEPS: `10`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/weight_template.hbs +// --header=./HEADER_GPL3 // --output=./zrml/styx/src/weights.rs #![allow(unused_parens)] @@ -53,15 +56,26 @@ pub trait WeightInfoZeitgeist { /// Weight functions for zrml_styx (automatically generated) pub struct WeightInfo(PhantomData); impl WeightInfoZeitgeist for WeightInfo { - // Storage: Styx Crossings (r:1 w:1) - // Storage: Styx BurnAmount (r:1 w:0) + /// Storage: Styx Crossings (r:1 w:1) + /// Proof: Styx Crossings (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Styx BurnAmount (r:1 w:0) + /// Proof: Styx BurnAmount (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) fn cross() -> Weight { - Weight::from_ref_time(58_271_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3034` + // Minimum execution time: 31_880 nanoseconds. + Weight::from_parts(39_500_000, 3034) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Styx BurnAmount (r:0 w:1) + /// Storage: Styx BurnAmount (r:0 w:1) + /// Proof: Styx BurnAmount (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) fn set_burn_amount() -> Weight { - Weight::from_ref_time(30_150_000).saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_510 nanoseconds. + Weight::from_ref_time(11_070_000).saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/zrml/swaps/Cargo.toml b/zrml/swaps/Cargo.toml index efac5dfb8..9cbc0b141 100644 --- a/zrml/swaps/Cargo.toml +++ b/zrml/swaps/Cargo.toml @@ -66,4 +66,4 @@ try-runtime = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-swaps" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/swaps/rpc/Cargo.toml b/zrml/swaps/rpc/Cargo.toml index 917bc1137..5b08b01bd 100644 --- a/zrml/swaps/rpc/Cargo.toml +++ b/zrml/swaps/rpc/Cargo.toml @@ -11,4 +11,4 @@ zrml-swaps-runtime-api = { workspace = true, features = ["default"] } authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-swaps-rpc" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/swaps/runtime-api/Cargo.toml b/zrml/swaps/runtime-api/Cargo.toml index fade3ab74..84ddfa098 100644 --- a/zrml/swaps/runtime-api/Cargo.toml +++ b/zrml/swaps/runtime-api/Cargo.toml @@ -18,4 +18,4 @@ std = [ authors = ["Zeitgeist PM "] edition = "2021" name = "zrml-swaps-runtime-api" -version = "0.3.11" +version = "0.4.0" diff --git a/zrml/swaps/src/lib.rs b/zrml/swaps/src/lib.rs index 19dfa2f43..bf8d93d3b 100644 --- a/zrml/swaps/src/lib.rs +++ b/zrml/swaps/src/lib.rs @@ -116,7 +116,7 @@ mod pallet { pub(crate) const ARBITRAGE_MAX_ITERATIONS: usize = 30; const ARBITRAGE_THRESHOLD: u128 = CENT; const MIN_BALANCE: u128 = CENT; - const ON_IDLE_MIN_WEIGHT: Weight = Weight::from_ref_time(1_000_000); + const ON_IDLE_MIN_WEIGHT: Weight = Weight::from_parts(1_000_000, 100_000); #[pallet::call] impl Pallet { @@ -1275,19 +1275,33 @@ mod pallet { // The division can fail if the benchmark of `apply_to_cached_pools` is not linear in // the number of pools. This shouldn't ever happen, but if it does, we ensure that // `pool_count` is zero (this isn't really a runtime error). - let pool_count = weight + let weight_minus_overhead = weight.saturating_sub(overhead); + let max_pool_count_by_ref_time = weight_minus_overhead .ref_time() - .saturating_sub(overhead.ref_time()) .checked_div(extra_weight_per_pool.ref_time()) .unwrap_or_else(|| { - log::warn!("Unexpected zero division when calculating arbitrage weight"); + debug_assert!( + false, + "Unexpected zero division when calculating arbitrage ref time" + ); + 0_u64 + }); + let max_pool_count_by_proof_size = weight_minus_overhead + .proof_size() + .checked_div(extra_weight_per_pool.proof_size()) + .unwrap_or_else(|| { + debug_assert!( + false, + "Unexpected zero division when calculating arbitrage proof size" + ); 0_u64 }); - if pool_count == 0_u64 { + let max_pool_count = max_pool_count_by_ref_time.min(max_pool_count_by_proof_size); + if max_pool_count == 0_u64 { return weight; } Self::apply_to_cached_pools( - pool_count.saturated_into(), + max_pool_count.saturated_into(), |pool_id| Self::execute_arbitrage(pool_id, ARBITRAGE_MAX_ITERATIONS), extra_weight_per_pool, ) @@ -1942,7 +1956,7 @@ mod pallet { let pool_amount = >::zero(); (pool_status, total_subsidy, total_weight, weights, pool_amount) } - ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { return Err(Error::::InvalidScoringRule.into()); } }; @@ -2503,7 +2517,7 @@ mod pallet { T::RikiddoSigmoidFeeMarketEma::cost(pool_id, &outstanding_after)?; cost_before.checked_sub(&cost_after).ok_or(ArithmeticError::Overflow)? } - ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { return Err(Error::::InvalidScoringRule.into()); } }; @@ -2555,7 +2569,7 @@ mod pallet { ScoringRule::RikiddoSigmoidFeeMarketEma => Ok( T::WeightInfo::swap_exact_amount_in_rikiddo(pool.assets.len().saturated_into()), ), - ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { Err(Error::::InvalidScoringRule.into()) } } @@ -2665,7 +2679,7 @@ mod pallet { T::RikiddoSigmoidFeeMarketEma::cost(pool_id, &outstanding_after)?; cost_after.checked_sub(&cost_before).ok_or(ArithmeticError::Overflow)? } - ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { return Err(Error::::InvalidScoringRule.into()); } }; @@ -2729,7 +2743,7 @@ mod pallet { pool.assets.len().saturated_into(), )) } - ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { Err(Error::::InvalidScoringRule.into()) } } diff --git a/zrml/swaps/src/utils.rs b/zrml/swaps/src/utils.rs index 36ea5660a..afe06ca3c 100644 --- a/zrml/swaps/src/utils.rs +++ b/zrml/swaps/src/utils.rs @@ -216,7 +216,7 @@ where return Err(Error::::UnsupportedTrade.into()); } } - ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { return Err(Error::::InvalidScoringRule.into()); } } @@ -233,7 +233,7 @@ where spot_price_before.saturating_sub(spot_price_after) < 20u8.into(), Error::::MathApproximation ), - ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { return Err(Error::::InvalidScoringRule.into()); } } @@ -256,7 +256,7 @@ where let volume = if p.asset_in == base_asset { asset_amount_in } else { asset_amount_out }; T::RikiddoSigmoidFeeMarketEma::update_volume(p.pool_id, volume)?; } - ScoringRule::Orderbook | ScoringRule::Parimutuel => { + ScoringRule::Lmsr | ScoringRule::Parimutuel | ScoringRule::Orderbook => { return Err(Error::::InvalidScoringRule.into()); } } diff --git a/zrml/swaps/src/weights.rs b/zrml/swaps/src/weights.rs index b06f18e56..0939fdccc 100644 --- a/zrml/swaps/src/weights.rs +++ b/zrml/swaps/src/weights.rs @@ -19,8 +19,10 @@ //! Autogenerated weights for zrml_swaps //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-04, STEPS: `10`, REPEAT: 1000, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: `2023-09-20`, STEPS: `10`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `zeitgeist-benchmark`, CPU: `AMD EPYC 7601 32-Core Processor` +//! EXECUTION: `Some(Wasm)`, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` // Executed Command: // ./target/production/zeitgeist @@ -35,6 +37,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --template=./misc/weight_template.hbs +// --header=./HEADER_GPL3 // --output=./zrml/swaps/src/weights.rs #![allow(unused_parens)] @@ -77,286 +80,494 @@ pub trait WeightInfoZeitgeist { /// Weight functions for zrml_swaps (automatically generated) pub struct WeightInfo(PhantomData); impl WeightInfoZeitgeist for WeightInfo { - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: Swaps Pools (r:1 w:1) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn admin_clean_up_pool_cpmm_categorical(a: u32) -> Weight { - Weight::from_ref_time(67_856_380) - // Standard Error: 4_362 - .saturating_add(Weight::from_ref_time(646_771).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `693 + a * (54 ±0)` + // Estimated: `11665` + // Minimum execution time: 42_370 nanoseconds. + Weight::from_parts(50_199_865, 11665) + // Standard Error: 3_369 + .saturating_add(Weight::from_ref_time(371_113).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: MarketCommons Markets (r:1 w:0) - // Storage: MarketCommons MarketPool (r:1 w:0) - // Storage: Swaps Pools (r:1 w:1) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: MarketCommons MarketPool (r:1 w:0) + /// Proof: MarketCommons MarketPool (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn admin_clean_up_pool_cpmm_scalar() -> Weight { - Weight::from_ref_time(66_280_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `885` + // Estimated: `11665` + // Minimum execution time: 38_790 nanoseconds. + Weight::from_parts(44_200_000, 11665) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Swaps PoolsCachedForArbitrage (r:8 w:7) - // Storage: Swaps Pools (r:7 w:0) - // Storage: Tokens Accounts (r:462 w:462) - // Storage: System Account (r:7 w:0) - // Storage: Tokens TotalIssuance (r:64 w:64) + /// Storage: Swaps PoolsCachedForArbitrage (r:64 w:63) + /// Proof: Swaps PoolsCachedForArbitrage (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) + /// Storage: Swaps Pools (r:63 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:4158 w:4158) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:63 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:64 w:64) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) fn apply_to_cached_pools_execute_arbitrage(a: u32) -> Weight { - Weight::from_ref_time(1_010_000) - // Standard Error: 609_425 - .saturating_add(Weight::from_ref_time(2_500_397_183).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(43)) + // Proof Size summary in bytes: + // Measured: `3255 + a * (11514 ±0)` + // Estimated: `163651 + a * (182700 ±0)` + // Minimum execution time: 960 nanoseconds. + Weight::from_parts(1_100_000, 163651) + // Standard Error: 423_665 + .saturating_add(Weight::from_ref_time(2_379_782_150).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(43_u64)) .saturating_add(T::DbWeight::get().reads((70_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(42)) - .saturating_add(T::DbWeight::get().writes((67_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(42_u64)) + .saturating_add(Weight::from_proof_size(182700).saturating_mul(a.into())) } - // Storage: Swaps PoolsCachedForArbitrage (r:8 w:7) + /// Storage: Swaps PoolsCachedForArbitrage (r:64 w:63) + /// Proof: Swaps PoolsCachedForArbitrage (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) fn apply_to_cached_pools_noop(a: u32) -> Weight { - Weight::from_ref_time(1_130_000) - // Standard Error: 7_441 - .saturating_add(Weight::from_ref_time(9_710_701).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(1)) + // Proof Size summary in bytes: + // Measured: `27 + a * (27 ±0)` + // Estimated: `2499 + a * (2499 ±0)` + // Minimum execution time: 880 nanoseconds. + Weight::from_parts(1_050_000, 2499) + // Standard Error: 9_590 + .saturating_add(Weight::from_ref_time(9_302_520).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into()))) + .saturating_add(Weight::from_proof_size(2499).saturating_mul(a.into())) } - // Storage: Swaps Pools (r:1 w:1) - // Storage: Swaps SubsidyProviders (r:1 w:0) - // Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:1) - // Storage: Tokens Accounts (r:1 w:1) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Swaps SubsidyProviders (r:11 w:10) + /// Proof: Swaps SubsidyProviders (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:10 w:10) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:1) + /// Proof: RikiddoSigmoidFeeMarketEma RikiddoPerPool (max_values: None, max_size: Some(320), added: 2795, mode: MaxEncodedLen) fn destroy_pool_in_subsidy_phase(a: u32) -> Weight { - Weight::from_ref_time(57_315_340) - // Standard Error: 58_469 - .saturating_add(Weight::from_ref_time(23_066_707).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `805 + a * (297 ±0)` + // Estimated: `11476 + a * (5153 ±0)` + // Minimum execution time: 30_460 nanoseconds. + Weight::from_parts(43_611_666, 11476) + // Standard Error: 56_949 + .saturating_add(Weight::from_ref_time(21_916_090).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(5153).saturating_mul(a.into())) } - // Storage: Tokens TotalIssuance (r:2 w:1) - // Storage: Tokens Accounts (r:46 w:21) - // Storage: System Account (r:11 w:10) + /// Storage: Tokens TotalIssuance (r:2 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:76 w:21) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:11 w:10) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn distribute_pool_share_rewards(a: u32, b: u32) -> Weight { - Weight::from_ref_time(4_160_449) - // Standard Error: 202_739 - .saturating_add(Weight::from_ref_time(30_962_172).saturating_mul(a.into())) - // Standard Error: 202_739 - .saturating_add(Weight::from_ref_time(50_599_977).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(7)) + // Proof Size summary in bytes: + // Measured: `662 + a * (414 ±0) + b * (161 ±0)` + // Estimated: `19084 + a * (7887 ±5) + b * (5500 ±5)` + // Minimum execution time: 492_972 nanoseconds. + Weight::from_parts(6_751_523, 19084) + // Standard Error: 217_166 + .saturating_add(Weight::from_ref_time(29_973_920).saturating_mul(a.into())) + // Standard Error: 217_166 + .saturating_add(Weight::from_ref_time(46_530_689).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(b.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(7887).saturating_mul(a.into())) + .saturating_add(Weight::from_proof_size(5500).saturating_mul(b.into())) } - // Storage: Swaps Pools (r:1 w:1) - // Storage: Swaps SubsidyProviders (r:11 w:10) - // Storage: Tokens Accounts (r:22 w:22) - // Storage: System Account (r:11 w:11) - // Storage: Tokens TotalIssuance (r:2 w:2) - // Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:0) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Swaps SubsidyProviders (r:11 w:10) + /// Proof: Swaps SubsidyProviders (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:85 w:85) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:11 w:11) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:65 w:65) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:0) + /// Proof: RikiddoSigmoidFeeMarketEma RikiddoPerPool (max_values: None, max_size: Some(320), added: 2795, mode: MaxEncodedLen) fn end_subsidy_phase(a: u32, b: u32) -> Weight { - Weight::from_ref_time(30_240_000) - // Standard Error: 97_049 - .saturating_add(Weight::from_ref_time(21_762_950).saturating_mul(a.into())) - // Standard Error: 644_532 - .saturating_add(Weight::from_ref_time(93_925_885).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(1)) + // Proof Size summary in bytes: + // Measured: `0 + a * (169 ±0) + b * (1159 ±0)` + // Estimated: `14083 + a * (5116 ±0) + b * (10358 ±0)` + // Minimum execution time: 14_290 nanoseconds. + Weight::from_parts(14_990_000, 14083) + // Standard Error: 91_418 + .saturating_add(Weight::from_ref_time(20_384_803).saturating_mul(a.into())) + // Standard Error: 607_133 + .saturating_add(Weight::from_ref_time(89_338_448).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(b.into()))) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes((6_u64).saturating_mul(b.into()))) + .saturating_add(Weight::from_proof_size(5116).saturating_mul(a.into())) + .saturating_add(Weight::from_proof_size(10358).saturating_mul(b.into())) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens Accounts (r:3 w:3) - // Storage: System Account (r:1 w:0) - // Storage: Tokens TotalIssuance (r:1 w:1) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:66 w:66) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:64 w:64) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) fn execute_arbitrage_buy_burn(a: u32) -> Weight { - Weight::from_ref_time(97_947_393) - // Standard Error: 58_048 - .saturating_add(Weight::from_ref_time(39_654_212).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `765 + a * (215 ±0)` + // Estimated: `13849 + a * (5005 ±0)` + // Minimum execution time: 103_400 nanoseconds. + Weight::from_parts(73_422_872, 13849) + // Standard Error: 54_392 + .saturating_add(Weight::from_ref_time(37_718_384).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) + .saturating_add(Weight::from_proof_size(5005).saturating_mul(a.into())) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens Accounts (r:3 w:3) - // Storage: System Account (r:2 w:1) - // Storage: Tokens TotalIssuance (r:1 w:1) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:66 w:66) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:64 w:64) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) fn execute_arbitrage_mint_sell(a: u32) -> Weight { - Weight::from_ref_time(109_894_883) - // Standard Error: 60_892 - .saturating_add(Weight::from_ref_time(36_712_882).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `563 + a * (215 ±0)` + // Estimated: `16456 + a * (5005 ±0)` + // Minimum execution time: 108_430 nanoseconds. + Weight::from_parts(72_740_184, 16456) + // Standard Error: 60_820 + .saturating_add(Weight::from_ref_time(35_573_554).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_proof_size(5005).saturating_mul(a.into())) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens Accounts (r:2 w:0) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:65 w:0) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) fn execute_arbitrage_skipped(a: u32) -> Weight { - Weight::from_ref_time(43_325_608) - // Standard Error: 13_337 - .saturating_add(Weight::from_ref_time(5_389_004).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(1)) + // Proof Size summary in bytes: + // Measured: `406 + a * (167 ±0)` + // Estimated: `6126 + a * (2598 ±0)` + // Minimum execution time: 30_460 nanoseconds. + Weight::from_parts(29_668_341, 6126) + // Standard Error: 13_072 + .saturating_add(Weight::from_ref_time(5_079_375).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) + .saturating_add(Weight::from_proof_size(2598).saturating_mul(a.into())) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: Tokens Accounts (r:5 w:5) - // Storage: System Account (r:1 w:0) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:131 w:131) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) fn pool_exit(a: u32) -> Weight { - Weight::from_ref_time(96_953_468) - // Standard Error: 42_426 - .saturating_add(Weight::from_ref_time(29_789_790).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(4)) + // Proof Size summary in bytes: + // Measured: `1015 + a * (286 ±0)` + // Estimated: `13849 + a * (5196 ±0)` + // Minimum execution time: 114_410 nanoseconds. + Weight::from_parts(73_773_023, 13849) + // Standard Error: 45_390 + .saturating_add(Weight::from_ref_time(28_296_310).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(5196).saturating_mul(a.into())) } - // Storage: Swaps Pools (r:1 w:1) - // Storage: Swaps SubsidyProviders (r:1 w:1) - // Storage: Tokens Accounts (r:1 w:1) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Swaps SubsidyProviders (r:1 w:1) + /// Proof: Swaps SubsidyProviders (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:1 w:1) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) fn pool_exit_subsidy() -> Weight { - Weight::from_ref_time(91_570_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `2459` + // Estimated: `11279` + // Minimum execution time: 52_490 nanoseconds. + Weight::from_parts(58_830_000, 11279) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens Accounts (r:3 w:3) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: System Account (r:1 w:0) - // Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:3 w:3) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Proof: Swaps PoolsCachedForArbitrage (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) fn pool_exit_with_exact_asset_amount() -> Weight { - Weight::from_ref_time(169_980_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `5392` + // Estimated: `19045` + // Minimum execution time: 116_131 nanoseconds. + Weight::from_parts(126_540_000, 19045) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: Tokens Accounts (r:3 w:3) - // Storage: System Account (r:1 w:0) - // Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:3 w:3) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Proof: Swaps PoolsCachedForArbitrage (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) fn pool_exit_with_exact_pool_amount() -> Weight { - Weight::from_ref_time(174_961_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `5392` + // Estimated: `19045` + // Minimum execution time: 116_551 nanoseconds. + Weight::from_parts(134_311_000, 19045) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: Tokens Accounts (r:5 w:5) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:131 w:131) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) fn pool_join(a: u32) -> Weight { - Weight::from_ref_time(96_537_174) - // Standard Error: 40_529 - .saturating_add(Weight::from_ref_time(29_127_766).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(3)) + // Proof Size summary in bytes: + // Measured: `876 + a * (286 ±0)` + // Estimated: `11242 + a * (5196 ±0)` + // Minimum execution time: 101_861 nanoseconds. + Weight::from_parts(50_814_580, 11242) + // Standard Error: 46_613 + .saturating_add(Weight::from_ref_time(27_738_187).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(5196).saturating_mul(a.into())) } - // Storage: Swaps Pools (r:1 w:1) - // Storage: Tokens Accounts (r:1 w:1) - // Storage: Swaps SubsidyProviders (r:1 w:1) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:1 w:1) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Swaps SubsidyProviders (r:1 w:1) + /// Proof: Swaps SubsidyProviders (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) fn pool_join_subsidy() -> Weight { - Weight::from_ref_time(91_760_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) + // Proof Size summary in bytes: + // Measured: `2357` + // Estimated: `11279` + // Minimum execution time: 53_831 nanoseconds. + Weight::from_parts(63_290_000, 11279) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: Tokens Accounts (r:3 w:3) - // Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:3 w:3) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Proof: Swaps PoolsCachedForArbitrage (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) fn pool_join_with_exact_asset_amount() -> Weight { - Weight::from_ref_time(150_461_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `5947` + // Estimated: `16438` + // Minimum execution time: 98_100 nanoseconds. + Weight::from_parts(113_330_000, 16438) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Storage: Tokens Accounts (r:3 w:3) - // Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:1 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:3 w:3) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Proof: Swaps PoolsCachedForArbitrage (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) fn pool_join_with_exact_pool_amount() -> Weight { - Weight::from_ref_time(147_880_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `5947` + // Estimated: `16438` + // Minimum execution time: 98_630 nanoseconds. + Weight::from_parts(115_411_000, 16438) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } - // Storage: Swaps Pools (r:1 w:1) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn clean_up_pool_categorical_without_reward_distribution(a: u32) -> Weight { - Weight::from_ref_time(16_641_703) - // Standard Error: 1_679 - .saturating_add(Weight::from_ref_time(368_408).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `209 + a * (54 ±0)` + // Estimated: `6126` + // Minimum execution time: 10_720 nanoseconds. + Weight::from_parts(13_209_615, 6126) + // Standard Error: 1_229 + .saturating_add(Weight::from_ref_time(184_880).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens Accounts (r:4 w:4) - // Storage: System Account (r:1 w:0) - // Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:4 w:4) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Proof: Swaps PoolsCachedForArbitrage (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) fn swap_exact_amount_in_cpmm() -> Weight { - Weight::from_ref_time(207_910_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `5488` + // Estimated: `22141` + // Minimum execution time: 182_820 nanoseconds. + Weight::from_parts(211_551_000, 22141) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens Accounts (r:3 w:3) - // Storage: Tokens TotalIssuance (r:2 w:1) - // Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:1) - // Storage: System Account (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:3 w:3) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:64 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:1) + /// Proof: RikiddoSigmoidFeeMarketEma RikiddoPerPool (max_values: None, max_size: Some(320), added: 2795, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) fn swap_exact_amount_in_rikiddo(a: u32) -> Weight { - Weight::from_ref_time(190_252_841) - // Standard Error: 38_908 - .saturating_add(Weight::from_ref_time(20_835_232).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `2122 + a * (83 ±0)` + // Estimated: `27877 + a * (2352 ±1)` + // Minimum execution time: 209_100 nanoseconds. + Weight::from_parts(195_980_412, 27877) + // Standard Error: 42_421 + .saturating_add(Weight::from_ref_time(20_478_002).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(Weight::from_proof_size(2352).saturating_mul(a.into())) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens Accounts (r:4 w:4) - // Storage: System Account (r:1 w:0) - // Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:4 w:4) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:0) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Swaps PoolsCachedForArbitrage (r:0 w:1) + /// Proof: Swaps PoolsCachedForArbitrage (max_values: None, max_size: Some(24), added: 2499, mode: MaxEncodedLen) fn swap_exact_amount_out_cpmm() -> Weight { - Weight::from_ref_time(204_910_000) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) + // Proof Size summary in bytes: + // Measured: `5488` + // Estimated: `22141` + // Minimum execution time: 178_201 nanoseconds. + Weight::from_parts(193_360_000, 22141) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } - // Storage: Swaps Pools (r:1 w:0) - // Storage: Tokens Accounts (r:4 w:3) - // Storage: Tokens TotalIssuance (r:2 w:1) - // Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:1) - // Storage: Timestamp Now (r:1 w:0) + /// Storage: Swaps Pools (r:1 w:0) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:4 w:3) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: MarketCommons Markets (r:1 w:0) + /// Proof: MarketCommons Markets (max_values: None, max_size: Some(541), added: 3016, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:64 w:1) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) + /// Storage: RikiddoSigmoidFeeMarketEma RikiddoPerPool (r:1 w:1) + /// Proof: RikiddoSigmoidFeeMarketEma RikiddoPerPool (max_values: None, max_size: Some(320), added: 2795, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) fn swap_exact_amount_out_rikiddo(a: u32) -> Weight { - Weight::from_ref_time(110_866_769) - // Standard Error: 54_257 - .saturating_add(Weight::from_ref_time(38_223_978).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(6)) + // Proof Size summary in bytes: + // Measured: `2036 + a * (85 ±0)` + // Estimated: `27868 + a * (2352 ±1)` + // Minimum execution time: 189_841 nanoseconds. + Weight::from_parts(121_280_871, 27868) + // Standard Error: 54_849 + .saturating_add(Weight::from_ref_time(34_361_170).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(Weight::from_proof_size(2352).saturating_mul(a.into())) } - // Storage: Swaps Pools (r:1 w:1) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn open_pool(a: u32) -> Weight { - Weight::from_ref_time(35_543_746) - // Standard Error: 2_971 - .saturating_add(Weight::from_ref_time(491_124).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `209 + a * (54 ±0)` + // Estimated: `6126` + // Minimum execution time: 17_720 nanoseconds. + Weight::from_parts(20_732_644, 6126) + // Standard Error: 1_873 + .saturating_add(Weight::from_ref_time(327_920).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Swaps Pools (r:1 w:1) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) fn close_pool(a: u32) -> Weight { - Weight::from_ref_time(33_666_168) - // Standard Error: 2_412 - .saturating_add(Weight::from_ref_time(361_520).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) + // Proof Size summary in bytes: + // Measured: `209 + a * (54 ±0)` + // Estimated: `6126` + // Minimum execution time: 15_450 nanoseconds. + Weight::from_parts(18_229_163, 6126) + // Standard Error: 1_382 + .saturating_add(Weight::from_ref_time(199_257).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: Swaps Pools (r:1 w:1) - // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Account (r:1 w:1) - // Storage: Tokens TotalIssuance (r:2 w:2) + /// Storage: Swaps Pools (r:1 w:1) + /// Proof: Swaps Pools (max_values: None, max_size: Some(3651), added: 6126, mode: MaxEncodedLen) + /// Storage: Tokens Accounts (r:65 w:65) + /// Proof: Tokens Accounts (max_values: None, max_size: Some(123), added: 2598, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(132), added: 2607, mode: MaxEncodedLen) + /// Storage: Tokens TotalIssuance (r:65 w:65) + /// Proof: Tokens TotalIssuance (max_values: None, max_size: Some(43), added: 2518, mode: MaxEncodedLen) fn destroy_pool(a: u32) -> Weight { - Weight::from_ref_time(29_518_435) - // Standard Error: 43_921 - .saturating_add(Weight::from_ref_time(28_774_467).saturating_mul(a.into())) - .saturating_add(T::DbWeight::get().reads(2)) + // Proof Size summary in bytes: + // Measured: `576 + a * (215 ±0)` + // Estimated: `8733 + a * (5116 ±0)` + // Minimum execution time: 81_340 nanoseconds. + Weight::from_parts(55_981_959, 8733) + // Standard Error: 43_436 + .saturating_add(Weight::from_ref_time(26_829_739).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(a.into()))) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(a.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_proof_size(5116).saturating_mul(a.into())) } }