Skip to content

Commit

Permalink
Merge branch 'optimism' into op-geth-v1.14.11
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuan-chen committed Oct 21, 2024
2 parents d5a9661 + e19258b commit e2c034c
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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 @@ -189,11 +189,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
3 changes: 3 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,9 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
if ctx.IsSet(RollupComputePendingBlock.Name) {
cfg.RollupComputePendingBlock = ctx.Bool(RollupComputePendingBlock.Name)
}

// This flag has a default rate limit so always set
cfg.RollupTransactionConditionalRateLimit = ctx.Int(RollupSequencerTxConditionalRateLimitFlag.Name)
}

func setRequiredBlocks(ctx *cli.Context, cfg *ethconfig.Config) {
Expand Down
6 changes: 6 additions & 0 deletions core/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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 @@ -149,4 +149,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
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
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/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.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A=
Expand Down
6 changes: 6 additions & 0 deletions miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/params"
"golang.org/x/time/rate"
)

// Backend wraps all methods required for mining. Only full node is capable
Expand Down Expand Up @@ -86,6 +87,9 @@ type Miner struct {
pendingMu sync.Mutex // Lock protects the pending block

backend Backend

// TransactionConditional safegaurds
conditionalLimiter *rate.Limiter
}

// New creates a new miner with provided config.
Expand All @@ -98,6 +102,8 @@ func New(eth Backend, config Config, engine consensus.Engine) *Miner {
txpool: eth.TxPool(),
chain: eth.BlockChain(),
pending: &pending{},
// setup the rate limit imposed on conditional transactions when block building
conditionalLimiter: rate.NewLimiter(rate.Limit(config.RollupTransactionConditionalRateLimit), params.TransactionConditionalMaxCost),
}
}

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
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 e2c034c

Please sign in to comment.