diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e73be47..38a7f23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,7 +165,8 @@ jobs: os: [ubuntu-latest] rust: [stable] rust-target: [x86_64-unknown-linux-gnu] - check: [fmt, clippy] +# check: [fmt --all -- --check, clippy -- -D warnings] + check: [fmt --all -- --check] # skip clippy for now env: RUST_BACKTRACE: full RUSTV: ${{ matrix.rust }} @@ -178,20 +179,12 @@ jobs: - name: Setup Rust toolchain run: rustup show - - name: Install llvm-10 - run: sudo apt-get install llvm-10 clang-10 - - uses: Swatinem/rust-cache@v1 with: key: ${{ matrix.rust-target }}-${{ matrix.check }} - - name: Fmt - if: ${{ matrix.check == 'fmt' }} - run: cargo fmt --all -- --check - - # - name: Clippy - # if: ${{ matrix.check == 'clippy' }} - # run: cargo clippy -- -D warnings + - name: ${{ matrix.check }} + run: cargo ${{ matrix.check }} build-runtimes: name: Build Runtimes diff --git a/Cargo.lock b/Cargo.lock index fb48753..6c14619 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3876,6 +3876,7 @@ name = "pallet-proxy" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate.git?branch=master#b391b82954ad95a927a921035e3017c4a0aad516" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", @@ -3953,6 +3954,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "hex-literal", "ias-verify", "log", "pallet-balances", @@ -4047,6 +4049,7 @@ name = "pallet-vesting" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate.git?branch=master#b391b82954ad95a927a921035e3017c4a0aad516" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "log", diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 2b18878..8fbb2ed 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -101,11 +101,16 @@ runtime-benchmarks = [ "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system-benchmarking", - "frame-system/runtime-benchmarks", "hex-literal", + "sp-runtime/runtime-benchmarks", + # actual pallets to be benchmarked + "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-teerex/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", ] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 09918b2..5cf25c7 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -60,6 +60,8 @@ use pallet_transaction_payment::CurrencyAdapter; pub use sp_runtime::BuildStorage; pub use sp_runtime::{Perbill, Permill}; +mod weights; + /// An index to a block. pub type BlockNumber = u32; @@ -258,7 +260,7 @@ impl frame_system::Config for Runtime { /// The data to be stored in an account. type AccountData = pallet_balances::AccountData; /// Weight information for the extrinsics of this pallet. - type SystemWeightInfo = (); + type SystemWeightInfo = weights::frame_system::WeightInfo; /// This is used as an identifier of the chain. 42 is the generic substrate prefix. type SS58Prefix = SS58Prefix; /// The set code logic, just the default since we're not a parachain. @@ -305,7 +307,7 @@ impl pallet_timestamp::Config for Runtime { type Moment = Moment; type OnTimestampSet = (Aura, Teerex); type MinimumPeriod = MinimumPeriod; - type WeightInfo = (); + type WeightInfo = weights::pallet_timestamp::WeightInfo; } parameter_types! { @@ -325,7 +327,7 @@ impl pallet_balances::Config for Runtime { type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; - type WeightInfo = pallet_balances::weights::SubstrateWeight; + type WeightInfo = weights::pallet_balances::WeightInfo; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; @@ -354,8 +356,7 @@ impl pallet_teerex::Config for Runtime { type Currency = pallet_balances::Pallet; type MomentsPerDay = MomentsPerDay; type MaxSilenceTime = MaxSilenceTime; - // currently we have only benchmarks there for the integritee-parachain - type WeightInfo = pallet_teerex::weights::IntegriteeWeight; + type WeightInfo = weights::pallet_teerex::WeightInfo; } parameter_types! { @@ -383,7 +384,7 @@ impl pallet_treasury::Config for Runtime { type BurnDestination = (); //No burn type SpendFunds = (); //No spend, no bounty type MaxApprovals = MaxApprovals; //0:cannot approve any proposal - type WeightInfo = (); + type WeightInfo = weights::pallet_treasury::WeightInfo; } parameter_types! { @@ -401,7 +402,7 @@ impl pallet_multisig::Config for Runtime { type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; - type WeightInfo = (); + type WeightInfo = weights::pallet_multisig::WeightInfo; } parameter_types! { @@ -478,7 +479,7 @@ impl pallet_proxy::Config for Runtime { type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; type MaxProxies = MaxProxies; - type WeightInfo = (); + type WeightInfo = weights::pallet_proxy::WeightInfo; type MaxPending = MaxPending; type CallHasher = BlakeTwo256; type AnnouncementDepositBase = AnnouncementDepositBase; @@ -494,7 +495,7 @@ impl pallet_vesting::Config for Runtime { type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; - type WeightInfo = (); + type WeightInfo = weights::pallet_vesting::WeightInfo; const MAX_VESTING_SCHEDULES: u32 = 28; } @@ -512,7 +513,7 @@ impl pallet_scheduler::Config for Runtime { type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = (); + type WeightInfo = weights::pallet_scheduler::WeightInfo; } // Create the runtime by composing the FRAME pallets that were previously configured. @@ -719,9 +720,14 @@ impl_runtime_apis! { list_benchmark!(list, extra, frame_system, SystemBench::); list_benchmark!(list, extra, pallet_balances, Balances); + list_benchmark!(list, extra, pallet_multisig, Multisig); + list_benchmark!(list, extra, pallet_proxy, Proxy); + list_benchmark!(list, extra, pallet_scheduler, Scheduler); + list_benchmark!(list, extra, pallet_teerex, Teerex); list_benchmark!(list, extra, pallet_timestamp, Timestamp); list_benchmark!(list, extra, pallet_treasury, Treasury); - list_benchmark!(list, extra, pallet_multisig, Multisig); + list_benchmark!(list, extra, pallet_vesting, Vesting); + let storage_info = AllPalletsWithSystem::storage_info(); return (list, storage_info) @@ -755,9 +761,13 @@ impl_runtime_apis! { add_benchmark!(params, batches, frame_system, SystemBench::); add_benchmark!(params, batches, pallet_balances, Balances); + add_benchmark!(params, batches, pallet_multisig, Multisig); + add_benchmark!(params, batches, pallet_proxy, Proxy); + add_benchmark!(params, batches, pallet_scheduler, Scheduler); + add_benchmark!(params, batches, pallet_teerex, Teerex); add_benchmark!(params, batches, pallet_timestamp, Timestamp); add_benchmark!(params, batches, pallet_treasury, Treasury); - add_benchmark!(params, batches, pallet_multisig, Multisig); + add_benchmark!(params, batches, pallet_vesting, Vesting); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) diff --git a/runtime/src/weights/frame_system.rs b/runtime/src/weights/frame_system.rs new file mode 100644 index 0000000..d70a3b3 --- /dev/null +++ b/runtime/src/weights/frame_system.rs @@ -0,0 +1,74 @@ +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=frame_system +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/frame_system.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for frame_system. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + fn remark(b: u32, ) -> Weight { + (574_000 as Weight) + // Standard Error: 0 + .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + } + fn remark_with_event(b: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + } + // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + fn set_heap_pages() -> Weight { + (1_800_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a6368616e6765735f74726965] (r:0 w:1) + fn set_changes_trie_config() -> Weight { + (8_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + fn set_storage(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 2_000 + .saturating_add((887_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn kill_storage(i: u32, ) -> Weight { + (2_052_000 as Weight) + // Standard Error: 1_000 + .saturating_add((567_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn kill_prefix(p: u32, ) -> Weight { + (3_640_000 as Weight) + // Standard Error: 2_000 + .saturating_add((799_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } +} diff --git a/runtime/src/weights/mod.rs b/runtime/src/weights/mod.rs new file mode 100644 index 0000000..f6fe957 --- /dev/null +++ b/runtime/src/weights/mod.rs @@ -0,0 +1,24 @@ +//! The weights used in the runtime +//! +//! The current weights have been obtained with the following reference hardware: +//! * Core(TM) i7-10875H +//! * 32GB of RAM +//! * NVMe SSD + +// the generated files to not pass clippy +#![allow(clippy::all)] + +// note: Always double check the frame_system generated weights. Sometimes some values are 0, but +// return ridiculously high weights in another run. When re-running the benchmarks always perform +// sanity checks with substrate's weight for this module. The close to 0 values seem to be correct. +// +// Problematic functions are: `remark`, `remark_with_event`. +pub mod frame_system; +pub mod pallet_balances; +pub mod pallet_multisig; +pub mod pallet_proxy; +pub mod pallet_scheduler; +pub mod pallet_teerex; +pub mod pallet_timestamp; +pub mod pallet_treasury; +pub mod pallet_vesting; diff --git a/runtime/src/weights/pallet_balances.rs b/runtime/src/weights/pallet_balances.rs new file mode 100644 index 0000000..867746f --- /dev/null +++ b/runtime/src/weights/pallet_balances.rs @@ -0,0 +1,68 @@ + +//! Autogenerated weights for `pallet_balances` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=pallet_balances +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/pallet_balances.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_balances. +pub struct WeightInfo(PhantomData); +impl pallet_balances::WeightInfo for WeightInfo { + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + (72_600_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + (53_200_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_creating() -> Weight { + (27_600_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_killing() -> Weight { + (33_600_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: System Account (r:2 w:2) + fn force_transfer() -> Weight { + (69_800_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: System Account (r:1 w:1) + fn transfer_all() -> Weight { + (64_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} diff --git a/runtime/src/weights/pallet_multisig.rs b/runtime/src/weights/pallet_multisig.rs new file mode 100644 index 0000000..f719466 --- /dev/null +++ b/runtime/src/weights/pallet_multisig.rs @@ -0,0 +1,126 @@ + +//! Autogenerated weights for `pallet_multisig` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=pallet_multisig +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/pallet_multisig.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_multisig. +pub struct WeightInfo(PhantomData); +impl pallet_multisig::WeightInfo for WeightInfo { + fn as_multi_threshold_1(z: u32, ) -> Weight { + (6_330_000 as Weight) + // Standard Error: 0 + .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + fn as_multi_create(s: u32, z: u32, ) -> Weight { + (51_321_000 as Weight) + // Standard Error: 73_000 + .saturating_add((281_000 as Weight).saturating_mul(s as Weight)) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: Multisig Calls (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + fn as_multi_create_store(s: u32, z: u32, ) -> Weight { + (57_103_000 as Weight) + // Standard Error: 115_000 + .saturating_add((796_000 as Weight).saturating_mul(s as Weight)) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + fn as_multi_approve(_s: u32, z: u32, ) -> Weight { + (31_382_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: Multisig Calls (r:1 w:1) + fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { + (50_606_000 as Weight) + // Standard Error: 87_000 + .saturating_add((412_000 as Weight).saturating_mul(s as Weight)) + // Standard Error: 0 + .saturating_add((4_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: Multisig Calls (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn as_multi_complete(_s: u32, z: u32, ) -> Weight { + (76_985_000 as Weight) + // Standard Error: 0 + .saturating_add((5_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + fn approve_as_multi_create(s: u32, ) -> Weight { + (45_893_000 as Weight) + // Standard Error: 46_000 + .saturating_add((447_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: Multisig Calls (r:1 w:0) + fn approve_as_multi_approve(s: u32, ) -> Weight { + (28_533_000 as Weight) + // Standard Error: 22_000 + .saturating_add((158_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: Multisig Calls (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn approve_as_multi_complete(s: u32, ) -> Weight { + (114_475_000 as Weight) + // Standard Error: 132_000 + .saturating_add((1_011_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: Multisig Calls (r:1 w:1) + fn cancel_as_multi(s: u32, ) -> Weight { + (84_035_000 as Weight) + // Standard Error: 64_000 + .saturating_add((494_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/runtime/src/weights/pallet_proxy.rs b/runtime/src/weights/pallet_proxy.rs new file mode 100644 index 0000000..bc086f9 --- /dev/null +++ b/runtime/src/weights/pallet_proxy.rs @@ -0,0 +1,124 @@ + +//! Autogenerated weights for `pallet_proxy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=pallet_proxy +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/pallet_proxy.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_proxy. +pub struct WeightInfo(PhantomData); +impl pallet_proxy::WeightInfo for WeightInfo { + // Storage: Proxy Proxies (r:1 w:0) + fn proxy(p: u32, ) -> Weight { + (20_799_000 as Weight) + // Standard Error: 6_000 + .saturating_add((189_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + } + // 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 { + (55_316_000 as Weight) + // Standard Error: 8_000 + .saturating_add((450_000 as Weight).saturating_mul(a as Weight)) + // Standard Error: 9_000 + .saturating_add((106_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn remove_announcement(a: u32, p: u32, ) -> Weight { + (34_254_000 as Weight) + // Standard Error: 43_000 + .saturating_add((563_000 as Weight).saturating_mul(a as Weight)) + // Standard Error: 45_000 + .saturating_add((194_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn reject_announcement(a: u32, _p: u32, ) -> Weight { + (37_598_000 as Weight) + // Standard Error: 8_000 + .saturating_add((523_000 as Weight).saturating_mul(a as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn announce(a: u32, p: u32, ) -> Weight { + (50_571_000 as Weight) + // Standard Error: 35_000 + .saturating_add((717_000 as Weight).saturating_mul(a as Weight)) + // Standard Error: 36_000 + .saturating_add((15_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Proxy Proxies (r:1 w:1) + fn add_proxy(p: u32, ) -> Weight { + (40_812_000 as Weight) + // Standard Error: 6_000 + .saturating_add((264_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Proxy Proxies (r:1 w:1) + fn remove_proxy(p: u32, ) -> Weight { + (30_914_000 as Weight) + // Standard Error: 6_000 + .saturating_add((300_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Proxy Proxies (r:1 w:1) + fn remove_proxies(p: u32, ) -> Weight { + (30_033_000 as Weight) + // Standard Error: 6_000 + .saturating_add((224_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + // Storage: Proxy Proxies (r:1 w:1) + fn anonymous(p: u32, ) -> Weight { + (42_555_000 as Weight) + // Standard Error: 15_000 + .saturating_add((182_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Proxy Proxies (r:1 w:1) + fn kill_anonymous(p: u32, ) -> Weight { + (36_447_000 as Weight) + // Standard Error: 12_000 + .saturating_add((150_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} diff --git a/runtime/src/weights/pallet_scheduler.rs b/runtime/src/weights/pallet_scheduler.rs new file mode 100644 index 0000000..318f99c --- /dev/null +++ b/runtime/src/weights/pallet_scheduler.rs @@ -0,0 +1,67 @@ + +//! Autogenerated weights for `pallet_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=pallet_scheduler +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/pallet_scheduler.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_scheduler. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + // Storage: Scheduler Agenda (r:1 w:1) + fn schedule(s: u32, ) -> Weight { + (25_942_000 as Weight) + // Standard Error: 11_000 + .saturating_add((84_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + fn cancel(s: u32, ) -> Weight { + (21_862_000 as Weight) + // Standard Error: 4_000 + .saturating_add((843_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn schedule_named(s: u32, ) -> Weight { + (28_447_000 as Weight) + // Standard Error: 12_000 + .saturating_add((199_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn cancel_named(s: u32, ) -> Weight { + (24_121_000 as Weight) + // Standard Error: 6_000 + .saturating_add((869_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/runtime/src/weights/pallet_teerex.rs b/runtime/src/weights/pallet_teerex.rs new file mode 100644 index 0000000..6e9346c --- /dev/null +++ b/runtime/src/weights/pallet_teerex.rs @@ -0,0 +1,68 @@ + +//! Autogenerated weights for `pallet_teerex` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=pallet_teerex +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/pallet_teerex.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_teerex. +pub struct WeightInfo(PhantomData); +impl pallet_teerex::WeightInfo for WeightInfo { + // Storage: Timestamp Now (r:1 w:0) + // Storage: Teerex AllowSGXDebugMode (r:1 w:0) + // Storage: Teerex EnclaveIndex (r:1 w:0) + // Storage: Teerex EnclaveRegistry (r:0 w:1) + fn register_enclave() -> Weight { + (1_882_600_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Teerex EnclaveIndex (r:1 w:2) + // Storage: Teerex EnclaveCount (r:1 w:1) + // Storage: Teerex EnclaveRegistry (r:1 w:2) + fn unregister_enclave() -> Weight { + (40_900_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + } + fn call_worker() -> Weight { + (57_000_000 as Weight) + } + // Storage: Teerex EnclaveIndex (r:1 w:0) + // Storage: Teerex WorkerForShard (r:0 w:1) + // Storage: Teerex LatestIpfsHash (r:0 w:1) + fn confirm_call() -> Weight { + (39_200_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Teerex EnclaveIndex (r:1 w:0) + // Storage: Teerex WorkerForShard (r:0 w:1) + // Storage: Teerex LatestIpfsHash (r:0 w:1) + fn confirm_block() -> Weight { + (35_500_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/runtime/src/weights/pallet_timestamp.rs b/runtime/src/weights/pallet_timestamp.rs new file mode 100644 index 0000000..1fc9faa --- /dev/null +++ b/runtime/src/weights/pallet_timestamp.rs @@ -0,0 +1,43 @@ + +//! Autogenerated weights for `pallet_timestamp` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=pallet_timestamp +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/pallet_timestamp.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_timestamp. +pub struct WeightInfo(PhantomData); +impl pallet_timestamp::WeightInfo for WeightInfo { + // Storage: Timestamp Now (r:1 w:1) + // Storage: Aura CurrentSlot (r:1 w:0) + // Storage: Teerex EnclaveRegistry (r:1 w:0) + fn set() -> Weight { + (13_900_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn on_finalize() -> Weight { + (4_400_000 as Weight) + } +} diff --git a/runtime/src/weights/pallet_treasury.rs b/runtime/src/weights/pallet_treasury.rs new file mode 100644 index 0000000..d7b58ff --- /dev/null +++ b/runtime/src/weights/pallet_treasury.rs @@ -0,0 +1,67 @@ + +//! Autogenerated weights for `pallet_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=pallet_treasury +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/pallet_treasury.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_treasury. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + // Storage: Treasury ProposalCount (r:1 w:1) + // Storage: Treasury Proposals (r:0 w:1) + fn propose_spend() -> Weight { + (38_700_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn reject_proposal() -> Weight { + (35_400_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Treasury Proposals (r:1 w:0) + // Storage: Treasury Approvals (r:1 w:1) + fn approve_proposal(p: u32, ) -> Weight { + (10_678_000 as Weight) + // Standard Error: 13_000 + .saturating_add((228_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Treasury Approvals (r:1 w:1) + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn on_initialize_proposals(p: u32, ) -> Weight { + (41_279_000 as Weight) + // Standard Error: 406_000 + .saturating_add((55_173_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) + } +} diff --git a/runtime/src/weights/pallet_vesting.rs b/runtime/src/weights/pallet_vesting.rs new file mode 100644 index 0000000..493b15f --- /dev/null +++ b/runtime/src/weights/pallet_vesting.rs @@ -0,0 +1,122 @@ + +//! Autogenerated weights for `pallet_vesting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128 + +// Executed Command: +// ./target/release/integritee-node +// benchmark +// --chain=integritee-solo-fresh +// --steps=50 +// --repeat=20 +// --pallet=pallet_vesting +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtime/src/weights/pallet_vesting.rs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_vesting. +pub struct WeightInfo(PhantomData); +impl pallet_vesting::WeightInfo for WeightInfo { + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vest_locked(l: u32, s: u32, ) -> Weight { + (46_716_000 as Weight) + // Standard Error: 11_000 + .saturating_add((135_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 22_000 + .saturating_add((322_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vest_unlocked(l: u32, s: u32, ) -> Weight { + (49_665_000 as Weight) + // Standard Error: 4_000 + .saturating_add((124_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 9_000 + .saturating_add((54_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // 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 { + (43_259_000 as Weight) + // Standard Error: 29_000 + .saturating_add((475_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 59_000 + .saturating_add((772_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // 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 { + (57_368_000 as Weight) + // Standard Error: 24_000 + .saturating_add((342_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 48_000 + .saturating_add((261_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vested_transfer(l: u32, s: u32, ) -> Weight { + (102_167_000 as Weight) + // Standard Error: 35_000 + .saturating_add((85_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 72_000 + .saturating_add((454_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // 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 { + (128_327_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + (68_031_000 as Weight) + // Standard Error: 25_000 + .saturating_add((226_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 54_000 + .saturating_add((378_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + (68_829_000 as Weight) + // Standard Error: 22_000 + .saturating_add((189_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 47_000 + .saturating_add((257_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } +} diff --git a/scripts/benchmark_all_pallets.sh b/scripts/benchmark_all_pallets.sh new file mode 100755 index 0000000..61c73f2 --- /dev/null +++ b/scripts/benchmark_all_pallets.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Create `WeightInfo` implementations for all the pallets and store it in the weight module of the `runtime`. + +RUNTIME_WEIGHT_DIR=runtime/src/weights +NODE=./target/release/integritee-node + +mkdir -p $RUNTIME_WEIGHT_DIR + +pallets=( + "frame_system" \ + "pallet_balances" \ + "pallet_multisig" \ + "pallet_proxy" \ + "pallet_scheduler" \ + "pallet_timestamp" \ + "pallet_teerex" \ + "pallet_treasury" \ + "pallet_vesting" \ +) + +for pallet in ${pallets[*]}; do + echo benchmarking "$pallet"... + + $NODE \ + benchmark \ + --chain=integritee-solo-fresh \ + --steps=50 \ + --repeat=20 \ + --pallet="$pallet" \ + --extrinsic="*" \ + --execution=wasm \ + --wasm-execution=compiled \ + --heap-pages=4096 \ + --output=./$RUNTIME_WEIGHT_DIR/"$pallet".rs \ + +done