core, core/types: rename AuthList to SetCodeAuthorizations #30935 (#1884)

This commit is contained in:
Daniel Liu 2025-12-23 18:10:53 +08:00 committed by GitHub
parent 835579e304
commit 3fd03e0814
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 38 additions and 38 deletions

View file

@ -119,18 +119,18 @@ func toWordSize(size uint64) uint64 {
// A Message contains the data derived from a single transaction that is relevant to state // A Message contains the data derived from a single transaction that is relevant to state
// processing. // processing.
type Message struct { type Message struct {
To *common.Address To *common.Address
From common.Address From common.Address
Nonce uint64 Nonce uint64
Value *big.Int Value *big.Int
GasLimit uint64 GasLimit uint64
GasPrice *big.Int GasPrice *big.Int
GasFeeCap *big.Int GasFeeCap *big.Int
GasTipCap *big.Int GasTipCap *big.Int
BalanceTokenFee *big.Int BalanceTokenFee *big.Int
Data []byte Data []byte
AccessList types.AccessList AccessList types.AccessList
AuthList []types.SetCodeAuthorization SetCodeAuthorizations []types.SetCodeAuthorization
// When SkipNonceChecks is true, the message nonce is not checked against the // When SkipNonceChecks is true, the message nonce is not checked against the
// account nonce in state. // account nonce in state.
@ -144,19 +144,19 @@ type Message struct {
// TransactionToMessage converts a transaction into a Message. // TransactionToMessage converts a transaction into a Message.
func TransactionToMessage(tx *types.Transaction, s types.Signer, balanceFee, blockNumber, baseFee *big.Int) (*Message, error) { func TransactionToMessage(tx *types.Transaction, s types.Signer, balanceFee, blockNumber, baseFee *big.Int) (*Message, error) {
msg := &Message{ msg := &Message{
Nonce: tx.Nonce(), Nonce: tx.Nonce(),
GasLimit: tx.Gas(), GasLimit: tx.Gas(),
GasPrice: new(big.Int).Set(tx.GasPrice()), GasPrice: new(big.Int).Set(tx.GasPrice()),
GasFeeCap: new(big.Int).Set(tx.GasFeeCap()), GasFeeCap: new(big.Int).Set(tx.GasFeeCap()),
GasTipCap: new(big.Int).Set(tx.GasTipCap()), GasTipCap: new(big.Int).Set(tx.GasTipCap()),
To: tx.To(), To: tx.To(),
Value: tx.Value(), Value: tx.Value(),
Data: tx.Data(), Data: tx.Data(),
AccessList: tx.AccessList(), AccessList: tx.AccessList(),
AuthList: tx.AuthList(), SetCodeAuthorizations: tx.SetCodeAuthorizations(),
SkipNonceChecks: false, SkipNonceChecks: false,
SkipFromEOACheck: false, SkipFromEOACheck: false,
BalanceTokenFee: balanceFee, BalanceTokenFee: balanceFee,
} }
if balanceFee != nil { if balanceFee != nil {
@ -339,11 +339,11 @@ func (st *StateTransition) preCheck() error {
} }
} }
// Check that EIP-7702 authorization list signatures are well formed. // Check that EIP-7702 authorization list signatures are well formed.
if msg.AuthList != nil { if msg.SetCodeAuthorizations != nil {
if msg.To == nil { if msg.To == nil {
return fmt.Errorf("%w (sender %v)", ErrSetCodeTxCreate, msg.From) 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) 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 // 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 { if err != nil {
return nil, err 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) st.state.SetNonce(msg.From, st.state.GetNonce(msg.From)+1)
// Apply EIP-7702 authorizations. // Apply EIP-7702 authorizations.
if msg.AuthList != nil { if msg.SetCodeAuthorizations != nil {
for _, auth := range msg.AuthList { for _, auth := range msg.SetCodeAuthorizations {
// Note errors are ignored, we simply skip invalid authorizations here. // Note errors are ignored, we simply skip invalid authorizations here.
st.applyAuthorization(msg, &auth) st.applyAuthorization(msg, &auth)
} }

View file

@ -686,7 +686,7 @@ func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error {
return nil return nil
} }
// Ensure the transaction has more gas than the basic tx fee. // 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 { if err != nil {
return err return err
} }

View file

@ -392,8 +392,8 @@ func (tx *Transaction) EffectiveGasTipIntCmp(other *big.Int, baseFee *big.Int) i
return tx.EffectiveGasTipValue(baseFee).Cmp(other) return tx.EffectiveGasTipValue(baseFee).Cmp(other)
} }
// AuthList returns the authorizations list of the transaction. // SetCodeAuthorizations returns the authorizations list of the transaction.
func (tx *Transaction) AuthList() []SetCodeAuthorization { func (tx *Transaction) SetCodeAuthorizations() []SetCodeAuthorization {
setcodetx, ok := tx.inner.(*SetCodeTx) setcodetx, ok := tx.inner.(*SetCodeTx)
if !ok { if !ok {
return nil return nil

View file

@ -240,7 +240,7 @@ func (s pragueSigner) Hash(tx *Transaction) common.Hash {
tx.Value(), tx.Value(),
tx.Data(), tx.Data(),
tx.AccessList(), tx.AccessList(),
tx.AuthList(), tx.SetCodeAuthorizations(),
}) })
} }

View file

@ -177,7 +177,7 @@ func (t *prestateTracer) OnTxStart(env *tracing.VMContext, tx *types.Transaction
t.lookupAccount(env.Coinbase) t.lookupAccount(env.Coinbase)
// Add accounts with authorizations to the prestate before they get applied. // 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() addr, err := auth.Authority()
if err != nil { if err != nil {
continue continue

View file

@ -1746,7 +1746,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
} else { } else {
result.GasPrice = (*hexutil.Big)(tx.GasFeeCap()) result.GasPrice = (*hexutil.Big)(tx.GasFeeCap())
} }
result.AuthorizationList = tx.AuthList() result.AuthorizationList = tx.SetCodeAuthorizations()
} }
return result return result
} }

View file

@ -344,7 +344,7 @@ func (args *TransactionArgs) ToMessage(b AccountBackend, baseFee *big.Int, skipN
GasTipCap: gasTipCap, GasTipCap: gasTipCap,
Data: args.data(), Data: args.data(),
AccessList: accessList, AccessList: accessList,
AuthList: args.AuthorizationList, SetCodeAuthorizations: args.AuthorizationList,
SkipNonceChecks: skipNonceCheck, SkipNonceChecks: skipNonceCheck,
SkipFromEOACheck: skipEoACheck, SkipFromEOACheck: skipEoACheck,
} }

View file

@ -333,7 +333,7 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Mess
GasTipCap: tx.MaxPriorityFeePerGas, GasTipCap: tx.MaxPriorityFeePerGas,
Data: data, Data: data,
AccessList: accessList, AccessList: accessList,
AuthList: authList, SetCodeAuthorizations: authList,
SkipNonceChecks: false, SkipNonceChecks: false,
SkipFromEOACheck: false, SkipFromEOACheck: false,
} }