Skip to content

Commit

Permalink
Move tx check (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest authored Mar 2, 2021
1 parent 1e092f7 commit 55bc0af
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use sp_runtime::{
};
use evm::ExitReason;
use fp_evm::CallOrCreateInfo;
use pallet_evm::{Runner, GasWeightMapping};
use pallet_evm::{Runner, GasWeightMapping, FeeCalculator};
use sha3::{Digest, Keccak256};
use codec::{Encode, Decode};
use fp_consensus::{FRONTIER_ENGINE_ID, ConsensusLog};
Expand Down Expand Up @@ -246,8 +246,12 @@ impl<T: Config> frame_support::unsigned::ValidateUnsigned for Module<T> {
}

let fee = transaction.gas_price.saturating_mul(transaction.gas_limit);
let total_payment = transaction.value.saturating_add(fee);
if account_data.balance < total_payment {
return InvalidTransaction::Payment.into();
}

if account_data.balance < fee {
if transaction.gas_price < T::FeeCalculator::min_gas_price() {
return InvalidTransaction::Payment.into();
}

Expand Down

0 comments on commit 55bc0af

Please sign in to comment.