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

As a follow-up to #30933, I propose to also use the SetCode prefix in
our internal APIs for the authorization list.
pull/30937/head
Felix Lange 1 month ago committed by GitHub
parent f861535f1e
commit f1e6372eea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      cmd/evm/internal/t8ntool/transaction.go
  2. 14
      core/state_transition.go
  3. 2
      core/txpool/validation.go
  4. 4
      core/types/transaction.go
  5. 2
      core/types/transaction_signing.go
  6. 2
      eth/tracers/native/prestate.go
  7. 2
      internal/ethapi/api.go
  8. 2
      internal/ethapi/transaction_args.go
  9. 2
      tests/state_test_util.go
  10. 2
      tests/transaction_test_util.go

@ -133,7 +133,7 @@ func Transaction(ctx *cli.Context) error {
r.Address = sender r.Address = sender
} }
// Check intrinsic gas // Check intrinsic gas
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil,
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int), 0)); err != nil { chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int), 0)); err != nil {
r.Error = err r.Error = err
results = append(results, r) results = append(results, r)

@ -143,7 +143,7 @@ type Message struct {
AccessList types.AccessList AccessList types.AccessList
BlobGasFeeCap *big.Int BlobGasFeeCap *big.Int
BlobHashes []common.Hash BlobHashes []common.Hash
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.
@ -166,7 +166,7 @@ func TransactionToMessage(tx *types.Transaction, s types.Signer, baseFee *big.In
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,
BlobHashes: tx.BlobHashes(), BlobHashes: tx.BlobHashes(),
@ -372,11 +372,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)
} }
} }
@ -417,7 +417,7 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
) )
// 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.IsIstanbul, rules.IsShanghai) gas, err := IntrinsicGas(msg.Data, msg.AccessList, msg.SetCodeAuthorizations, contractCreation, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -467,8 +467,8 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
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)
} }

@ -108,7 +108,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
} }
// Ensure the transaction has more gas than the bare minimum needed to cover // Ensure the transaction has more gas than the bare minimum needed to cover
// the transaction metadata // the transaction metadata
intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, true, opts.Config.IsIstanbul(head.Number), opts.Config.IsShanghai(head.Number, head.Time)) intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, true, opts.Config.IsIstanbul(head.Number), opts.Config.IsShanghai(head.Number, head.Time))
if err != nil { if err != nil {
return err return err
} }

@ -474,8 +474,8 @@ func (tx *Transaction) WithBlobTxSidecar(sideCar *BlobTxSidecar) *Transaction {
return cpy return cpy
} }
// 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

@ -245,7 +245,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(),
}) })
} }

@ -161,7 +161,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

@ -1049,7 +1049,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
} }

@ -466,7 +466,7 @@ func (args *TransactionArgs) ToMessage(baseFee *big.Int, skipNonceCheck, skipEoA
AccessList: accessList, AccessList: accessList,
BlobGasFeeCap: (*big.Int)(args.BlobFeeCap), BlobGasFeeCap: (*big.Int)(args.BlobFeeCap),
BlobHashes: args.BlobHashes, BlobHashes: args.BlobHashes,
AuthList: args.AuthorizationList, SetCodeAuthorizations: args.AuthorizationList,
SkipNonceChecks: skipNonceCheck, SkipNonceChecks: skipNonceCheck,
SkipFromEOACheck: skipEoACheck, SkipFromEOACheck: skipEoACheck,
} }

@ -469,7 +469,7 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Mess
AccessList: accessList, AccessList: accessList,
BlobHashes: tx.BlobVersionedHashes, BlobHashes: tx.BlobVersionedHashes,
BlobGasFeeCap: tx.BlobGasFeeCap, BlobGasFeeCap: tx.BlobGasFeeCap,
AuthList: authList, SetCodeAuthorizations: authList,
} }
return msg, nil return msg, nil
} }

@ -59,7 +59,7 @@ func (tt *TransactionTest) Run(config *params.ChainConfig) error {
return nil, nil, err return nil, nil, err
} }
// Intrinsic gas // Intrinsic gas
requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, isHomestead, isIstanbul, false) requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, isHomestead, isIstanbul, false)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }

Loading…
Cancel
Save