diff --git a/core/state_transition.go b/core/state_transition.go index af08bba096..ffc72aef32 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -119,18 +119,18 @@ func toWordSize(size uint64) uint64 { // A Message contains the data derived from a single transaction that is relevant to state // processing. type Message struct { - To *common.Address - From common.Address - Nonce uint64 - Value *big.Int - GasLimit uint64 - GasPrice *big.Int - GasFeeCap *big.Int - GasTipCap *big.Int - BalanceTokenFee *big.Int - Data []byte - AccessList types.AccessList - AuthList []types.SetCodeAuthorization + To *common.Address + From common.Address + Nonce uint64 + Value *big.Int + GasLimit uint64 + GasPrice *big.Int + GasFeeCap *big.Int + GasTipCap *big.Int + BalanceTokenFee *big.Int + Data []byte + AccessList types.AccessList + SetCodeAuthorizations []types.SetCodeAuthorization // When SkipNonceChecks is true, the message nonce is not checked against the // account nonce in state. @@ -144,19 +144,19 @@ type Message struct { // TransactionToMessage converts a transaction into a Message. func TransactionToMessage(tx *types.Transaction, s types.Signer, balanceFee, blockNumber, baseFee *big.Int) (*Message, error) { msg := &Message{ - Nonce: tx.Nonce(), - GasLimit: tx.Gas(), - GasPrice: new(big.Int).Set(tx.GasPrice()), - GasFeeCap: new(big.Int).Set(tx.GasFeeCap()), - GasTipCap: new(big.Int).Set(tx.GasTipCap()), - To: tx.To(), - Value: tx.Value(), - Data: tx.Data(), - AccessList: tx.AccessList(), - AuthList: tx.AuthList(), - SkipNonceChecks: false, - SkipFromEOACheck: false, - BalanceTokenFee: balanceFee, + Nonce: tx.Nonce(), + GasLimit: tx.Gas(), + GasPrice: new(big.Int).Set(tx.GasPrice()), + GasFeeCap: new(big.Int).Set(tx.GasFeeCap()), + GasTipCap: new(big.Int).Set(tx.GasTipCap()), + To: tx.To(), + Value: tx.Value(), + Data: tx.Data(), + AccessList: tx.AccessList(), + SetCodeAuthorizations: tx.SetCodeAuthorizations(), + SkipNonceChecks: false, + SkipFromEOACheck: false, + BalanceTokenFee: balanceFee, } if balanceFee != nil { @@ -339,11 +339,11 @@ func (st *StateTransition) preCheck() error { } } // Check that EIP-7702 authorization list signatures are well formed. - if msg.AuthList != nil { + if msg.SetCodeAuthorizations != nil { if msg.To == nil { return fmt.Errorf("%w (sender %v)", ErrSetCodeTxCreate, msg.From) } - if len(msg.AuthList) == 0 { + if len(msg.SetCodeAuthorizations) == 0 { return fmt.Errorf("%w (sender %v)", ErrEmptyAuthList, msg.From) } } @@ -387,7 +387,7 @@ func (st *StateTransition) TransitionDb(owner common.Address) (*ExecutionResult, ) // Check clauses 4-5, subtract intrinsic gas if everything is correct - gas, err := IntrinsicGas(msg.Data, msg.AccessList, msg.AuthList, contractCreation, rules.IsHomestead, rules.IsEIP1559) + gas, err := IntrinsicGas(msg.Data, msg.AccessList, msg.SetCodeAuthorizations, contractCreation, rules.IsHomestead, rules.IsEIP1559) if err != nil { return nil, err } @@ -429,8 +429,8 @@ func (st *StateTransition) TransitionDb(owner common.Address) (*ExecutionResult, st.state.SetNonce(msg.From, st.state.GetNonce(msg.From)+1) // Apply EIP-7702 authorizations. - if msg.AuthList != nil { - for _, auth := range msg.AuthList { + if msg.SetCodeAuthorizations != nil { + for _, auth := range msg.SetCodeAuthorizations { // Note errors are ignored, we simply skip invalid authorizations here. st.applyAuthorization(msg, &auth) } diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index 327a2425e3..f04c2ed1d4 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -686,7 +686,7 @@ func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error { return nil } // Ensure the transaction has more gas than the basic tx fee. - intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, true, pool.eip1559.Load()) + intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, true, pool.eip1559.Load()) if err != nil { return err } diff --git a/core/types/transaction.go b/core/types/transaction.go index 4a3364a5e0..c1af1e673c 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -392,8 +392,8 @@ func (tx *Transaction) EffectiveGasTipIntCmp(other *big.Int, baseFee *big.Int) i return tx.EffectiveGasTipValue(baseFee).Cmp(other) } -// AuthList returns the authorizations list of the transaction. -func (tx *Transaction) AuthList() []SetCodeAuthorization { +// SetCodeAuthorizations returns the authorizations list of the transaction. +func (tx *Transaction) SetCodeAuthorizations() []SetCodeAuthorization { setcodetx, ok := tx.inner.(*SetCodeTx) if !ok { return nil diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index a75f865df6..2646d43f25 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -240,7 +240,7 @@ func (s pragueSigner) Hash(tx *Transaction) common.Hash { tx.Value(), tx.Data(), tx.AccessList(), - tx.AuthList(), + tx.SetCodeAuthorizations(), }) } diff --git a/eth/tracers/native/prestate.go b/eth/tracers/native/prestate.go index 1002741b72..1fb260d16e 100644 --- a/eth/tracers/native/prestate.go +++ b/eth/tracers/native/prestate.go @@ -177,7 +177,7 @@ func (t *prestateTracer) OnTxStart(env *tracing.VMContext, tx *types.Transaction t.lookupAccount(env.Coinbase) // Add accounts with authorizations to the prestate before they get applied. - for _, auth := range tx.AuthList() { + for _, auth := range tx.SetCodeAuthorizations() { addr, err := auth.Authority() if err != nil { continue diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 62f8b31599..49c835802f 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1746,7 +1746,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber } else { result.GasPrice = (*hexutil.Big)(tx.GasFeeCap()) } - result.AuthorizationList = tx.AuthList() + result.AuthorizationList = tx.SetCodeAuthorizations() } return result } diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index 096ed539e2..949ebf7646 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -344,7 +344,7 @@ func (args *TransactionArgs) ToMessage(b AccountBackend, baseFee *big.Int, skipN GasTipCap: gasTipCap, Data: args.data(), AccessList: accessList, - AuthList: args.AuthorizationList, + SetCodeAuthorizations: args.AuthorizationList, SkipNonceChecks: skipNonceCheck, SkipFromEOACheck: skipEoACheck, } diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 99c1ca8469..e8a48efb0d 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -333,7 +333,7 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Mess GasTipCap: tx.MaxPriorityFeePerGas, Data: data, AccessList: accessList, - AuthList: authList, + SetCodeAuthorizations: authList, SkipNonceChecks: false, SkipFromEOACheck: false, }