Skip to content

Commit

Permalink
passkeys: calculate weights (#2077)
Browse files Browse the repository at this point in the history
# Goal
The goal of this PR is to calculate accurate weights for passkey pallet

Related to #2032

# Checklist
- [x] Weights updated

---------

Co-authored-by: aramikm <aramikm@users.noreply.github.com>
  • Loading branch information
aramikm and aramikm authored Jul 16, 2024
1 parent 7d58412 commit b242c20
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion pallets/passkey/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn generate_payload<T: Config>() -> PasskeyPayload<T> {
let test_account_1_pk = SignerId::generate_pair(None);
let test_account_1_account_id =
T::AccountId::decode(&mut &test_account_1_pk.encode()[..]).unwrap();
T::Currency::set_balance(&test_account_1_account_id.clone().into(), 2000000000u32.into());
T::Currency::set_balance(&test_account_1_account_id.clone().into(), 4_000_000_000u32.into());
let secret = p256::SecretKey::from_slice(&[
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
])
Expand Down
50 changes: 29 additions & 21 deletions pallets/passkey/src/weights.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

//! Autogenerated weights for `pallet_passkey`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-07-08, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-07-15, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-99-10-9.us-east-2.compute.internal`, CPU: `<UNKNOWN>`
//! HOSTNAME: `ip-10-173-4-155`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("frequency-bench")`, DB CACHE: `1024`
// Executed Command:
Expand Down Expand Up @@ -42,59 +42,67 @@ pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `System::AllExtrinsicsLen` (r:1 w:0)
/// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0)
/// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
fn validate() -> Weight {
// Proof Size summary in bytes:
// Measured: `178`
// Measured: `235`
// Estimated: `5078`
// Minimum execution time: 1_002_000_000 picoseconds.
Weight::from_parts(1_011_000_000, 5078)
.saturating_add(T::DbWeight::get().reads(2_u64))
// Minimum execution time: 1_728_647_000 picoseconds.
Weight::from_parts(1_741_351_000, 5078)
.saturating_add(T::DbWeight::get().reads(3_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(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `System::AllExtrinsicsLen` (r:1 w:1)
/// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0)
/// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
fn pre_dispatch() -> Weight {
// Proof Size summary in bytes:
// Measured: `178`
// Measured: `131`
// Estimated: `5078`
// Minimum execution time: 1_001_000_000 picoseconds.
Weight::from_parts(1_015_000_000, 5078)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
// Minimum execution time: 1_745_366_000 picoseconds.
Weight::from_parts(1_756_751_000, 5078)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
}

// For backwards compatibility and tests.
impl WeightInfo for () {
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `System::AllExtrinsicsLen` (r:1 w:0)
/// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0)
/// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
fn validate() -> Weight {
// Proof Size summary in bytes:
// Measured: `178`
// Measured: `235`
// Estimated: `5078`
// Minimum execution time: 1_002_000_000 picoseconds.
Weight::from_parts(1_011_000_000, 5078)
.saturating_add(RocksDbWeight::get().reads(2_u64))
// Minimum execution time: 1_728_647_000 picoseconds.
Weight::from_parts(1_741_351_000, 5078)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `System::AllExtrinsicsLen` (r:1 w:1)
/// Proof: `System::AllExtrinsicsLen` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0)
/// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
fn pre_dispatch() -> Weight {
// Proof Size summary in bytes:
// Measured: `178`
// Measured: `131`
// Estimated: `5078`
// Minimum execution time: 1_001_000_000 picoseconds.
Weight::from_parts(1_015_000_000, 5078)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
// Minimum execution time: 1_745_366_000 picoseconds.
Weight::from_parts(1_756_751_000, 5078)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
}

Expand Down

0 comments on commit b242c20

Please sign in to comment.