EIP-3607: Reject transactions from senders with deployed code

Any transaction where tx.sender has a CODEHASH != EMPTYCODEHASH MUST
be rejected as invalid, where EMPTYCODEHASH =
0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470.
The invalid transaction MUST be rejected by the client and not be included
in a block. A block containing such a transaction MUST be considered invalid.
This commit is contained in:
jangko 2022-02-10 13:48:56 +07:00
parent 4846405c0e
commit a6f1ed30ee
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
1 changed files with 12 additions and 0 deletions

View File

@ -322,6 +322,18 @@ proc validateTransaction*(
accountNonce=nonce
return false
# EIP-3607 Reject transactions from senders with deployed code
# The EIP spec claims this attack never happened before
# Clients might choose to disable this rule for RPC calls like
# `eth_call` and `eth_estimateGas`
# EOA = Externally Owned Account
let codeHash = roDB.getCodeHash(sender)
if codeHash != EMPTY_SHA3:
debug "invalid tx: sender is not an EOA",
sender=sender.toHex,
codeHash=codeHash.data.toHex
return false
true
proc validateTransaction*(