mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Add call-decoding weight to benchmarks (#3866)
* Add add call-decoding weight to benchmarks fixes #3864 * Change order as suggested by @thiolliere * More reordering as @KiChjang suggested * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_common::claims --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_common_claims.rs * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=runtime_common::claims --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/runtime_common_claims.rs Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
committed by
GitHub
parent
57125623ed
commit
4b9fc6460e
@@ -1388,6 +1388,7 @@ mod benchmarking {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::claims::Call;
|
use crate::claims::Call;
|
||||||
use frame_benchmarking::{account, benchmarks};
|
use frame_benchmarking::{account, benchmarks};
|
||||||
|
use frame_support::dispatch::UnfilteredDispatchable;
|
||||||
use frame_system::RawOrigin;
|
use frame_system::RawOrigin;
|
||||||
use secp_utils::*;
|
use secp_utils::*;
|
||||||
use sp_runtime::{traits::ValidateUnsigned, DispatchResult};
|
use sp_runtime::{traits::ValidateUnsigned, DispatchResult};
|
||||||
@@ -1443,10 +1444,15 @@ mod benchmarking {
|
|||||||
super::Pallet::<T>::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, None)?;
|
super::Pallet::<T>::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, None)?;
|
||||||
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
||||||
let source = sp_runtime::transaction_validity::TransactionSource::External;
|
let source = sp_runtime::transaction_validity::TransactionSource::External;
|
||||||
let call = Call::<T>::claim { dest: account.clone(), ethereum_signature: signature.clone() };
|
let call_enc = Call::<T>::claim {
|
||||||
|
dest: account.clone(),
|
||||||
|
ethereum_signature: signature.clone()
|
||||||
|
}.encode();
|
||||||
}: {
|
}: {
|
||||||
|
let call = <Call<T> as Decode>::decode(&mut &*call_enc)
|
||||||
|
.expect("call is encoded above, encoding must be correct");
|
||||||
super::Pallet::<T>::validate_unsigned(source, &call).map_err(|e| -> &'static str { e.into() })?;
|
super::Pallet::<T>::validate_unsigned(source, &call).map_err(|e| -> &'static str { e.into() })?;
|
||||||
super::Pallet::<T>::claim(RawOrigin::None.into(), account, signature)?;
|
call.dispatch_bypass_filter(RawOrigin::None.into())?;
|
||||||
}
|
}
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(Claims::<T>::get(eth_address), None);
|
assert_eq!(Claims::<T>::get(eth_address), None);
|
||||||
@@ -1488,11 +1494,17 @@ mod benchmarking {
|
|||||||
let signature = sig::<T>(&secret_key, &account.encode(), statement.to_text());
|
let signature = sig::<T>(&secret_key, &account.encode(), statement.to_text());
|
||||||
super::Pallet::<T>::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, Some(statement))?;
|
super::Pallet::<T>::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, Some(statement))?;
|
||||||
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
||||||
let call = Call::<T>::claim_attest { dest: account.clone(), ethereum_signature: signature.clone(), statement: StatementKind::Regular.to_text().to_vec() };
|
let call_enc = Call::<T>::claim_attest {
|
||||||
|
dest: account.clone(),
|
||||||
|
ethereum_signature: signature.clone(),
|
||||||
|
statement: StatementKind::Regular.to_text().to_vec()
|
||||||
|
}.encode();
|
||||||
let source = sp_runtime::transaction_validity::TransactionSource::External;
|
let source = sp_runtime::transaction_validity::TransactionSource::External;
|
||||||
}: {
|
}: {
|
||||||
|
let call = <Call<T> as Decode>::decode(&mut &*call_enc)
|
||||||
|
.expect("call is encoded above, encoding must be correct");
|
||||||
super::Pallet::<T>::validate_unsigned(source, &call).map_err(|e| -> &'static str { e.into() })?;
|
super::Pallet::<T>::validate_unsigned(source, &call).map_err(|e| -> &'static str { e.into() })?;
|
||||||
super::Pallet::<T>::claim_attest(RawOrigin::None.into(), account, signature, statement.to_text().to_vec())?;
|
call.dispatch_bypass_filter(RawOrigin::None.into())?;
|
||||||
}
|
}
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(Claims::<T>::get(eth_address), None);
|
assert_eq!(Claims::<T>::get(eth_address), None);
|
||||||
@@ -1518,7 +1530,7 @@ mod benchmarking {
|
|||||||
Preclaims::<T>::insert(&account, eth_address);
|
Preclaims::<T>::insert(&account, eth_address);
|
||||||
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
||||||
|
|
||||||
let call = super::Call::attest { statement: StatementKind::Regular.to_text().to_vec() };
|
let call = super::Call::<T>::attest { statement: StatementKind::Regular.to_text().to_vec() };
|
||||||
// We have to copy the validate statement here because of trait issues... :(
|
// We have to copy the validate statement here because of trait issues... :(
|
||||||
let validate = |who: &T::AccountId, call: &super::Call<T>| -> DispatchResult {
|
let validate = |who: &T::AccountId, call: &super::Call<T>| -> DispatchResult {
|
||||||
if let Call::attest{ statement: attested_statement } = call {
|
if let Call::attest{ statement: attested_statement } = call {
|
||||||
@@ -1529,9 +1541,12 @@ mod benchmarking {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
|
let call_enc = call.encode();
|
||||||
}: {
|
}: {
|
||||||
|
let call = <Call<T> as Decode>::decode(&mut &*call_enc)
|
||||||
|
.expect("call is encoded above, encoding must be correct");
|
||||||
validate(&account, &call)?;
|
validate(&account, &call)?;
|
||||||
super::Pallet::<T>::attest(RawOrigin::Signed(account).into(), statement.to_text().to_vec())?;
|
call.dispatch_bypass_filter(RawOrigin::Signed(account).into())?;
|
||||||
}
|
}
|
||||||
verify {
|
verify {
|
||||||
assert_eq!(Claims::<T>::get(eth_address), None);
|
assert_eq!(Claims::<T>::get(eth_address), None);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
|
// Copyright 2017-2021 Parity Technologies (UK) Ltd.
|
||||||
// This file is part of Polkadot.
|
// This file is part of Polkadot.
|
||||||
|
|
||||||
// Polkadot is free software: you can redistribute it and/or modify
|
// Polkadot is free software: you can redistribute it and/or modify
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//! Autogenerated weights for `runtime_common::claims`
|
//! Autogenerated weights for `runtime_common::claims`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
//! DATE: 2021-07-01, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2021-10-06, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -31,8 +31,10 @@
|
|||||||
// --wasm-execution=compiled
|
// --wasm-execution=compiled
|
||||||
// --heap-pages=4096
|
// --heap-pages=4096
|
||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
// --output=./runtime/kusama/src/weights/
|
// --output=./runtime/kusama/src/weights/runtime_common_claims.rs
|
||||||
|
|
||||||
|
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
#![allow(unused_parens)]
|
#![allow(unused_parens)]
|
||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
@@ -42,28 +44,58 @@ use sp_std::marker::PhantomData;
|
|||||||
/// Weight functions for `runtime_common::claims`.
|
/// Weight functions for `runtime_common::claims`.
|
||||||
pub struct WeightInfo<T>(PhantomData<T>);
|
pub struct WeightInfo<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config> runtime_common::claims::WeightInfo for WeightInfo<T> {
|
impl<T: frame_system::Config> runtime_common::claims::WeightInfo for WeightInfo<T> {
|
||||||
|
// Storage: Claims Claims (r:1 w:1)
|
||||||
|
// Storage: Claims Signing (r:1 w:1)
|
||||||
|
// Storage: Claims Total (r:1 w:1)
|
||||||
|
// Storage: Claims Vesting (r:1 w:1)
|
||||||
|
// Storage: Vesting Vesting (r:1 w:1)
|
||||||
|
// Storage: System Account (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
fn claim() -> Weight {
|
fn claim() -> Weight {
|
||||||
(438_457_000 as Weight)
|
(442_992_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||||
}
|
}
|
||||||
|
// Storage: Claims Total (r:1 w:1)
|
||||||
|
// Storage: Claims Vesting (r:0 w:1)
|
||||||
|
// Storage: Claims Claims (r:0 w:1)
|
||||||
|
// Storage: Claims Signing (r:0 w:1)
|
||||||
fn mint_claim() -> Weight {
|
fn mint_claim() -> Weight {
|
||||||
(13_035_000 as Weight)
|
(12_098_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
}
|
}
|
||||||
|
// Storage: Claims Claims (r:1 w:1)
|
||||||
|
// Storage: Claims Signing (r:1 w:1)
|
||||||
|
// Storage: Claims Total (r:1 w:1)
|
||||||
|
// Storage: Claims Vesting (r:1 w:1)
|
||||||
|
// Storage: Vesting Vesting (r:1 w:1)
|
||||||
|
// Storage: System Account (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
fn claim_attest() -> Weight {
|
fn claim_attest() -> Weight {
|
||||||
(439_894_000 as Weight)
|
(442_328_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||||
}
|
}
|
||||||
|
// Storage: Claims Preclaims (r:1 w:1)
|
||||||
|
// Storage: Claims Signing (r:1 w:1)
|
||||||
|
// Storage: Claims Claims (r:1 w:1)
|
||||||
|
// Storage: Claims Total (r:1 w:1)
|
||||||
|
// Storage: Claims Vesting (r:1 w:1)
|
||||||
|
// Storage: Vesting Vesting (r:1 w:1)
|
||||||
|
// Storage: System Account (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
fn attest() -> Weight {
|
fn attest() -> Weight {
|
||||||
(132_760_000 as Weight)
|
(126_506_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
||||||
}
|
}
|
||||||
|
// Storage: Claims Claims (r:1 w:2)
|
||||||
|
// Storage: Claims Vesting (r:1 w:2)
|
||||||
|
// Storage: Claims Signing (r:1 w:2)
|
||||||
|
// Storage: Claims Preclaims (r:1 w:1)
|
||||||
fn move_claim() -> Weight {
|
fn move_claim() -> Weight {
|
||||||
(28_459_000 as Weight)
|
(26_618_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
|
// Copyright 2017-2021 Parity Technologies (UK) Ltd.
|
||||||
// This file is part of Polkadot.
|
// This file is part of Polkadot.
|
||||||
|
|
||||||
// Polkadot is free software: you can redistribute it and/or modify
|
// Polkadot is free software: you can redistribute it and/or modify
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//! Autogenerated weights for `runtime_common::claims`
|
//! Autogenerated weights for `runtime_common::claims`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
//! DATE: 2021-07-01, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2021-10-06, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 128
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 128
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -31,8 +31,10 @@
|
|||||||
// --wasm-execution=compiled
|
// --wasm-execution=compiled
|
||||||
// --heap-pages=4096
|
// --heap-pages=4096
|
||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
// --output=./runtime/polkadot/src/weights/
|
// --output=./runtime/polkadot/src/weights/runtime_common_claims.rs
|
||||||
|
|
||||||
|
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
#![allow(unused_parens)]
|
#![allow(unused_parens)]
|
||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
@@ -42,28 +44,58 @@ use sp_std::marker::PhantomData;
|
|||||||
/// Weight functions for `runtime_common::claims`.
|
/// Weight functions for `runtime_common::claims`.
|
||||||
pub struct WeightInfo<T>(PhantomData<T>);
|
pub struct WeightInfo<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config> runtime_common::claims::WeightInfo for WeightInfo<T> {
|
impl<T: frame_system::Config> runtime_common::claims::WeightInfo for WeightInfo<T> {
|
||||||
|
// Storage: Claims Claims (r:1 w:1)
|
||||||
|
// Storage: Claims Signing (r:1 w:1)
|
||||||
|
// Storage: Claims Total (r:1 w:1)
|
||||||
|
// Storage: Claims Vesting (r:1 w:1)
|
||||||
|
// Storage: Vesting Vesting (r:1 w:1)
|
||||||
|
// Storage: System Account (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
fn claim() -> Weight {
|
fn claim() -> Weight {
|
||||||
(447_705_000 as Weight)
|
(440_159_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||||
}
|
}
|
||||||
|
// Storage: Claims Total (r:1 w:1)
|
||||||
|
// Storage: Claims Vesting (r:0 w:1)
|
||||||
|
// Storage: Claims Claims (r:0 w:1)
|
||||||
|
// Storage: Claims Signing (r:0 w:1)
|
||||||
fn mint_claim() -> Weight {
|
fn mint_claim() -> Weight {
|
||||||
(11_995_000 as Weight)
|
(11_988_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
}
|
}
|
||||||
|
// Storage: Claims Claims (r:1 w:1)
|
||||||
|
// Storage: Claims Signing (r:1 w:1)
|
||||||
|
// Storage: Claims Total (r:1 w:1)
|
||||||
|
// Storage: Claims Vesting (r:1 w:1)
|
||||||
|
// Storage: Vesting Vesting (r:1 w:1)
|
||||||
|
// Storage: System Account (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
fn claim_attest() -> Weight {
|
fn claim_attest() -> Weight {
|
||||||
(439_703_000 as Weight)
|
(443_037_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||||
}
|
}
|
||||||
|
// Storage: Claims Preclaims (r:1 w:1)
|
||||||
|
// Storage: Claims Signing (r:1 w:1)
|
||||||
|
// Storage: Claims Claims (r:1 w:1)
|
||||||
|
// Storage: Claims Total (r:1 w:1)
|
||||||
|
// Storage: Claims Vesting (r:1 w:1)
|
||||||
|
// Storage: Vesting Vesting (r:1 w:1)
|
||||||
|
// Storage: System Account (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
fn attest() -> Weight {
|
fn attest() -> Weight {
|
||||||
(128_588_000 as Weight)
|
(125_350_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
||||||
}
|
}
|
||||||
|
// Storage: Claims Claims (r:1 w:2)
|
||||||
|
// Storage: Claims Vesting (r:1 w:2)
|
||||||
|
// Storage: Claims Signing (r:1 w:2)
|
||||||
|
// Storage: Claims Preclaims (r:1 w:1)
|
||||||
fn move_claim() -> Weight {
|
fn move_claim() -> Weight {
|
||||||
(26_297_000 as Weight)
|
(26_261_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user