Skip to content

Commit

Permalink
Use boba superchain
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuan-chen committed Oct 14, 2024
1 parent bdcf1bc commit b40e3a7
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

//replace github.com/ethereum-optimism/superchain-registry/superchain => ../superchain-registry/superchain
replace github.com/ethereum-optimism/superchain-registry/superchain => github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240926214052-4aa1ce20dfa5
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240926214052-4aa1ce20dfa5 h1:XvIdo6TKf6KHy0ItEBCF5LHCforqyp2UELpMp1VZlws=
github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240926214052-4aa1ce20dfa5/go.mod h1:XaVXL9jg8BcyOeugECgIUGa9Y3DjYJj71RHmb5qon6M=
github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ=
github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
Expand Down Expand Up @@ -171,8 +173,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240828144951-4e6edcb7d36c h1:wI6W6CimquWKoD6eZ0GhULXmiZynynzLBCPnsFKt+Y0=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240828144951-4e6edcb7d36c/go.mod h1:XaVXL9jg8BcyOeugECgIUGa9Y3DjYJj71RHmb5qon6M=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4=
Expand Down
143 changes: 143 additions & 0 deletions params/superchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package params

import (
"fmt"
"math/big"
"testing"

"github.com/stretchr/testify/require"
)

type HumanProtocolVersion struct {
Expand Down Expand Up @@ -170,3 +173,143 @@ func TestProtocolVersion_String(t *testing.T) {
})
}
}

type hardforkConfig struct {
chainID uint64
ShanghaiTime uint64
CancunTime uint64
BedrockBlock *big.Int
RegolithTime uint64
CanyonTime uint64
EcotoneTime uint64
FjordTime uint64
GraniteTime uint64
EIP1559Elasticity uint64
EIP1559Denominator uint64
EIP1559DenominatorCanyon uint64
}

var bobaSepoliaCfg = hardforkConfig{
chainID: 28882,
ShanghaiTime: uint64(1705600788),
CancunTime: uint64(1709078400),
BedrockBlock: big.NewInt(511),
RegolithTime: uint64(1705600788),
CanyonTime: uint64(1705600788),
EcotoneTime: uint64(1709078400),
FjordTime: uint64(1722297600),
GraniteTime: uint64(1726470000),
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: 250,
}

var bobaMainnetCfg = hardforkConfig{
chainID: 288,
ShanghaiTime: uint64(1713302879),
CancunTime: uint64(1713302880),
BedrockBlock: big.NewInt(1149019),
RegolithTime: uint64(1713302879),
CanyonTime: uint64(1713302879),
EcotoneTime: uint64(1713302880),
FjordTime: uint64(1725951600),
GraniteTime: uint64(1729753200),
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: 250,
}

var bobaBnbTestnetCfg = hardforkConfig{
chainID: 9728,
ShanghaiTime: uint64(1718920167),
CancunTime: uint64(1718920168),
BedrockBlock: big.NewInt(675077),
RegolithTime: uint64(1718920167),
CanyonTime: uint64(1718920167),
EcotoneTime: uint64(1718920168),
FjordTime: uint64(1722297600),
GraniteTime: uint64(1726470000),
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: 250,
}

var bobaSepoliaDev0Cfg = hardforkConfig{
chainID: 288882,
ShanghaiTime: uint64(1724692140),
CancunTime: uint64(1724692141),
BedrockBlock: big.NewInt(0),
RegolithTime: uint64(0),
CanyonTime: uint64(1724692140),
EcotoneTime: uint64(1724692141),
FjordTime: uint64(1724692150),
GraniteTime: uint64(1724914800),
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: 250,
}

var opSepoliaCfg = hardforkConfig{
chainID: 11155420,
ShanghaiTime: uint64(1699981200),
CancunTime: uint64(1708534800),
BedrockBlock: big.NewInt(0),
RegolithTime: uint64(0),
CanyonTime: uint64(1699981200),
EcotoneTime: uint64(1708534800),
FjordTime: uint64(1716998400),
GraniteTime: uint64(1723478400),
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: 250,
}

var opMainnetCfg = hardforkConfig{
chainID: 10,
ShanghaiTime: uint64(1704992401),
CancunTime: uint64(1710374401),
BedrockBlock: big.NewInt(105235063),
RegolithTime: uint64(0),
CanyonTime: uint64(1704992401),
EcotoneTime: uint64(1710374401),
FjordTime: uint64(1720627201),
GraniteTime: uint64(1726070401),
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: 250,
}

func TestChainConfigByOpStackChainName(t *testing.T) {
hardforkConfigsByName := map[uint64]hardforkConfig{
288882: bobaSepoliaDev0Cfg,
28882: bobaSepoliaCfg,
288: bobaMainnetCfg,
9728: bobaBnbTestnetCfg,
11155420: opSepoliaCfg,
10: opMainnetCfg,
}

for name, expectedHarhardforkCfg := range hardforkConfigsByName {
gotCfg, err := LoadOPStackChainConfig(name)
require.NotNil(t, gotCfg)
require.NoError(t, err)

// ChainID
require.Equal(t, expectedHarhardforkCfg.chainID, gotCfg.ChainID.Uint64())

// Hardforks
require.Equal(t, expectedHarhardforkCfg.ShanghaiTime, *gotCfg.ShanghaiTime)
require.Equal(t, expectedHarhardforkCfg.CancunTime, *gotCfg.CancunTime)
require.Equal(t, expectedHarhardforkCfg.BedrockBlock, gotCfg.BedrockBlock)
require.Equal(t, expectedHarhardforkCfg.RegolithTime, *gotCfg.RegolithTime)
require.Equal(t, expectedHarhardforkCfg.CanyonTime, *gotCfg.CanyonTime)
require.Equal(t, expectedHarhardforkCfg.EcotoneTime, *gotCfg.EcotoneTime)
require.Equal(t, expectedHarhardforkCfg.FjordTime, *gotCfg.FjordTime)
require.Equal(t, expectedHarhardforkCfg.GraniteTime, *gotCfg.GraniteTime)

// EIP-1559
require.Equal(t, expectedHarhardforkCfg.EIP1559Elasticity, gotCfg.Optimism.EIP1559Elasticity)
require.Equal(t, expectedHarhardforkCfg.EIP1559Denominator, gotCfg.Optimism.EIP1559Denominator)
require.Equal(t, expectedHarhardforkCfg.EIP1559DenominatorCanyon, *gotCfg.Optimism.EIP1559DenominatorCanyon)
}
}

0 comments on commit b40e3a7

Please sign in to comment.