Skip to content

Commit

Permalink
Merge branch 'optimism' into op-geth-v1.101411.2
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuan-chen committed Nov 22, 2024
2 parents 3dd9b02 + eccafa6 commit 06ae341
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
repo:
description: Docker repo
type: string
default: "oplabs-tools-artifacts/images"
default: "boba-392114/bobanetwork-tools-artifacts/images"
push_tags:
description: Push release push tags
type: boolean
Expand Down Expand Up @@ -194,11 +194,11 @@ workflows:
name: Run linter over geth
- tidy-geth:
name: Check geth go.mod file has been tidied
- docker-release:
name: Push to Docker
docker_tags: <<pipeline.git.revision>>
context:
- oplabs-gcr
# - docker-release:
# name: Push to Docker
# docker_tags: <<pipeline.git.revision>>
# context:
# - oplabs-gcr
release:
jobs:
- hold:
Expand Down
6 changes: 6 additions & 0 deletions core/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ func LoadOPStackGenesis(chainID uint64) (*Genesis, error) {
switch chainID {
case params.OPMainnetChainID:
expectedHash = common.HexToHash("0x7ca38a1916c42007829c55e69d3e9a73265554b586a499015373241b8a3fa48b")
case params.BobaMainnetChainID:
expectedHash = common.HexToHash("0xdcd9e6a8f9973eaa62da2874959cb152faeb4fd6929177bd6335a1a16074ef9c")
case params.BobaSepoliaChainID:
expectedHash = common.HexToHash("0xc6171953a6a376ece6e33149686044f24f58a387ce2636a54e391d330b2326b5")
case params.BobaBnbTestnetChainID:
expectedHash = common.HexToHash("0x4d26ddc947c7cea924d5ef272c1a5ef40a1dce5ca2cbbaccad59d33f2505a30d")
default:
return nil, fmt.Errorf("unknown stateless genesis definition for chain %d", chainID)
}
Expand Down
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-20241121215800-d562ce7b7272
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.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bobanetwork/superchain-registry/superchain v0.0.0-20241121215800-d562ce7b7272 h1:SwaUWhth1re3pezKc0Ml+emvQPpSNC7PrQM4aDb3pyw=
github.com/bobanetwork/superchain-registry/superchain v0.0.0-20241121215800-d562ce7b7272/go.mod h1:9feO8jcL5OZ1tvRjEfNAHz4Aggvd6373l+ZxmZZAyZs=
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-20241119111730-bee358f6d6e6 h1:+AIYWDX7FeWRLnBVqPiwireTacLLGGww1slGyv+YN0o=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20241119111730-bee358f6d6e6/go.mod h1:9feO8jcL5OZ1tvRjEfNAHz4Aggvd6373l+ZxmZZAyZs=
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.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A=
Expand Down
21 changes: 18 additions & 3 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,24 @@ var (
)

const (
OPMainnetChainID = 10
BaseMainnetChainID = 8453
baseSepoliaChainID = 84532
OPMainnetChainID = 10
BaseMainnetChainID = 8453
baseSepoliaChainID = 84532
BobaMainnetChainID = 288
BobaSepoliaChainID = 28882
BobaBnbTestnetChainID = 9728
)

// OP Stack chain config
var (
// March 17, 2023 @ 7:00:00 pm UTC
OptimismGoerliRegolithTime = uint64(1679079600)
// Apr Apr 16 2024 21:27:59 UTC 2024
BobaMainnetRegolithTime = uint64(1713302879)
// January 18, 2024 @ 5:59:48 pm UTC
BobaSepoliaRegolithTime = uint64(1705600788)
// Thu Jun 20 2024 21:49:27 pm UTC
BobaBnbTestnetRegoTime = uint64(1718920167)
)

func newUint64(val uint64) *uint64 { return &val }
Expand Down
24 changes: 24 additions & 0 deletions params/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@ func LoadOPStackChainConfig(chainID uint64) (*ChainConfig, error) {
out.GrayGlacierBlock = big.NewInt(105235063)
out.MergeNetsplitBlock = big.NewInt(105235063)
out.BedrockBlock = big.NewInt(105235063)
case BobaMainnetChainID:
out.BerlinBlock = big.NewInt(1149019)
out.LondonBlock = big.NewInt(1149019)
out.ArrowGlacierBlock = big.NewInt(1149019)
out.GrayGlacierBlock = big.NewInt(1149019)
out.MergeNetsplitBlock = big.NewInt(1149019)
out.BedrockBlock = big.NewInt(1149019)
out.RegolithTime = &BobaMainnetRegolithTime
case BobaSepoliaChainID:
out.BerlinBlock = big.NewInt(511)
out.LondonBlock = big.NewInt(511)
out.ArrowGlacierBlock = big.NewInt(511)
out.GrayGlacierBlock = big.NewInt(511)
out.MergeNetsplitBlock = big.NewInt(511)
out.BedrockBlock = big.NewInt(511)
out.RegolithTime = &BobaSepoliaRegolithTime
case BobaBnbTestnetChainID:
out.BerlinBlock = big.NewInt(675077)
out.LondonBlock = big.NewInt(675077)
out.ArrowGlacierBlock = big.NewInt(675077)
out.GrayGlacierBlock = big.NewInt(675077)
out.MergeNetsplitBlock = big.NewInt(675077)
out.BedrockBlock = big.NewInt(675077)
out.RegolithTime = &BobaBnbTestnetRegoTime
}

return out, nil
Expand Down
151 changes: 151 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,151 @@ 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
HoloceneTime 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),
HoloceneTime: uint64(1732435200),
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),
HoloceneTime: uint64(1732633200),
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)
if expectedHarhardforkCfg.HoloceneTime != 0 {
require.Equal(t, expectedHarhardforkCfg.HoloceneTime, *gotCfg.HoloceneTime)
} else {
require.Nil(t, gotCfg.HoloceneTime)
}

// 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 06ae341

Please sign in to comment.