Skip to content

Commit c72c2a1

Browse files
committed
support dynamic fork timestamp
1 parent 6b64620 commit c72c2a1

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

kurtosis/op-service/eth/config.go

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
package eth
22

33
import (
4+
"context"
5+
"encoding/json"
6+
"log/slog"
7+
"math/big"
8+
"net/http"
9+
10+
"github.com/ethereum-optimism/optimism/op-service/client"
411
"github.com/ethereum/go-ethereum/common"
12+
"github.com/ethereum/go-ethereum/log"
513
"github.com/ethereum/go-ethereum/params"
6-
"math/big"
714
)
815

916
// L1ChainConfigByChainID returns the chain config for the given chain ID,
@@ -20,6 +27,7 @@ func L1ChainConfigByChainID(chainID ChainID) *params.ChainConfig {
2027
case ChainIDFromBig(params.HoodiChainConfig.ChainID):
2128
return params.HoodiChainConfig
2229
default:
30+
genesisTimestamp := getGenesis()
2331
return &params.ChainConfig{
2432
ChainID: chainID.ToBig(),
2533
HomesteadBlock: big.NewInt(0),
@@ -43,14 +51,36 @@ func L1ChainConfigByChainID(chainID ChainID) *params.ChainConfig {
4351
PragueTime: newUint64(0),
4452
OsakaTime: newUint64(0),
4553
BPO1Time: newUint64(0),
46-
DepositContractAddress: common.HexToAddress("0x00000000219ab540356cbb839cbe05303d7705fa"),
54+
// 2 epoch * 8 slot * 6 seconds
55+
BPO2Time: newUint64(genesisTimestamp + 2*8*6),
56+
DepositContractAddress: common.HexToAddress("0x00000000219ab540356cbb839cbe05303d7705fa"),
4757
BlobScheduleConfig: &params.BlobScheduleConfig{
4858
Cancun: params.DefaultCancunBlobConfig,
4959
Prague: params.DefaultPragueBlobConfig,
5060
Osaka: params.DefaultOsakaBlobConfig,
5161
BPO1: params.DefaultBPO1BlobConfig,
62+
BPO2: params.DefaultBPO2BlobConfig,
5263
},
5364
}
5465
}
5566
}
67+
5668
func newUint64(val uint64) *uint64 { return &val }
69+
70+
func getGenesis() uint64 {
71+
logger := log.NewLogger(slog.Default().Handler())
72+
cl := client.NewBasicHTTPClient("http://cl-1-lodestar-geth:4000", logger)
73+
headers := http.Header{}
74+
headers.Add("Accept", "application/json")
75+
76+
var genesisResp APIGenesisResponse
77+
resp, err := cl.Get(context.Background(), "eth/v1/beacon/genesis", nil, headers)
78+
if err != nil {
79+
panic(err)
80+
}
81+
defer resp.Body.Close()
82+
if err = json.NewDecoder(resp.Body).Decode(&genesisResp); err != nil {
83+
panic(err)
84+
}
85+
return uint64(genesisResp.Data.GenesisTime)
86+
}

kurtosis/simple.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ optimism_package:
88
node0:
99
el:
1010
type: op-geth
11-
image: ""
11+
image: "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101603.1"
1212
log_level: ""
1313
extra_env_vars: {}
1414
extra_labels: {}
@@ -85,9 +85,9 @@ ethereum_package:
8585
bpo_1_epoch: 0
8686
bpo_1_max_blobs: 15
8787
bpo_1_target_blobs: 10
88-
#bpo_2_epoch: 0 # required to be bigger than bpo_1_epoch
89-
#bpo_2_max_blobs: 21
90-
#bpo_2_target_blobs: 14
88+
bpo_2_epoch: 2 # required to be bigger than bpo_1_epoch
89+
bpo_2_max_blobs: 21
90+
bpo_2_target_blobs: 14
9191
genesis_delay: 5
9292
additional_preloaded_contracts: |
9393
{

0 commit comments

Comments
 (0)