Skip to content

Commit

Permalink
Check EIP-3607 at transaction validation (#1084)
Browse files Browse the repository at this point in the history
* check EIP-3607 at transaction validation

* fix rust compilation

* clippy
  • Loading branch information
librelois authored Jul 30, 2023
1 parent e424762 commit 9f1a73b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,16 @@ impl<T: Config> Pallet<T> {
.and_then(|v| v.with_balance_for(&who))
.map_err(|e| e.0)?;

// EIP-3607: https://eips.ethereum.org/EIPS/eip-3607
// Do not allow transactions for which `tx.sender` has any code deployed.
//
// This check should be done on the transaction validation (here) **and**
// on trnasaction execution, otherwise a contract tx will be included in
// the mempool and pollute the mempool forever.
if !pallet_evm::AccountCodes::<T>::get(origin).is_empty() {
return Err(InvalidTransaction::BadSigner.into());
}

let priority = match (
transaction_data.gas_price,
transaction_data.max_fee_per_gas,
Expand Down

0 comments on commit 9f1a73b

Please sign in to comment.