core/vm: align with current spec (claude), do not charge for invalid auth

This commit is contained in:
MariusVanDerWijden 2026-06-14 13:53:48 +02:00
parent ed7c83a28c
commit 1e456b20f0
No known key found for this signature in database

View file

@ -907,9 +907,12 @@ func (st *stateTransition) validateAuthorization(auth *types.SetCodeAuthorizatio
func (st *stateTransition) applyAuthorization(rules params.Rules, auth *types.SetCodeAuthorization, delegates map[common.Address]bool) error {
authority, err := st.validateAuthorization(auth)
if err != nil {
if rules.IsAmsterdam {
st.gasRemaining.RefundState((params.AccountCreationSize + params.AuthorizationCreationSize) * st.evm.Context.CostPerStateByte)
}
// EIP-8037 (spec apply_authorization): an invalid authorization is
// skipped without any state-gas refund. The per-auth intrinsic state
// charge ((NEW_ACCOUNT + AUTH_BASE) * CPSB) was levied for every
// authorization in the list regardless of validity, and only a
// successfully-applied authorization that avoids creating new state
// earns a refund below. Invalid auths therefore pay in full.
return err
}
prevDelegation, curDelegated := types.ParseDelegation(st.state.GetCode(authority))