From b5cee7d587c688639541215f70832d0f4ff77549 Mon Sep 17 00:00:00 2001 From: Trubnikov Sergey Date: Mon, 12 Sep 2022 14:49:42 +0000 Subject: [PATCH] fix: refactor weght calculation. --- --- a/pallets/common/src/erc.rs +++ b/pallets/common/src/erc.rs @@ -20,6 +20,7 @@ solidity_interface, solidity, ToLog, types::*, execution::{Result, Error}, + weight, }; pub use pallet_evm::{PrecompileOutput, PrecompileResult, PrecompileHandle, account::CrossAccountId}; use pallet_evm_coder_substrate::dispatch_to_evm; @@ -31,11 +32,12 @@ use alloc::format; use crate::{ - Pallet, CollectionHandle, Config, CollectionProperties, + Pallet, CollectionHandle, Config, CollectionProperties, SelfWeightOf, eth::{ convert_cross_account_to_uint256, convert_uint256_to_cross_account, convert_cross_account_to_tuple, }, + weights::WeightInfo, }; /// Events for ethereum collection helper. @@ -72,14 +74,13 @@ /// /// @param key Property key. /// @param value Propery value. + #[weight(>::set_collection_properties(1_u32))] fn set_collection_property( &mut self, caller: caller, key: string, value: bytes, ) -> Result { - self.consume_store_reads_and_writes(1, 1)?; - let caller = T::CrossAccountId::from_eth(caller); let key = >::from(key) .try_into() @@ -93,6 +94,7 @@ /// Delete collection property. /// /// @param key Property key. + #[weight(>::delete_collection_properties(1_u32))] fn delete_collection_property(&mut self, caller: caller, key: string) -> Result<()> { self.consume_store_reads_and_writes(1, 1)?; -- gitstuff