core: modify eoa check in statetransition

This commit is contained in:
Marius van der Wijden 2024-09-26 14:34:53 +02:00
parent 3d82fb13a3
commit ce4a1c51ad
1 changed files with 4 additions and 3 deletions

View File

@ -17,6 +17,7 @@
package core package core
import ( import (
"bytes"
"errors" "errors"
"fmt" "fmt"
"math" "math"
@ -301,10 +302,10 @@ func (st *StateTransition) preCheck() error {
} }
if !msg.SkipFromEOACheck { if !msg.SkipFromEOACheck {
// Make sure the sender is an EOA // Make sure the sender is an EOA
codeHash := st.state.GetCodeHash(msg.From) code := st.state.GetCode(msg.From)
if codeHash != (common.Hash{}) && codeHash != types.EmptyCodeHash { if 0 < len(code) && !bytes.HasPrefix(code, []byte{0xef, 0x01, 0x00}) {
return fmt.Errorf("%w: address %v, codehash: %s", ErrSenderNoEOA, return fmt.Errorf("%w: address %v, codehash: %s", ErrSenderNoEOA,
msg.From.Hex(), codeHash) msg.From.Hex(), st.state.GetCodeHash(msg.From))
} }
} }
// Make sure that transaction gasFeeCap is greater than the baseFee (post london) // Make sure that transaction gasFeeCap is greater than the baseFee (post london)