From 85a6e028a4fe4e3cb119a2728f159f727ed794c3 Mon Sep 17 00:00:00 2001 From: Piers Powlesland Date: Mon, 5 Aug 2024 10:55:30 +0100 Subject: [PATCH] Handle access list txs at espresso hardfork --- core/types/celo_transaction_signing_forks.go | 4 ++++ core/types/celo_transaction_signing_tx_funcs.go | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/core/types/celo_transaction_signing_forks.go b/core/types/celo_transaction_signing_forks.go index 9e33bb4631..870fc0a8dd 100644 --- a/core/types/celo_transaction_signing_forks.go +++ b/core/types/celo_transaction_signing_forks.go @@ -103,6 +103,10 @@ func (c *celoLegacy) txFuncs(tx *Transaction) *txFuncs { // changes that were not part of Espresso. So instead we ned to handle // DynamicFeeTxTypes here. return dynamicFeeTxFuncs + case t == AccessListTxType: + // Similar to the dynamic fee tx type, we need to handle the access list tx type that was also enabled by the + // espresso hardfork. + return accessListTxFuncs case t == CeloDynamicFeeTxV2Type: return celoDynamicFeeTxV2Funcs case t == CeloDynamicFeeTxType: diff --git a/core/types/celo_transaction_signing_tx_funcs.go b/core/types/celo_transaction_signing_tx_funcs.go index 5d0bbd1bc8..8d53abff34 100644 --- a/core/types/celo_transaction_signing_tx_funcs.go +++ b/core/types/celo_transaction_signing_tx_funcs.go @@ -60,6 +60,18 @@ var ( }, } + accessListTxFuncs = &txFuncs{ + hash: func(tx *Transaction, chainID *big.Int) common.Hash { + return NewEIP2930Signer(chainID).Hash(tx) + }, + signatureValues: func(tx *Transaction, sig []byte, signerChainID *big.Int) (r *big.Int, s *big.Int, v *big.Int, err error) { + return NewEIP2930Signer(signerChainID).SignatureValues(tx, sig) + }, + sender: func(tx *Transaction, hashFunc func(tx *Transaction, chainID *big.Int) common.Hash, signerChainID *big.Int) (common.Address, error) { + return NewEIP2930Signer(tx.ChainId()).Sender(tx) + }, + } + dynamicFeeTxFuncs = &txFuncs{ hash: func(tx *Transaction, chainID *big.Int) common.Hash { return NewLondonSigner(chainID).Hash(tx)