Skip to content

Commit 9f1a73b

Browse files
authored
Check EIP-3607 at transaction validation (#1084)
* check EIP-3607 at transaction validation * fix rust compilation * clippy
1 parent e424762 commit 9f1a73b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

frame/ethereum/src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,16 @@ impl<T: Config> Pallet<T> {
506506
.and_then(|v| v.with_balance_for(&who))
507507
.map_err(|e| e.0)?;
508508

509+
// EIP-3607: https://eips.ethereum.org/EIPS/eip-3607
510+
// Do not allow transactions for which `tx.sender` has any code deployed.
511+
//
512+
// This check should be done on the transaction validation (here) **and**
513+
// on trnasaction execution, otherwise a contract tx will be included in
514+
// the mempool and pollute the mempool forever.
515+
if !pallet_evm::AccountCodes::<T>::get(origin).is_empty() {
516+
return Err(InvalidTransaction::BadSigner.into());
517+
}
518+
509519
let priority = match (
510520
transaction_data.gas_price,
511521
transaction_data.max_fee_per_gas,

0 commit comments

Comments
 (0)