Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
bench: add peregrine DID benchmarks
  • Loading branch information
ntn-x2 committed Aug 5, 2021
commit 5dd3fbec6b857c10b2910775203a20a76aec6184
3 changes: 1 addition & 2 deletions pallets/delegation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sp-keystore = {branch = "polkadot-v0.9.8", default-features = false, git = "http
[dependencies]
# Internal dependencies
ctype = {default-features = false, path = "../ctype", version = "0.24.0"}
kilt-primitives = {default-features = false, optional = true, path = "../../primitives"}
kilt-primitives = {default-features = false, path = "../../primitives"}

#External dependencies
bitflags = {default-features = false, version = "1.2.1"}
Expand All @@ -42,7 +42,6 @@ sp-std = {branch = "polkadot-v0.9.8", default-features = false, git = "https://g
[features]
default = ["std"]
mock = [
"kilt-primitives",
"serde",
"sp-core",
"sp-io",
Expand Down
3 changes: 2 additions & 1 deletion pallets/did/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ serde = {version = "1.0.101"}
[dependencies]
# Internal dependencies
ctype = {features = ["mock"], optional = true, path = "../ctype", version = "0.24.0"}
kilt-primitives = {default-features = false, path = "../../primitives"}
kilt-primitives = {default-features = false, optional = true, path = "../../primitives"}

# External dependencies
codec = {default-features = false, features = ["derive"], package = "parity-scale-codec", version = "2.0.0"}
Expand All @@ -47,6 +47,7 @@ mock = [
]
runtime-benchmarks = [
"frame-benchmarking",
"kilt-primitives",
]
std = [
"codec/std",
Expand Down
2 changes: 1 addition & 1 deletion runtimes/peregrine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ impl did::Config for Runtime {
type MaxVerificationKeysToRevoke = MaxVerificationKeysToRevoke;
type MaxUrlLength = MaxUrlLength;
type MaxEndpointUrlsCount = MaxUrlsEndpointCounts;
type WeightInfo = ();
type WeightInfo = weights::did::WeightInfo<Runtime>;
}

/// Minimum round length is 1 hour (600 * 6 second block times)
Expand Down
248 changes: 130 additions & 118 deletions runtimes/peregrine/src/weights/did.rs
Original file line number Diff line number Diff line change
@@ -1,128 +1,140 @@
// // KILT Blockchain – https://botlabs.org
// // Copyright (C) 2019-2021 BOTLabs GmbH
// KILT Blockchain – https://botlabs.org
// Copyright (C) 2019-2021 BOTLabs GmbH

// // The KILT Blockchain 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.
// The KILT Blockchain 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.

// // The KILT Blockchain 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.
// The KILT Blockchain 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 this program. If not, see <https://www.gnu.org/licenses/>.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// // If you feel like getting in touch with us, you can do so at [email protected]
// If you feel like getting in touch with us, you can do so at [email protected]

// //! Autogenerated weights for did
// //!
// //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
// //! DATE: 2021-08-04, STEPS: `[1, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
// //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
//! Autogenerated weights for did
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-08-05, STEPS: `[1, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128

// // Executed Command:
// // target/release/kilt-parachain
// // benchmark
// // --chain=dev
// // --execution=wasm
// // --wasm-execution=Compiled
// // --heap-pages=4096
// // --extrinsic=*
// // --pallet=did
// // --steps=1
// // --repeat=20
// // --output
// // runtimes/peregrine/src/weights/did.rs
// // --template
// // .maintain/runtime-weight-template.hbs
// Executed Command:
// target/release/kilt-parachain
// benchmark
// --chain=dev
// --execution=wasm
// --wasm-execution=Compiled
// --heap-pages=4096
// --extrinsic=*
// --pallet=did
// --steps=1
// --repeat=20
// --output
// runtimes/peregrine/src/weights/did.rs
// --template
// .maintain/runtime-weight-template.hbs


// #![cfg_attr(rustfmt, rustfmt_skip)]
// #![allow(unused_parens)]
// #![allow(unused_imports)]
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

// use frame_support::{traits::Get, weights::Weight};
// use sp_std::marker::PhantomData;
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

// /// Weights for did using the recommended hardware.
// pub struct WeightInfo<T>(PhantomData<T>);
// impl<T: frame_system::Config> did::WeightInfo for WeightInfo<T> {
// fn create_ed25519_keys(n: u32, u: u32, ) -> Weight {
// (125_979_000_u64)
// // Standard Error: 84_000
// .saturating_add((2_372_000_u64).saturating_mul(n as Weight))
// // Standard Error: 3_000
// .saturating_add((8_000_u64).saturating_mul(u as Weight))
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn create_sr25519_keys(n: u32, u: u32, ) -> Weight {
// (124_731_000_u64)
// // Standard Error: 57_000
// .saturating_add((2_682_000_u64).saturating_mul(n as Weight))
// // Standard Error: 2_000
// .saturating_add((13_000_u64).saturating_mul(u as Weight))
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn create_ecdsa_keys(n: u32, u: u32, ) -> Weight {
// (262_279_000_u64)
// // Standard Error: 209_000
// .saturating_add((1_404_000_u64).saturating_mul(n as Weight))
// // Standard Error: 9_000
// .saturating_add((2_000_u64).saturating_mul(u as Weight))
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn update_ed25519_keys(n: u32, m: u32, _u: u32, ) -> Weight {
// (39_215_000_u64)
// // Standard Error: 46_000
// .saturating_add((4_467_000_u64).saturating_mul(n as Weight))
// // Standard Error: 46_000
// .saturating_add((2_842_000_u64).saturating_mul(m as Weight))
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn update_sr25519_keys(n: u32, m: u32, u: u32, ) -> Weight {
// (32_203_000_u64)
// // Standard Error: 145_000
// .saturating_add((4_900_000_u64).saturating_mul(n as Weight))
// // Standard Error: 145_000
// .saturating_add((3_101_000_u64).saturating_mul(m as Weight))
// // Standard Error: 6_000
// .saturating_add((18_000_u64).saturating_mul(u as Weight))
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn update_ecdsa_keys(n: u32, m: u32, _u: u32, ) -> Weight {
// (48_996_000_u64)
// // Standard Error: 128_000
// .saturating_add((4_504_000_u64).saturating_mul(n as Weight))
// // Standard Error: 128_000
// .saturating_add((2_235_000_u64).saturating_mul(m as Weight))
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn delete() -> Weight {
// (32_491_000_u64)
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn submit_did_call_ed25519_key() -> Weight {
// (112_430_000_u64)
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn submit_did_call_sr25519_key() -> Weight {
// (114_584_000_u64)
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// fn submit_did_call_ecdsa_key() -> Weight {
// (234_789_000_u64)
// .saturating_add(T::DbWeight::get().reads(1_u64))
// .saturating_add(T::DbWeight::get().writes(1_u64))
// }
// }
/// Weights for did using the recommended hardware.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> did::WeightInfo for WeightInfo<T> {
fn create_ed25519_keys(n: u32, u: u32, c: u32, ) -> Weight {
(119_310_000_u64)
// Standard Error: 23_000
.saturating_add((2_712_000_u64).saturating_mul(n as Weight))
// Standard Error: 1_000
.saturating_add((22_000_u64).saturating_mul(u as Weight))
// Standard Error: 104_000
.saturating_add((2_170_000_u64).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn create_sr25519_keys(n: u32, u: u32, _c: u32, ) -> Weight {
(135_322_000_u64)
// Standard Error: 96_000
.saturating_add((2_885_000_u64).saturating_mul(n as Weight))
// Standard Error: 4_000
.saturating_add((26_000_u64).saturating_mul(u as Weight))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn create_ecdsa_keys(n: u32, u: u32, c: u32, ) -> Weight {
(252_507_000_u64)
// Standard Error: 111_000
.saturating_add((2_516_000_u64).saturating_mul(n as Weight))
// Standard Error: 5_000
.saturating_add((4_000_u64).saturating_mul(u as Weight))
// Standard Error: 502_000
.saturating_add((1_663_000_u64).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn update_ed25519_keys(n: u32, m: u32, u: u32, c: u32, ) -> Weight {
(46_422_000_u64)
// Standard Error: 52_000
.saturating_add((4_590_000_u64).saturating_mul(n as Weight))
// Standard Error: 52_000
.saturating_add((2_147_000_u64).saturating_mul(m as Weight))
// Standard Error: 2_000
.saturating_add((2_000_u64).saturating_mul(u as Weight))
// Standard Error: 237_000
.saturating_add((1_038_000_u64).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn update_sr25519_keys(n: u32, m: u32, u: u32, c: u32, ) -> Weight {
(43_904_000_u64)
// Standard Error: 47_000
.saturating_add((4_510_000_u64).saturating_mul(n as Weight))
// Standard Error: 47_000
.saturating_add((2_511_000_u64).saturating_mul(m as Weight))
// Standard Error: 2_000
.saturating_add((2_000_u64).saturating_mul(u as Weight))
// Standard Error: 213_000
.saturating_add((893_000_u64).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn update_ecdsa_keys(n: u32, m: u32, u: u32, _c: u32, ) -> Weight {
(47_917_000_u64)
// Standard Error: 79_000
.saturating_add((4_531_000_u64).saturating_mul(n as Weight))
// Standard Error: 79_000
.saturating_add((2_648_000_u64).saturating_mul(m as Weight))
// Standard Error: 3_000
.saturating_add((6_000_u64).saturating_mul(u as Weight))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn delete() -> Weight {
(33_142_000_u64)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn submit_did_call_ed25519_key() -> Weight {
(113_963_000_u64)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn submit_did_call_sr25519_key() -> Weight {
(117_320_000_u64)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn submit_did_call_ecdsa_key() -> Weight {
(241_051_000_u64)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
2 changes: 1 addition & 1 deletion runtimes/peregrine/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
pub mod attestation;
pub mod ctype;
pub mod delegation;
// pub mod did;
pub mod did;
pub mod frame_system;
pub mod kilt_launch;
pub mod pallet_balances;
Expand Down