Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce pallet utility and re-run benchmark #75

Merged
merged 5 commits into from
Oct 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ A substrate-based node that maintains a registry of remote attested integritee-s
## Build and Run
Please see our [Integritee Book](https://book.integritee.network/howto_node.html) to learn how to build and run this.

## benchmarking of weights

```
cargo build --release --features=runtime-benchmarks
./scripts/benchmark_all_pallets.sh
```
3 changes: 3 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "http
pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }

sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-block-builder = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }
Expand Down Expand Up @@ -96,6 +97,7 @@ std = [
"sp-version/std",
"pallet-teerex/std",
"pallet-proxy/std",
"pallet-utility/std",
]
runtime-benchmarks = [
"frame-benchmarking",
Expand All @@ -113,5 +115,6 @@ runtime-benchmarks = [
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
]
mainnet-launch = []
12 changes: 11 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,12 @@ impl pallet_scheduler::Config for Runtime {
type WeightInfo = weights::pallet_scheduler::WeightInfo<Runtime>;
}

impl pallet_utility::Config for Runtime {
type Event = Event;
type Call = Call;
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
Expand All @@ -549,6 +555,7 @@ construct_runtime!(
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 6,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 7,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 8,
Utility: pallet_utility::{Pallet, Call, Event} = 9,

// funds and fees
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
Expand All @@ -563,7 +570,8 @@ construct_runtime!(
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 30,

// utility
Teerex: pallet_teerex::{Pallet, Call, Config, Storage, Event<T>} = 50, }
Teerex: pallet_teerex::{Pallet, Call, Config, Storage, Event<T>} = 50,
}
);

/// The address format for describing accounts.
Expand Down Expand Up @@ -745,6 +753,7 @@ impl_runtime_apis! {
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
list_benchmark!(list, extra, pallet_treasury, Treasury);
list_benchmark!(list, extra, pallet_vesting, Vesting);
list_benchmark!(list, extra, pallet_utility, Utility);

let storage_info = AllPalletsWithSystem::storage_info();

Expand Down Expand Up @@ -786,6 +795,7 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
add_benchmark!(params, batches, pallet_treasury, Treasury);
add_benchmark!(params, batches, pallet_vesting, Vesting);
add_benchmark!(params, batches, pallet_utility, Utility);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok(batches)
Expand Down
27 changes: 14 additions & 13 deletions runtime/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

//! 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: `[]`
//! DATE: 2021-10-14, 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
// target/release/integritee-node
// benchmark
// --chain=integritee-solo-fresh
// --steps=50
Expand All @@ -15,7 +16,7 @@
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./runtime/src/weights/frame_system.rs
// --output=runtime/src/weights/frame_system.rs


#![cfg_attr(rustfmt, rustfmt_skip)]
Expand All @@ -34,41 +35,41 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
}
fn remark_with_event(b: u32, ) -> Weight {
(0 as Weight)
(2_653_000 as Weight)
brenzi marked this conversation as resolved.
Show resolved Hide resolved
// 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)
(1_567_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)
(6_236_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))
// Standard Error: 0
.saturating_add((838_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))
// Standard Error: 0
.saturating_add((556_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))
(3_140_000 as Weight)
// Standard Error: 0
.saturating_add((756_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
}
}
5 changes: 3 additions & 2 deletions runtime/src/weights/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! The weights used in the runtime
//!
//! The current weights have been obtained with the following reference hardware:
//! * Core(TM) i7-10875H
//! * Intel(R) Xeon(R) E-2276G CPU @ 3.80 GHz
//! * 32GB of RAM
//! * NVMe SSD
//! * 1TB SSD Samsung 860 EVO Basic, 2.5"

// the generated files to not pass clippy
#![allow(clippy::all)]
Expand All @@ -21,4 +21,5 @@ pub mod pallet_scheduler;
pub mod pallet_teerex;
pub mod pallet_timestamp;
pub mod pallet_treasury;
pub mod pallet_utility;
pub mod pallet_vesting;
18 changes: 9 additions & 9 deletions runtime/src/weights/pallet_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//! 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: `[]`
//! DATE: 2021-10-14, 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
// target/release/integritee-node
// benchmark
// --chain=integritee-solo-fresh
// --steps=50
Expand All @@ -16,7 +16,7 @@
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./runtime/src/weights/pallet_balances.rs
// --output=runtime/src/weights/pallet_balances.rs


#![cfg_attr(rustfmt, rustfmt_skip)]
Expand All @@ -31,37 +31,37 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(72_600_000 as Weight)
(68_344_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)
(50_479_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)
(27_005_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)
(33_450_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)
(68_560_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)
(62_591_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
Expand Down
Loading