Skip to content

Commit

Permalink
Handle access list txs at espresso hardfork (#213)
Browse files Browse the repository at this point in the history
Ideally we would be able to leave signing of non celo transaction types to the upstream code. But in this case the the upstream support for this transaction type was added in the London hardfork which also contained lots of other changes which we are enabling at the cel2 transition point. We can't enable the London hardfork earlier, as it will make our migrated blocks invalid. From the celo side we added support for these transactions in the Espresso hardfork which came before the London hardfork and so we need support from espresso onwards for this transaction type and therefore we add it to the celo legacy meta fork (which contains signing logic for all forks before cel2).
  • Loading branch information
piersy authored Sep 12, 2024
1 parent c4a6881 commit 1440796
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/types/celo_transaction_signing_forks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions core/types/celo_transaction_signing_tx_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1440796

Please sign in to comment.