From 350978a0a66e53ba735f987bf8d7d8453afbf06a Mon Sep 17 00:00:00 2001 From: lightclient Date: Wed, 29 Oct 2025 20:20:48 -0600 Subject: [PATCH] all: expose DeriveAuthorities publicly, use in other Message call sites --- core/types/transaction.go | 2 +- core/types/tx_setcode.go | 10 ++++++---- internal/ethapi/transaction_args.go | 2 +- tests/state_test_util.go | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index 418eb02755..1121179b29 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -523,7 +523,7 @@ func (tx *Transaction) SetCodeAuthorities() []*common.Address { if cache := tx.auths.Load(); cache != nil { return *cache } - cache := setcodetx.deriveAuthorities() + cache := (authCache)(DeriveAuthorities(setcodetx.AuthList)) tx.auths.Store(&cache) return cache } diff --git a/core/types/tx_setcode.go b/core/types/tx_setcode.go index c1d99a09fb..0ed06b72e2 100644 --- a/core/types/tx_setcode.go +++ b/core/types/tx_setcode.go @@ -66,14 +66,16 @@ type SetCodeTx struct { S *uint256.Int } +// authCache is an internal helper type used in the Transaction object to cache +// authorizations. type authCache []*common.Address -// deriveAuthorities returns a list of recovered authorization signers. The +// DeriveAuthorities returns a list of recovered authorization signers. The // length is always equal to the number of authorizations. Any authorities that // fail to recover are set as nil in the list. -func (tx *SetCodeTx) deriveAuthorities() authCache { - auths := make([]*common.Address, 0, len(tx.AuthList)) - for _, auth := range tx.AuthList { +func DeriveAuthorities(authList []SetCodeAuthorization) []*common.Address { + auths := make([]*common.Address, 0, len(authList)) + for _, auth := range authList { if addr, err := auth.Authority(); err == nil { auths = append(auths, &addr) } else { diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index a3a82101f6..9927438174 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -490,7 +490,7 @@ func (args *TransactionArgs) ToMessage(baseFee *big.Int, skipNonceCheck bool) *c BlobGasFeeCap: (*big.Int)(args.BlobFeeCap), BlobHashes: args.BlobHashes, SetCodeAuthorizations: args.AuthorizationList, - AuthorityCache: types.ToAuthorityCache(args.AuthorizationList), + Authorities: types.DeriveAuthorities(args.AuthorizationList), SkipNonceChecks: skipNonceCheck, SkipTransactionChecks: true, } diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 6dfee932fa..ef5f4a4a83 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -477,7 +477,7 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Mess BlobHashes: tx.BlobVersionedHashes, BlobGasFeeCap: tx.BlobGasFeeCap, SetCodeAuthorizations: authList, - AuthorityCache: types.ToAuthorityCache(authList), + Authorities: types.DeriveAuthorities(authList), } return msg, nil }