From b9585bb8429796b464fc9bbbaaa50fcb229c9d9e Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Wed, 22 Apr 2020 15:50:25 +0200 Subject: [PATCH] enum Pays for PaysFee (#5733) * enum Pays for PaysFee * Fix doc test * Update bin/node/executor/tests/basic.rs * Update bin/node/executor/tests/basic.rs --- src/lib.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 48946858dffb6..eec8bc69d74ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,7 @@ pub use crate::backend::{Account, Log, Vicinity, Backend}; use sp_std::{vec::Vec, marker::PhantomData}; use frame_support::{ensure, decl_module, decl_storage, decl_event, decl_error}; -use frame_support::weights::{Weight, MINIMUM_WEIGHT, DispatchClass, FunctionOf}; +use frame_support::weights::{Weight, MINIMUM_WEIGHT, DispatchClass, FunctionOf, Pays}; use frame_support::traits::{Currency, WithdrawReason, ExistenceRequirement}; use frame_system::{self as system, ensure_signed}; use sp_runtime::ModuleId; @@ -235,7 +235,12 @@ decl_module! { } /// Issue an EVM call operation. This is similar to a message call transaction in Ethereum. - #[weight = FunctionOf(|(_, _, _, gas_limit, gas_price, _): (&H160, &Vec, &U256, &u32, &U256, &Option)| (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), DispatchClass::Normal, true)] + #[weight = FunctionOf( + |(_, _, _, gas_limit, gas_price, _): (&H160, &Vec, &U256, &u32, &U256, &Option)| + (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), + DispatchClass::Normal, + Pays::Yes, + )] fn call( origin, target: H160, @@ -266,7 +271,12 @@ decl_module! { /// Issue an EVM create operation. This is similar to a contract creation transaction in /// Ethereum. - #[weight = FunctionOf(|(_, _, gas_limit, gas_price, _): (&Vec, &U256, &u32, &U256, &Option)| (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), DispatchClass::Normal, true)] + #[weight = FunctionOf( + |(_, _, gas_limit, gas_price, _): (&Vec, &U256, &u32, &U256, &Option)| + (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), + DispatchClass::Normal, + Pays::Yes, + )] fn create( origin, init: Vec, @@ -301,7 +311,12 @@ decl_module! { } /// Issue an EVM create2 operation. - #[weight = FunctionOf(|(_, _, _, gas_limit, gas_price, _): (&Vec, &H256, &U256, &u32, &U256, &Option)| (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), DispatchClass::Normal, true)] + #[weight = FunctionOf( + |(_, _, _, gas_limit, gas_price, _): (&Vec, &H256, &U256, &u32, &U256, &Option)| + (*gas_price).saturated_into::().saturating_mul(*gas_limit as Weight), + DispatchClass::Normal, + Pays::Yes, + )] fn create2( origin, init: Vec,