check code existence

This commit is contained in:
allen 2025-10-17 13:31:26 -04:00
parent f9776c2d17
commit 5ed2114eec

View file

@ -612,7 +612,7 @@ func (st *stateTransition) validateAuthorization(auth types.SetCodeAuth) (author
if !skipValidation && nonce+1 < nonce { if !skipValidation && nonce+1 < nonce {
return authority, ErrAuthorizationNonceOverflow return authority, ErrAuthorizationNonceOverflow
} }
// Get authority from auth (may recover from signature or use explicit address). // Get authority from auth
authority, err = auth.GetAuthority() authority, err = auth.GetAuthority()
if err != nil { if err != nil {
return authority, fmt.Errorf("%w: %v", ErrAuthorizationInvalidSignature, err) return authority, fmt.Errorf("%w: %v", ErrAuthorizationInvalidSignature, err)
@ -623,12 +623,12 @@ func (st *stateTransition) validateAuthorization(auth types.SetCodeAuth) (author
// //
// Note it is added to the access list even if the authorization is invalid. // Note it is added to the access list even if the authorization is invalid.
st.state.AddAddressToAccessList(authority) st.state.AddAddressToAccessList(authority)
// Skip state checks during gas estimation
if !skipValidation {
code := st.state.GetCode(authority) code := st.state.GetCode(authority)
if _, ok := types.ParseDelegation(code); len(code) != 0 && !ok { if _, ok := types.ParseDelegation(code); len(code) != 0 && !ok {
return authority, ErrAuthorizationDestinationHasCode return authority, ErrAuthorizationDestinationHasCode
} }
// Skip state checks during gas estimation
if !skipValidation {
if have := st.state.GetNonce(authority); have != nonce { if have := st.state.GetNonce(authority); have != nonce {
return authority, ErrAuthorizationNonceMismatch return authority, ErrAuthorizationNonceMismatch
} }