Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add weights to claims (#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi authored Apr 27, 2020
1 parent c6e7bc0 commit 9ea8a85
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,13 @@ decl_module! {
/// - One deposit event.
///
/// Total Complexity: O(1)
/// ----------------------------
/// Base Weight: 622.6 µs
/// DB Weight:
/// - Read: Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account
/// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting
/// </weight>
#[weight = 1_000_000_000]
#[weight = T::DbWeight::get().reads_writes(6, 6) + 650_000_000]
fn claim(origin, dest: T::AccountId, ethereum_signature: EcdsaSignature) {
ensure_none(origin)?;

Expand Down Expand Up @@ -229,8 +234,13 @@ decl_module! {
/// - Up to one storage write to add a new vesting schedule.
///
/// Total Complexity: O(1)
/// ---------------------
/// Base Weight: 25.64 µs
/// DB Weight:
/// - Reads: Total
/// - Writes: Total, Claims, Vesting
/// </weight>
#[weight = 30_000_000]
#[weight = T::DbWeight::get().reads_writes(1, 3) + 25_000_000]
fn mint_claim(origin,
who: EthereumAddress,
value: BalanceOf<T>,
Expand Down Expand Up @@ -292,6 +302,10 @@ impl<T: Trait> sp_runtime::traits::ValidateUnsigned for Module<T> {
const PRIORITY: u64 = 100;

match call {
// <weight>
// Base Weight: 370 µs
// DB Weight: 1 Read (Claims)
// </weight>
Call::claim(account, ethereum_signature) => {
let data = account.using_encoded(to_ascii_hex);
let maybe_signer = Self::eth_recover(&ethereum_signature, &data);
Expand Down

0 comments on commit 9ea8a85

Please sign in to comment.