Skip to content

Commit

Permalink
Merge pull request #122 from bobanetwork/update-superchain-package
Browse files Browse the repository at this point in the history
Upgrade superchain package
  • Loading branch information
boyuan-chen committed Feb 26, 2024
2 parents 07eefaf + bccb42a commit 8a9afee
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,6 @@ require (

replace github.com/ethereum/go-ethereum v1.13.8 => github.com/ethereum-optimism/op-geth v1.101308.1-rc.1

replace github.com/ethereum-optimism/superchain-registry/superchain => github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240208210534-b4480d712cb4
replace github.com/ethereum-optimism/superchain-registry/superchain => github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240223212802-3cf921f7ab5c

//replace github.com/ethereum/go-ethereum v1.13.5 => ../go-ethereum
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
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/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240208210534-b4480d712cb4 h1:8gYbBJBVp3/2q5nudS+6cxEF4d0gWU4ytMfa1XaKHLU=
github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240208210534-b4480d712cb4/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0=
github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240223212802-3cf921f7ab5c h1:IU4ydQNQcDZTms37yPy97jinnOgQ6fTvkd5Dgzz24Dw=
github.com/bobanetwork/superchain-registry/superchain v0.0.0-20240223212802-3cf921f7ab5c/go.mod h1:7xh2awFQqsiZxFrHKTgEd+InVfDRrkKVUIuK8SAFHp0=
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
Expand Down
11 changes: 11 additions & 0 deletions op-node/chaincfg/chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,22 @@ func handleLegacyName(name string) string {
}
}

func handleBobaSuperchainName(name string) string {
switch name {
case "boba-sepolia":
return "boba-boba-sepolia"
default:
return name
}
}

// ChainByName returns a chain, from known available configurations, by name.
// ChainByName returns nil when the chain name is unknown.
func ChainByName(name string) *superchain.ChainConfig {
// Handle legacy name aliases
name = handleLegacyName(name)
// Handle boba superchain name
name = handleBobaSuperchainName(name)
for _, chainCfg := range superchain.OPChains {
if strings.EqualFold(chainCfg.Chain+"-"+chainCfg.Superchain, name) {
return chainCfg
Expand Down
43 changes: 38 additions & 5 deletions op-node/chaincfg/chains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import (
// the superchain-registry is no longer deemed experimental.
func TestGetRollupConfig(t *testing.T) {
configsByName := map[string]rollup.Config{
"goerli": goerliCfg,
// TODO(jky) unskip this test once superchain registry updated
// "mainnet": mainnetCfg,
"sepolia": sepoliaCfg,
"goerli": goerliCfg,
"mainnet": mainnetCfg,
"sepolia": sepoliaCfg,
"boba-sepolia": bobaSepoliaCfg,
}
_ = mainnetCfg

for name, expectedCfg := range configsByName {
gotCfg, err := GetRollupConfig(name)
Expand Down Expand Up @@ -138,6 +137,40 @@ var sepoliaCfg = rollup.Config{
ProtocolVersionsAddress: common.HexToAddress("0x79ADD5713B383DAa0a138d3C4780C7A1804a8090"),
}

var bobaSepoliaCfg = rollup.Config{
Genesis: rollup.Genesis{
L1: eth.BlockID{
Hash: common.HexToHash("0x632d8caedbfd573e09c1b49134bd5147147e0904e0f04eba15c662be0258f517"),
Number: 5109513,
},
L2: eth.BlockID{
Hash: common.HexToHash("0x097654c4c932c97808933b42179388f7bbcefaed3bd93fdf69157e19f1deea0e"),
Number: 511,
},
L2Time: 1705600788,
SystemConfig: eth.SystemConfig{
BatcherAddr: common.HexToAddress("0xf598b6388eC06945021699F0bbb23dfCFc5edbE8"),
Overhead: eth.Bytes32(common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000834")),
Scalar: eth.Bytes32(common.HexToHash("0x00000000000000000000000000000000000000000000000000000000000f4240")),
GasLimit: 30000000,
},
},
BlockTime: 2,
MaxSequencerDrift: 600,
SeqWindowSize: 3600,
ChannelTimeout: 300,
L1ChainID: big.NewInt(11155111),
L2ChainID: big.NewInt(28882),
BatchInboxAddress: common.HexToAddress("0xfff0000000000000000000000000000000028882"),
DepositContractAddress: common.HexToAddress("0xB079E6FA9B3eb072fEbf7F746044834eab308dB6"),
L1SystemConfigAddress: common.HexToAddress("0xfdc9bce032cef55a71b4fde9b9a2198ad1551965"),
RegolithTime: u64Ptr(1705600788),
CanyonTime: u64Ptr(1705600788),
DeltaTime: u64Ptr(1709078400),
EcotoneTime: u64Ptr(1709078400),
ProtocolVersionsAddress: common.HexToAddress("0x0000000000000000000000000000000000000000"),
}

func u64Ptr(v uint64) *uint64 {
return &v
}
2 changes: 0 additions & 2 deletions op-node/rollup/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
cfg.SeqWindowSize = 7200
}
if chainID == bobaSepolia {
*cfg.CanyonTime = 1705600788
cfg.DeltaTime = nil
cfg.ProtocolVersionsAddress = common.Address{}
}
return cfg, nil
Expand Down

0 comments on commit 8a9afee

Please sign in to comment.