mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Migrate Claims Pallet to WeightInfo (#2171)
* migrate claims to weightinfo * fix up * fix benchmark * cargo run --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=claims --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/ * fix test runtime * cargo run --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=claims --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/ * Update runtime/kusama/src/weights/claims.rs * use path for pallet * Update Cargo.lock * cargo run --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/ * Delete runtime_common::claims.rs * cargo run --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 * cargo run --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 * use full automation file * patch import * consolidate benchmark logic * fix * cargo run --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 --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 * update weight comments Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
This commit is contained in:
@@ -20,7 +20,9 @@ use sp_std::{prelude::*, fmt::Debug};
|
||||
use sp_io::{hashing::keccak_256, crypto::secp256k1_ecdsa_recover};
|
||||
use frame_support::{
|
||||
decl_event, decl_storage, decl_module, decl_error, ensure,
|
||||
traits::{Currency, Get, VestingSchedule, EnsureOrigin, IsSubType}, weights::{Pays, DispatchClass}
|
||||
traits::{Currency, Get, VestingSchedule, EnsureOrigin, IsSubType},
|
||||
weights::{Weight, Pays, DispatchClass},
|
||||
pallet_prelude::DispatchResultWithPostInfo,
|
||||
};
|
||||
use frame_system::{ensure_signed, ensure_root, ensure_none};
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
@@ -47,6 +49,24 @@ pub trait Config: frame_system::Config {
|
||||
type VestingSchedule: VestingSchedule<Self::AccountId, Moment=Self::BlockNumber>;
|
||||
type Prefix: Get<&'static [u8]>;
|
||||
type MoveClaimOrigin: EnsureOrigin<Self::Origin>;
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn claim() -> Weight;
|
||||
fn mint_claim() -> Weight;
|
||||
fn claim_attest() -> Weight;
|
||||
fn attest() -> Weight;
|
||||
fn move_claim() -> Weight;
|
||||
}
|
||||
|
||||
pub struct TestWeightInfo;
|
||||
impl WeightInfo for TestWeightInfo {
|
||||
fn claim() -> Weight { 0 }
|
||||
fn mint_claim() -> Weight { 0 }
|
||||
fn claim_attest() -> Weight { 0 }
|
||||
fn attest() -> Weight { 0 }
|
||||
fn move_claim() -> Weight { 0 }
|
||||
}
|
||||
|
||||
/// The kind of a statement an account needs to make for a claim to be valid.
|
||||
@@ -223,25 +243,11 @@ decl_module! {
|
||||
///
|
||||
/// <weight>
|
||||
/// The weight of this call is invariant over the input parameters.
|
||||
/// - One `eth_recover` operation which involves a keccak hash and a
|
||||
/// ecdsa recover.
|
||||
/// - Three storage reads to check if a claim exists for the user, to
|
||||
/// get the current pot size, to see if there exists a vesting schedule.
|
||||
/// - Up to one storage write for adding a new vesting schedule.
|
||||
/// - One `deposit_creating` Currency call.
|
||||
/// - One storage write to update the total.
|
||||
/// - Two storage removals for vesting and claims information.
|
||||
/// - One deposit event.
|
||||
/// Weight includes logic to validate unsigned `claim` call.
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// ----------------------------
|
||||
/// Base Weight: 269.7 µs
|
||||
/// DB Weight:
|
||||
/// - Read: Signing, Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account
|
||||
/// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting, Signing
|
||||
/// Validate Unsigned: +188.7 µs
|
||||
/// </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(7, 7) + 270_000_000 + 190_000_000]
|
||||
#[weight = T::WeightInfo::claim()]
|
||||
fn claim(origin, dest: T::AccountId, ethereum_signature: EcdsaSignature) {
|
||||
ensure_none(origin)?;
|
||||
|
||||
@@ -264,24 +270,11 @@ decl_module! {
|
||||
///
|
||||
/// <weight>
|
||||
/// The weight of this call is invariant over the input parameters.
|
||||
/// - One storage mutate to increase the total claims available.
|
||||
/// - One storage write to add a new claim.
|
||||
/// - Up to one storage write to add a new vesting schedule.
|
||||
/// We assume worst case that both vesting and statement is being inserted.
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// ---------------------
|
||||
/// Base Weight: 10.46 µs
|
||||
/// DB Weight:
|
||||
/// - Reads: Total
|
||||
/// - Writes: Total, Claims
|
||||
/// - Maybe Write: Vesting, Statement
|
||||
/// </weight>
|
||||
#[weight =
|
||||
T::DbWeight::get().reads_writes(1, 2)
|
||||
+ T::DbWeight::get().writes(vesting_schedule.is_some().into())
|
||||
+ T::DbWeight::get().writes(statement.is_some().into())
|
||||
+ 10_000_000
|
||||
]
|
||||
#[weight = T::WeightInfo::mint_claim()]
|
||||
fn mint_claim(origin,
|
||||
who: EthereumAddress,
|
||||
value: BalanceOf<T>,
|
||||
@@ -322,26 +315,11 @@ decl_module! {
|
||||
///
|
||||
/// <weight>
|
||||
/// The weight of this call is invariant over the input parameters.
|
||||
/// - One `eth_recover` operation which involves a keccak hash and a
|
||||
/// ecdsa recover.
|
||||
/// - Four storage reads to check if a claim exists for the user, to
|
||||
/// get the current pot size, to see if there exists a vesting schedule, to get the
|
||||
/// required statement.
|
||||
/// - Up to one storage write for adding a new vesting schedule.
|
||||
/// - One `deposit_creating` Currency call.
|
||||
/// - One storage write to update the total.
|
||||
/// - Two storage removals for vesting and claims information.
|
||||
/// - One deposit event.
|
||||
/// Weight includes logic to validate unsigned `claim_attest` call.
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// ----------------------------
|
||||
/// Base Weight: 270.2 µs
|
||||
/// DB Weight:
|
||||
/// - Read: Signing, Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account
|
||||
/// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting, Signing
|
||||
/// Validate Unsigned: +190.1 µs
|
||||
/// </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(7, 7) + 270_000_000 + 190_000_000]
|
||||
#[weight = T::WeightInfo::claim_attest()]
|
||||
fn claim_attest(origin,
|
||||
dest: T::AccountId,
|
||||
ethereum_signature: EcdsaSignature,
|
||||
@@ -370,16 +348,13 @@ decl_module! {
|
||||
/// - `statement`: The identity of the statement which is being attested to in the signature.
|
||||
///
|
||||
/// <weight>
|
||||
/// The weight of this call is invariant over the input parameters.
|
||||
/// Weight includes logic to do pre-validation on `attest` call.
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// ----------------------------
|
||||
/// Base Weight: 93.3 µs
|
||||
/// DB Weight:
|
||||
/// - Read: Preclaims, Signing, Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account
|
||||
/// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting, Signing, Preclaims
|
||||
/// Validate PreValidateAttests: +8.631 µs
|
||||
/// </weight>
|
||||
#[weight = (
|
||||
T::DbWeight::get().reads_writes(8, 8) + 90_000_000 + 10_000_000,
|
||||
T::WeightInfo::attest(),
|
||||
DispatchClass::Normal,
|
||||
Pays::No
|
||||
)]
|
||||
@@ -393,16 +368,12 @@ decl_module! {
|
||||
Preclaims::<T>::remove(&who);
|
||||
}
|
||||
|
||||
#[weight = (
|
||||
T::DbWeight::get().reads_writes(4, 4) + 100_000_000_000,
|
||||
DispatchClass::Normal,
|
||||
Pays::No
|
||||
)]
|
||||
#[weight = T::WeightInfo::move_claim()]
|
||||
fn move_claim(origin,
|
||||
old: EthereumAddress,
|
||||
new: EthereumAddress,
|
||||
maybe_preclaim: Option<T::AccountId>,
|
||||
) {
|
||||
) -> DispatchResultWithPostInfo {
|
||||
T::MoveClaimOrigin::try_origin(origin).map(|_| ()).or_else(ensure_root)?;
|
||||
|
||||
Claims::<T>::take(&old).map(|c| Claims::<T>::insert(&new, c));
|
||||
@@ -411,6 +382,7 @@ decl_module! {
|
||||
maybe_preclaim.map(|preclaim| Preclaims::<T>::mutate(&preclaim, |maybe_o|
|
||||
if maybe_o.as_ref().map_or(false, |o| o == &old) { *maybe_o = Some(new) }
|
||||
));
|
||||
Ok(Pays::No.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -495,16 +467,14 @@ impl<T: Config> sp_runtime::traits::ValidateUnsigned for Module<T> {
|
||||
|
||||
let (maybe_signer, maybe_statement) = match call {
|
||||
// <weight>
|
||||
// Base Weight: 188.7 µs (includes the full logic of `validate_unsigned`)
|
||||
// DB Weight: 2 Read (Claims, Signing)
|
||||
// The weight of this logic is included in the `claim` dispatchable.
|
||||
// </weight>
|
||||
Call::claim(account, ethereum_signature) => {
|
||||
let data = account.using_encoded(to_ascii_hex);
|
||||
(Self::eth_recover(ðereum_signature, &data, &[][..]), None)
|
||||
}
|
||||
// <weight>
|
||||
// Base Weight: 190.1 µs (includes the full logic of `validate_unsigned`)
|
||||
// DB Weight: 2 Read (Claims, Signing)
|
||||
// The weight of this logic is included in the `claim_attest` dispatchable.
|
||||
// </weight>
|
||||
Call::claim_attest(account, ethereum_signature, statement) => {
|
||||
let data = account.using_encoded(to_ascii_hex);
|
||||
@@ -578,8 +548,7 @@ impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T> where
|
||||
}
|
||||
|
||||
// <weight>
|
||||
// Base Weight: 8.631 µs
|
||||
// DB Weight: 2 Read (Preclaims, Signing)
|
||||
// The weight of this logic is included in the `attest` dispatchable.
|
||||
// </weight>
|
||||
fn validate(
|
||||
&self,
|
||||
@@ -724,6 +693,7 @@ mod tests {
|
||||
type VestingSchedule = Vesting;
|
||||
type Prefix = Prefix;
|
||||
type MoveClaimOrigin = frame_system::EnsureSignedBy<Six, u64>;
|
||||
type WeightInfo = TestWeightInfo;
|
||||
}
|
||||
type System = frame_system::Module<Test>;
|
||||
type Balances = pallet_balances::Module<Test>;
|
||||
@@ -1197,33 +1167,44 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
benchmarks! {
|
||||
_ {
|
||||
// Create claims in storage. Two are created at a time!
|
||||
let c in 0 .. MAX_CLAIMS / 2 => {
|
||||
_ { }
|
||||
|
||||
// Benchmark `claim` including `validate_unsigned` logic.
|
||||
claim {
|
||||
let c = MAX_CLAIMS;
|
||||
|
||||
for i in 0 .. c / 2 {
|
||||
create_claim::<T>(c)?;
|
||||
create_claim_attest::<T>(u32::max_value() - c)?;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Benchmark `claim` for different users.
|
||||
claim {
|
||||
let u in 0 .. 1000;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&u.encode())).unwrap();
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let account: T::AccountId = account("user", u, SEED);
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
let signature = sig::<T>(&secret_key, &account.encode(), &[][..]);
|
||||
super::Module::<T>::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, None)?;
|
||||
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
||||
}: _(RawOrigin::None, account, signature)
|
||||
let source = sp_runtime::transaction_validity::TransactionSource::External;
|
||||
let call = Call::<T>::claim(account.clone(), signature.clone());
|
||||
}: {
|
||||
super::Module::<T>::validate_unsigned(source, &call)?;
|
||||
super::Module::<T>::claim(RawOrigin::None.into(), account, signature)?;
|
||||
}
|
||||
verify {
|
||||
assert_eq!(Claims::<T>::get(eth_address), None);
|
||||
}
|
||||
|
||||
// Benchmark `mint_claim` when there already exists `c` claims in storage.
|
||||
mint_claim {
|
||||
let c in ...;
|
||||
let eth_address = account("eth_address", c, SEED);
|
||||
let c = MAX_CLAIMS;
|
||||
|
||||
for i in 0 .. c / 2 {
|
||||
create_claim::<T>(c)?;
|
||||
create_claim_attest::<T>(u32::max_value() - c)?;
|
||||
}
|
||||
|
||||
let eth_address = account("eth_address", 0, SEED);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
let statement = StatementKind::Regular;
|
||||
}: _(RawOrigin::Root, eth_address, VALUE.into(), vesting, Some(statement))
|
||||
@@ -1231,75 +1212,55 @@ mod benchmarking {
|
||||
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
||||
}
|
||||
|
||||
// Benchmark `claim_attest` for different users.
|
||||
// Benchmark `claim_attest` including `validate_unsigned` logic.
|
||||
claim_attest {
|
||||
let u in 0 .. 1000;
|
||||
let attest_u = u32::max_value() - u;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_u.encode())).unwrap();
|
||||
let c = MAX_CLAIMS;
|
||||
|
||||
for i in 0 .. c / 2 {
|
||||
create_claim::<T>(c)?;
|
||||
create_claim_attest::<T>(u32::max_value() - c)?;
|
||||
}
|
||||
|
||||
// Crate signature
|
||||
let attest_c = u32::max_value() - c;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let account: T::AccountId = account("user", u, SEED);
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
let statement = StatementKind::Regular;
|
||||
let signature = sig::<T>(&secret_key, &account.encode(), statement.to_text());
|
||||
super::Module::<T>::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, Some(statement))?;
|
||||
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
||||
}: _(RawOrigin::None, account, signature, statement.to_text().to_vec())
|
||||
let call = Call::<T>::claim_attest(account.clone(), signature.clone(), StatementKind::Regular.to_text().to_vec());
|
||||
let source = sp_runtime::transaction_validity::TransactionSource::External;
|
||||
}: {
|
||||
super::Module::<T>::validate_unsigned(source, &call)?;
|
||||
super::Module::<T>::claim_attest(RawOrigin::None.into(), account, signature, statement.to_text().to_vec())?;
|
||||
}
|
||||
verify {
|
||||
assert_eq!(Claims::<T>::get(eth_address), None);
|
||||
}
|
||||
|
||||
// Benchmark `attest` for different users.
|
||||
// Benchmark `attest` including prevalidate logic.
|
||||
attest {
|
||||
let u in 0 .. 1000;
|
||||
let attest_u = u32::max_value() - u;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_u.encode())).unwrap();
|
||||
let c = MAX_CLAIMS;
|
||||
|
||||
for i in 0 .. c / 2 {
|
||||
create_claim::<T>(c)?;
|
||||
create_claim_attest::<T>(u32::max_value() - c)?;
|
||||
}
|
||||
|
||||
let attest_c = u32::max_value() - c;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let account: T::AccountId = account("user", u, SEED);
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
let statement = StatementKind::Regular;
|
||||
let signature = sig::<T>(&secret_key, &account.encode(), statement.to_text());
|
||||
super::Module::<T>::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, Some(statement))?;
|
||||
Preclaims::<T>::insert(&account, eth_address);
|
||||
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));
|
||||
}: _(RawOrigin::Signed(account), statement.to_text().to_vec())
|
||||
verify {
|
||||
assert_eq!(Claims::<T>::get(eth_address), None);
|
||||
}
|
||||
|
||||
// Benchmark the time it takes to execute `validate_unsigned` for `claim`
|
||||
validate_unsigned_claim {
|
||||
let c in ...;
|
||||
// Crate signature
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&c.encode())).unwrap();
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
let signature = sig::<T>(&secret_key, &account.encode(), &[][..]);
|
||||
let call = Call::<T>::claim(account, signature);
|
||||
let source = sp_runtime::transaction_validity::TransactionSource::External;
|
||||
}: {
|
||||
super::Module::<T>::validate_unsigned(source, &call)?
|
||||
}
|
||||
|
||||
// Benchmark the time it takes to execute `validate_unsigned` for `claim_attest`
|
||||
validate_unsigned_claim_attest {
|
||||
let c in ...;
|
||||
// Crate signature
|
||||
let attest_c = u32::max_value() - c;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
let signature = sig::<T>(&secret_key, &account.encode(), StatementKind::Regular.to_text());
|
||||
let call = Call::<T>::claim_attest(account, signature, StatementKind::Regular.to_text().to_vec());
|
||||
let source = sp_runtime::transaction_validity::TransactionSource::External;
|
||||
}: {
|
||||
super::Module::<T>::validate_unsigned(source, &call)?
|
||||
}
|
||||
|
||||
validate_prevalidate_attests {
|
||||
let c in ...;
|
||||
let attest_c = u32::max_value() - c;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
Preclaims::<T>::insert(&account, eth_address);
|
||||
let call = super::Call::attest(StatementKind::Regular.to_text().to_vec());
|
||||
// We have to copy the validate statement here because of trait issues... :(
|
||||
let validate = |who: &T::AccountId, call: &super::Call<T>| -> DispatchResult {
|
||||
@@ -1312,10 +1273,41 @@ mod benchmarking {
|
||||
Ok(())
|
||||
};
|
||||
}: {
|
||||
validate(&account, &call)?
|
||||
validate(&account, &call)?;
|
||||
super::Module::<T>::attest(RawOrigin::Signed(account).into(), statement.to_text().to_vec())?;
|
||||
}
|
||||
verify {
|
||||
assert_eq!(Claims::<T>::get(eth_address), None);
|
||||
}
|
||||
|
||||
move_claim {
|
||||
let c = MAX_CLAIMS;
|
||||
|
||||
for i in 0 .. c / 2 {
|
||||
create_claim::<T>(c)?;
|
||||
create_claim_attest::<T>(u32::max_value() - c)?;
|
||||
}
|
||||
|
||||
let attest_c = u32::max_value() - c;
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
|
||||
let new_secret_key = secp256k1::SecretKey::parse(&keccak_256(&(u32::max_value()/2).encode())).unwrap();
|
||||
let new_eth_address = eth(&new_secret_key);
|
||||
|
||||
let account: T::AccountId = account("user", c, SEED);
|
||||
Preclaims::<T>::insert(&account, eth_address);
|
||||
|
||||
assert!(Claims::<T>::contains_key(eth_address));
|
||||
assert!(!Claims::<T>::contains_key(new_eth_address));
|
||||
}: _(RawOrigin::Root, eth_address, new_eth_address, Some(account))
|
||||
verify {
|
||||
assert!(!Claims::<T>::contains_key(eth_address));
|
||||
assert!(Claims::<T>::contains_key(new_eth_address));
|
||||
}
|
||||
|
||||
// Benchmark the time it takes to do `repeat` number of keccak256 hashes
|
||||
#[extra]
|
||||
keccak256 {
|
||||
let i in 0 .. 10_000;
|
||||
let bytes = (i).encode();
|
||||
@@ -1326,6 +1318,7 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
// Benchmark the time it takes to do `repeat` number of `eth_recover`
|
||||
#[extra]
|
||||
eth_recover {
|
||||
let i in 0 .. 1_000;
|
||||
// Crate signature
|
||||
@@ -1354,9 +1347,7 @@ mod benchmarking {
|
||||
assert_ok!(test_benchmark_mint_claim::<Test>());
|
||||
assert_ok!(test_benchmark_claim_attest::<Test>());
|
||||
assert_ok!(test_benchmark_attest::<Test>());
|
||||
assert_ok!(test_benchmark_validate_unsigned_claim::<Test>());
|
||||
assert_ok!(test_benchmark_validate_unsigned_claim_attest::<Test>());
|
||||
assert_ok!(test_benchmark_validate_prevalidate_attests::<Test>());
|
||||
assert_ok!(test_benchmark_move_claim::<Test>());
|
||||
assert_ok!(test_benchmark_keccak256::<Test>());
|
||||
assert_ok!(test_benchmark_eth_recover::<Test>());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user