Skip to content

Commit a2d636f

Browse files
fjljakub-freebit
authored andcommitted
core, core/types: rename AuthList to SetCodeAuthorizations (ethereum#30935)
As a follow-up to ethereum#30933, I propose to also use the SetCode prefix in our internal APIs for the authorization list.
1 parent f312de2 commit a2d636f

File tree

10 files changed

+68
-68
lines changed

10 files changed

+68
-68
lines changed

cmd/evm/internal/t8ntool/transaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func Transaction(ctx *cli.Context) error {
133133
r.Address = sender
134134
}
135135
// Check intrinsic gas
136-
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil,
136+
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil,
137137
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int), 0)); err != nil {
138138
r.Error = err
139139
results = append(results, r)

core/state_transition.go

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,19 @@ func toWordSize(size uint64) uint64 {
131131
// A Message contains the data derived from a single transaction that is relevant to state
132132
// processing.
133133
type Message struct {
134-
To *common.Address
135-
From common.Address
136-
Nonce uint64
137-
Value *big.Int
138-
GasLimit uint64
139-
GasPrice *big.Int
140-
GasFeeCap *big.Int
141-
GasTipCap *big.Int
142-
Data []byte
143-
AccessList types.AccessList
144-
BlobGasFeeCap *big.Int
145-
BlobHashes []common.Hash
146-
AuthList []types.SetCodeAuthorization
134+
To *common.Address
135+
From common.Address
136+
Nonce uint64
137+
Value *big.Int
138+
GasLimit uint64
139+
GasPrice *big.Int
140+
GasFeeCap *big.Int
141+
GasTipCap *big.Int
142+
Data []byte
143+
AccessList types.AccessList
144+
BlobGasFeeCap *big.Int
145+
BlobHashes []common.Hash
146+
SetCodeAuthorizations []types.SetCodeAuthorization
147147

148148
// When SkipNonceChecks is true, the message nonce is not checked against the
149149
// account nonce in state.
@@ -157,20 +157,20 @@ type Message struct {
157157
// TransactionToMessage converts a transaction into a Message.
158158
func TransactionToMessage(tx *types.Transaction, s types.Signer, baseFee *big.Int) (*Message, error) {
159159
msg := &Message{
160-
Nonce: tx.Nonce(),
161-
GasLimit: tx.Gas(),
162-
GasPrice: new(big.Int).Set(tx.GasPrice()),
163-
GasFeeCap: new(big.Int).Set(tx.GasFeeCap()),
164-
GasTipCap: new(big.Int).Set(tx.GasTipCap()),
165-
To: tx.To(),
166-
Value: tx.Value(),
167-
Data: tx.Data(),
168-
AccessList: tx.AccessList(),
169-
AuthList: tx.AuthList(),
170-
SkipNonceChecks: false,
171-
SkipFromEOACheck: false,
172-
BlobHashes: tx.BlobHashes(),
173-
BlobGasFeeCap: tx.BlobGasFeeCap(),
160+
Nonce: tx.Nonce(),
161+
GasLimit: tx.Gas(),
162+
GasPrice: new(big.Int).Set(tx.GasPrice()),
163+
GasFeeCap: new(big.Int).Set(tx.GasFeeCap()),
164+
GasTipCap: new(big.Int).Set(tx.GasTipCap()),
165+
To: tx.To(),
166+
Value: tx.Value(),
167+
Data: tx.Data(),
168+
AccessList: tx.AccessList(),
169+
SetCodeAuthorizations: tx.SetCodeAuthorizations(),
170+
SkipNonceChecks: false,
171+
SkipFromEOACheck: false,
172+
BlobHashes: tx.BlobHashes(),
173+
BlobGasFeeCap: tx.BlobGasFeeCap(),
174174
}
175175
// If baseFee provided, set gasPrice to effectiveGasPrice.
176176
if baseFee != nil {
@@ -372,11 +372,11 @@ func (st *stateTransition) preCheck() error {
372372
}
373373
}
374374
// Check that EIP-7702 authorization list signatures are well formed.
375-
if msg.AuthList != nil {
375+
if msg.SetCodeAuthorizations != nil {
376376
if msg.To == nil {
377377
return fmt.Errorf("%w (sender %v)", ErrSetCodeTxCreate, msg.From)
378378
}
379-
if len(msg.AuthList) == 0 {
379+
if len(msg.SetCodeAuthorizations) == 0 {
380380
return fmt.Errorf("%w (sender %v)", ErrEmptyAuthList, msg.From)
381381
}
382382
}
@@ -417,7 +417,7 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
417417
)
418418

419419
// Check clauses 4-5, subtract intrinsic gas if everything is correct
420-
gas, err := IntrinsicGas(msg.Data, msg.AccessList, msg.AuthList, contractCreation, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai)
420+
gas, err := IntrinsicGas(msg.Data, msg.AccessList, msg.SetCodeAuthorizations, contractCreation, rules.IsHomestead, rules.IsIstanbul, rules.IsShanghai)
421421
if err != nil {
422422
return nil, err
423423
}
@@ -467,8 +467,8 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
467467
st.state.SetNonce(msg.From, st.state.GetNonce(msg.From)+1)
468468

469469
// Apply EIP-7702 authorizations.
470-
if msg.AuthList != nil {
471-
for _, auth := range msg.AuthList {
470+
if msg.SetCodeAuthorizations != nil {
471+
for _, auth := range msg.SetCodeAuthorizations {
472472
// Note errors are ignored, we simply skip invalid authorizations here.
473473
st.applyAuthorization(msg, &auth)
474474
}

core/txpool/validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
108108
}
109109
// Ensure the transaction has more gas than the bare minimum needed to cover
110110
// the transaction metadata
111-
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))
111+
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))
112112
if err != nil {
113113
return err
114114
}

core/types/transaction.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ func (tx *Transaction) WithBlobTxSidecar(sideCar *BlobTxSidecar) *Transaction {
474474
return cpy
475475
}
476476

477-
// AuthList returns the authorizations list of the transaction.
478-
func (tx *Transaction) AuthList() []SetCodeAuthorization {
477+
// SetCodeAuthorizations returns the authorizations list of the transaction.
478+
func (tx *Transaction) SetCodeAuthorizations() []SetCodeAuthorization {
479479
setcodetx, ok := tx.inner.(*SetCodeTx)
480480
if !ok {
481481
return nil

core/types/transaction_signing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func (s pragueSigner) Hash(tx *Transaction) common.Hash {
245245
tx.Value(),
246246
tx.Data(),
247247
tx.AccessList(),
248-
tx.AuthList(),
248+
tx.SetCodeAuthorizations(),
249249
})
250250
}
251251

eth/tracers/native/prestate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (t *prestateTracer) OnTxStart(env *tracing.VMContext, tx *types.Transaction
161161
t.lookupAccount(env.Coinbase)
162162

163163
// Add accounts with authorizations to the prestate before they get applied.
164-
for _, auth := range tx.AuthList() {
164+
for _, auth := range tx.SetCodeAuthorizations() {
165165
addr, err := auth.Authority()
166166
if err != nil {
167167
continue

internal/ethapi/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
10491049
} else {
10501050
result.GasPrice = (*hexutil.Big)(tx.GasFeeCap())
10511051
}
1052-
result.AuthorizationList = tx.AuthList()
1052+
result.AuthorizationList = tx.SetCodeAuthorizations()
10531053
}
10541054
return result
10551055
}

internal/ethapi/transaction_args.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -454,21 +454,21 @@ func (args *TransactionArgs) ToMessage(baseFee *big.Int, skipNonceCheck, skipEoA
454454
accessList = *args.AccessList
455455
}
456456
return &core.Message{
457-
From: args.from(),
458-
To: args.To,
459-
Value: (*big.Int)(args.Value),
460-
Nonce: uint64(*args.Nonce),
461-
GasLimit: uint64(*args.Gas),
462-
GasPrice: gasPrice,
463-
GasFeeCap: gasFeeCap,
464-
GasTipCap: gasTipCap,
465-
Data: args.data(),
466-
AccessList: accessList,
467-
BlobGasFeeCap: (*big.Int)(args.BlobFeeCap),
468-
BlobHashes: args.BlobHashes,
469-
AuthList: args.AuthorizationList,
470-
SkipNonceChecks: skipNonceCheck,
471-
SkipFromEOACheck: skipEoACheck,
457+
From: args.from(),
458+
To: args.To,
459+
Value: (*big.Int)(args.Value),
460+
Nonce: uint64(*args.Nonce),
461+
GasLimit: uint64(*args.Gas),
462+
GasPrice: gasPrice,
463+
GasFeeCap: gasFeeCap,
464+
GasTipCap: gasTipCap,
465+
Data: args.data(),
466+
AccessList: accessList,
467+
BlobGasFeeCap: (*big.Int)(args.BlobFeeCap),
468+
BlobHashes: args.BlobHashes,
469+
SetCodeAuthorizations: args.AuthorizationList,
470+
SkipNonceChecks: skipNonceCheck,
471+
SkipFromEOACheck: skipEoACheck,
472472
}
473473
}
474474

tests/state_test_util.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -457,19 +457,19 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Mess
457457
}
458458

459459
msg := &core.Message{
460-
From: from,
461-
To: to,
462-
Nonce: tx.Nonce,
463-
Value: value,
464-
GasLimit: gasLimit,
465-
GasPrice: gasPrice,
466-
GasFeeCap: tx.MaxFeePerGas,
467-
GasTipCap: tx.MaxPriorityFeePerGas,
468-
Data: data,
469-
AccessList: accessList,
470-
BlobHashes: tx.BlobVersionedHashes,
471-
BlobGasFeeCap: tx.BlobGasFeeCap,
472-
AuthList: authList,
460+
From: from,
461+
To: to,
462+
Nonce: tx.Nonce,
463+
Value: value,
464+
GasLimit: gasLimit,
465+
GasPrice: gasPrice,
466+
GasFeeCap: tx.MaxFeePerGas,
467+
GasTipCap: tx.MaxPriorityFeePerGas,
468+
Data: data,
469+
AccessList: accessList,
470+
BlobHashes: tx.BlobVersionedHashes,
471+
BlobGasFeeCap: tx.BlobGasFeeCap,
472+
SetCodeAuthorizations: authList,
473473
}
474474
return msg, nil
475475
}

tests/transaction_test_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (tt *TransactionTest) Run(config *params.ChainConfig) error {
5959
return nil, nil, err
6060
}
6161
// Intrinsic gas
62-
requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, isHomestead, isIstanbul, false)
62+
requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, isHomestead, isIstanbul, false)
6363
if err != nil {
6464
return nil, nil, err
6565
}

0 commit comments

Comments
 (0)