From ce4a1c51adacce37802c0887f909f08a1ac7d941 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Thu, 26 Sep 2024 14:34:53 +0200 Subject: [PATCH] core: modify eoa check in statetransition --- core/state_transition.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/state_transition.go b/core/state_transition.go index cd2c65ebd5..95ca92f290 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -17,6 +17,7 @@ package core import ( + "bytes" "errors" "fmt" "math" @@ -301,10 +302,10 @@ func (st *StateTransition) preCheck() error { } if !msg.SkipFromEOACheck { // Make sure the sender is an EOA - codeHash := st.state.GetCodeHash(msg.From) - if codeHash != (common.Hash{}) && codeHash != types.EmptyCodeHash { + code := st.state.GetCode(msg.From) + if 0 < len(code) && !bytes.HasPrefix(code, []byte{0xef, 0x01, 0x00}) { 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)