Add weights to claims (#1036)

This commit is contained in:
Shawn Tabrizi
2020-04-27 18:56:22 +02:00
committed by GitHub
parent 59f5743852
commit fb5421b1d6
+16 -2
View File
@@ -182,8 +182,13 @@ decl_module! {
/// - One deposit event. /// - One deposit event.
/// ///
/// Total Complexity: O(1) /// 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>
#[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) { fn claim(origin, dest: T::AccountId, ethereum_signature: EcdsaSignature) {
ensure_none(origin)?; ensure_none(origin)?;
@@ -229,8 +234,13 @@ decl_module! {
/// - Up to one storage write to add a new vesting schedule. /// - Up to one storage write to add a new vesting schedule.
/// ///
/// Total Complexity: O(1) /// Total Complexity: O(1)
/// ---------------------
/// Base Weight: 25.64 µs
/// DB Weight:
/// - Reads: Total
/// - Writes: Total, Claims, Vesting
/// </weight> /// </weight>
#[weight = 30_000_000] #[weight = T::DbWeight::get().reads_writes(1, 3) + 25_000_000]
fn mint_claim(origin, fn mint_claim(origin,
who: EthereumAddress, who: EthereumAddress,
value: BalanceOf<T>, value: BalanceOf<T>,
@@ -292,6 +302,10 @@ impl<T: Trait> sp_runtime::traits::ValidateUnsigned for Module<T> {
const PRIORITY: u64 = 100; const PRIORITY: u64 = 100;
match call { match call {
// <weight>
// Base Weight: 370 µs
// DB Weight: 1 Read (Claims)
// </weight>
Call::claim(account, ethereum_signature) => { Call::claim(account, ethereum_signature) => {
let data = account.using_encoded(to_ascii_hex); let data = account.using_encoded(to_ascii_hex);
let maybe_signer = Self::eth_recover(&ethereum_signature, &data); let maybe_signer = Self::eth_recover(&ethereum_signature, &data);