From 7940cdb25528b52b61fbaaaa926136a4da508c1a Mon Sep 17 00:00:00 2001 From: welkin22 Date: Thu, 1 Aug 2024 16:45:07 +0800 Subject: [PATCH 1/2] feat(op-chain-ops): add wright fork config into genesis file generation code --- bedrock-devnet/devnet/__init__.py | 3 +++ go.mod | 3 ++- go.sum | 7 +++++-- op-chain-ops/genesis/config.go | 14 ++++++++++++++ op-chain-ops/genesis/genesis.go | 1 + .../scripts/getting-started/config.sh | 1 + 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/bedrock-devnet/devnet/__init__.py b/bedrock-devnet/devnet/__init__.py index 9bc4b9fc56..12187ed2b7 100644 --- a/bedrock-devnet/devnet/__init__.py +++ b/bedrock-devnet/devnet/__init__.py @@ -300,6 +300,9 @@ def devnet_deploy(paths): deploy_config['l2GenesisDeltaTimeOffset'] = "0x0" deploy_config['fermat'] = 0 deploy_config['L2GenesisEcotoneTimeOffset'] = "0x0" + deploy_config['snowTimeOffset'] = "0x0" + deploy_config['haberTimeOffset'] = "0x0" + deploy_config['wrightTimeOffset'] = "0x0" write_json(devnet_cfg_orig, deploy_config) if os.path.exists(paths.addresses_json_path): diff --git a/go.mod b/go.mod index b4de7165ac..732e41a8d2 100644 --- a/go.mod +++ b/go.mod @@ -196,6 +196,7 @@ require ( github.com/onsi/ginkgo/v2 v2.15.0 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/panjf2000/ants/v2 v2.4.5 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/peterh/liner v1.2.0 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect @@ -253,7 +254,7 @@ require ( rsc.io/tmplfunc v0.0.3 // indirect ) -replace github.com/ethereum/go-ethereum v1.13.8 => github.com/bnb-chain/op-geth v0.4.1 +replace github.com/ethereum/go-ethereum v1.13.8 => github.com/redhdx/op-geth v0.1.3-0.20240801065049-0b6ea284e0a6 replace github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.0.0 diff --git a/go.sum b/go.sum index bb929bb8d3..77334c7d26 100644 --- a/go.sum +++ b/go.sum @@ -179,8 +179,6 @@ github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6 github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/bnb-chain/greenfield-cometbft v1.0.0 h1:0r6hOJWD/+es0gxP/exKuN/krgXAr3LCn5/XlcgDWr8= github.com/bnb-chain/greenfield-cometbft v1.0.0/go.mod h1:f35mk/r5ab6yvzlqEWZt68LfUje68sYgMpVlt2CUYMk= -github.com/bnb-chain/op-geth v0.4.1 h1:rnVDtFWHhg0RBSndIBeh6M9cNOPzbW8XfshWY6jWIUQ= -github.com/bnb-chain/op-geth v0.4.1/go.mod h1:dkpInaOz3WeP/5lgdL0BOA6mjexUj30tPQU81H1yEHQ= 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= @@ -1306,6 +1304,8 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= +github.com/panjf2000/ants/v2 v2.4.5 h1:kcGvjXB7ea0MrzzszpnlVFthhYKoFxLi75nRbsq01HY= +github.com/panjf2000/ants/v2 v2.4.5/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -1428,6 +1428,8 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/redhdx/op-geth v0.1.3-0.20240801065049-0b6ea284e0a6 h1:D7AvHvNa9+pUSEq90nmxVq9pm3Z0jq3JcDFzousySQg= +github.com/redhdx/op-geth v0.1.3-0.20240801065049-0b6ea284e0a6/go.mod h1:EHq3Fg681gI6u0Ey0OexTOS5xGYQuL7A7fSQIK1Jz2Q= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= @@ -2235,6 +2237,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/op-chain-ops/genesis/config.go b/op-chain-ops/genesis/config.go index 35dbe0fffa..f4c260821e 100644 --- a/op-chain-ops/genesis/config.go +++ b/op-chain-ops/genesis/config.go @@ -231,6 +231,9 @@ type DeployConfig struct { // HaberTimeOffset is the number of seconds after genesis block that haber hard fork activates. // Set it to 0 to activate at genesis. Nil to disable haber fork. HaberTimeOffset *hexutil.Uint64 `json:"haberTimeOffset,omitempty"` + // WrightTimeOffset is the number of seconds after genesis block that wright hard fork activates. + // Set it to 0 to activate at genesis. Nil to disable wright fork. + WrightTimeOffset *hexutil.Uint64 `json:"wrightTimeOffset,omitempty"` // RequiredProtocolVersion indicates the protocol version that // nodes are required to adopt, to stay in sync with the network. RequiredProtocolVersion params.ProtocolVersion `json:"requiredProtocolVersion"` @@ -581,6 +584,17 @@ func (d *DeployConfig) HaberTime(genesisTime uint64) *uint64 { return &v } +func (d *DeployConfig) WrightTime(genesisTime uint64) *uint64 { + if d.WrightTimeOffset == nil { + return nil + } + v := uint64(0) + if offset := *d.WrightTimeOffset; offset > 0 { + v = genesisTime + uint64(offset) + } + return &v +} + // RollupConfig converts a DeployConfig to a rollup.Config func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHash common.Hash, l2GenesisBlockNumber uint64) (*rollup.Config, error) { if d.OptimismPortalProxy == (common.Address{}) { diff --git a/op-chain-ops/genesis/genesis.go b/op-chain-ops/genesis/genesis.go index 3c1c45e4df..734a1c8fc8 100644 --- a/op-chain-ops/genesis/genesis.go +++ b/op-chain-ops/genesis/genesis.go @@ -69,6 +69,7 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro InteropTime: config.InteropTime(block.Time()), Fermat: config.Fermat, HaberTime: config.HaberTime(block.Time()), + WrightTime: config.WrightTime(block.Time()), Optimism: ¶ms.OptimismConfig{ EIP1559Denominator: eip1559Denom, EIP1559Elasticity: eip1559Elasticity, diff --git a/packages/contracts-bedrock/scripts/getting-started/config.sh b/packages/contracts-bedrock/scripts/getting-started/config.sh index 4eba349ef3..d37a06b9b6 100755 --- a/packages/contracts-bedrock/scripts/getting-started/config.sh +++ b/packages/contracts-bedrock/scripts/getting-started/config.sh @@ -102,6 +102,7 @@ config=$(cat << EOL "fermat": 0, "snowTimeOffset": "0x0", "haberTimeOffset": "0x0", + "wrightTimeOffset": "0x0", "fundDevAccounts": true, "proofMaturityDelaySeconds": 12, "disputeGameFinalityDelaySeconds": 6, From 040b1fdf50fd1cca8790223cc89556a171af0233 Mon Sep 17 00:00:00 2001 From: welkin22 Date: Thu, 8 Aug 2024 16:52:26 +0800 Subject: [PATCH 2/2] use release version --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 732e41a8d2..ff3c655346 100644 --- a/go.mod +++ b/go.mod @@ -254,7 +254,7 @@ require ( rsc.io/tmplfunc v0.0.3 // indirect ) -replace github.com/ethereum/go-ethereum v1.13.8 => github.com/redhdx/op-geth v0.1.3-0.20240801065049-0b6ea284e0a6 +replace github.com/ethereum/go-ethereum v1.13.8 => github.com/bnb-chain/op-geth v0.4.4 replace github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.0.0 diff --git a/go.sum b/go.sum index 77334c7d26..938b8f1a61 100644 --- a/go.sum +++ b/go.sum @@ -179,6 +179,8 @@ github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6 github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/bnb-chain/greenfield-cometbft v1.0.0 h1:0r6hOJWD/+es0gxP/exKuN/krgXAr3LCn5/XlcgDWr8= github.com/bnb-chain/greenfield-cometbft v1.0.0/go.mod h1:f35mk/r5ab6yvzlqEWZt68LfUje68sYgMpVlt2CUYMk= +github.com/bnb-chain/op-geth v0.4.4 h1:QlmQqp0NYssurJ9Im6NkpdgF8C3I1UUAAkEw7EyYLMQ= +github.com/bnb-chain/op-geth v0.4.4/go.mod h1:EHq3Fg681gI6u0Ey0OexTOS5xGYQuL7A7fSQIK1Jz2Q= 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= @@ -1428,8 +1430,6 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/redhdx/op-geth v0.1.3-0.20240801065049-0b6ea284e0a6 h1:D7AvHvNa9+pUSEq90nmxVq9pm3Z0jq3JcDFzousySQg= -github.com/redhdx/op-geth v0.1.3-0.20240801065049-0b6ea284e0a6/go.mod h1:EHq3Fg681gI6u0Ey0OexTOS5xGYQuL7A7fSQIK1Jz2Q= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=