Skip to content

Commit

Permalink
Merge branch 'celo10' into piersy/smoketest
Browse files Browse the repository at this point in the history
  • Loading branch information
piersy authored Nov 25, 2024
2 parents 6622671 + 63fb235 commit 8a205ae
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion compat_test/compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
"github.com/stretchr/testify/require"
Expand All @@ -40,7 +41,7 @@ var (
celoRpcURL string
opGethRpcURL string
startBlock uint64
gingerbreadBlocks = map[uint64]uint64{42220: 21616000, 62320: 18785000, 44787: 19814000}
gingerbreadBlocks = map[uint64]uint64{params.CeloMainnetChainID: 21616000, params.CeloBaklavaChainID: 18785000, params.CeloAlfajoresChainID: 19814000}
)

func init() {
Expand Down
3 changes: 0 additions & 3 deletions contracts/addresses/addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@ var (

CeloTokenBaklavaAddress = common.HexToAddress("0xdDc9bE57f553fe75752D61606B94CBD7e0264eF8")
FeeHandlerBaklavaAddress = common.HexToAddress("0xeed0A69c51079114C280f7b936C79e24bD94013e")

AlfajoresChainID uint64 = 44787
BaklavaChainID uint64 = 62320
)
4 changes: 2 additions & 2 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,10 @@ func (st *StateTransition) distributeTxFees() error {

feeCurrency := st.msg.FeeCurrency
feeHandlerAddress := addresses.FeeHandlerAddress
if st.evm.ChainConfig().ChainID != nil && st.evm.ChainConfig().ChainID.Uint64() == addresses.AlfajoresChainID {
if st.evm.ChainConfig().ChainID != nil && st.evm.ChainConfig().ChainID.Uint64() == params.CeloAlfajoresChainID {
feeHandlerAddress = addresses.FeeHandlerAlfajoresAddress
}
if st.evm.ChainConfig().ChainID != nil && st.evm.ChainConfig().ChainID.Uint64() == addresses.BaklavaChainID {
if st.evm.ChainConfig().ChainID != nil && st.evm.ChainConfig().ChainID.Uint64() == params.CeloBaklavaChainID {
feeHandlerAddress = addresses.FeeHandlerBaklavaAddress
}

Expand Down
5 changes: 5 additions & 0 deletions core/types/rollup_cost.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ func NewL1CostFunc(config *params.ChainConfig, statedb StateGetter) L1CostFunc {
forBlock := ^uint64(0)
var cachedFunc l1CostFunc
selectFunc := func(blockTime uint64) l1CostFunc {
// Alfajores requires a custom cost function see link for a detailed explanation
// https://github.com/celo-org/op-geth/pull/271
if config.IsCel2(blockTime) && config.ChainID.Uint64() == params.CeloAlfajoresChainID {
return func(rcd RollupCostData) (fee, gasUsed *big.Int) { return new(big.Int), new(big.Int) }
}
if !config.IsOptimismEcotone(blockTime) {
return newL1CostFuncBedrock(config, statedb, blockTime)
}
Expand Down
4 changes: 2 additions & 2 deletions core/vm/celo_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ func celoPrecompileAddress(index byte) common.Address {

func (ctx *celoPrecompileContext) IsCallerCeloToken() (bool, error) {
tokenAddress := addresses.CeloTokenAddress
if ctx.evm.ChainConfig().ChainID != nil && ctx.evm.ChainConfig().ChainID.Uint64() == addresses.AlfajoresChainID {
if ctx.evm.ChainConfig().ChainID != nil && ctx.evm.ChainConfig().ChainID.Uint64() == params.CeloAlfajoresChainID {
tokenAddress = addresses.CeloTokenAlfajoresAddress
}
if ctx.evm.ChainConfig().ChainID != nil && ctx.evm.ChainConfig().ChainID.Uint64() == addresses.BaklavaChainID {
if ctx.evm.ChainConfig().ChainID != nil && ctx.evm.ChainConfig().ChainID.Uint64() == params.CeloBaklavaChainID {
tokenAddress = addresses.CeloTokenBaklavaAddress
}

Expand Down
2 changes: 1 addition & 1 deletion internal/ethapi/celo_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func TestNewRPCTransactionDynamicFee(t *testing.T) {
func allEnabledChainConfig() *params.ChainConfig {
zeroTime := uint64(0)
return &params.ChainConfig{
ChainID: big.NewInt(44787),
ChainID: big.NewInt(params.CeloAlfajoresChainID),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
Expand Down
2 changes: 2 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const (
OPMainnetChainID = 10
OPGoerliChainID = 420
CeloMainnetChainID = 42220
CeloBaklavaChainID = 62320
CeloAlfajoresChainID = 44787
BaseMainnetChainID = 8453
BaseGoerliChainID = 84531
baseSepoliaChainID = 84532
Expand Down

0 comments on commit 8a205ae

Please sign in to comment.