core: use parse delegation for code check in state transition

This commit is contained in:
lightclient 2024-11-26 17:20:55 -07:00
parent f9e0222507
commit f32e9bfe36
No known key found for this signature in database
GPG key ID: 75C916AFEE20183E

View file

@ -17,7 +17,6 @@
package core
import (
"bytes"
"fmt"
"math"
"math/big"
@ -310,7 +309,8 @@ func (st *stateTransition) preCheck() error {
if !msg.SkipFromEOACheck {
// Make sure the sender is an EOA
code := st.state.GetCode(msg.From)
if len(code) > 0 && !bytes.HasPrefix(code, types.DelegationPrefix) {
_, delegated := types.ParseDelegation(code)
if len(code) > 0 && !delegated {
return fmt.Errorf("%w: address %v, len(code): %d", ErrSenderNoEOA, msg.From.Hex(), len(code))
}
}