Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions kurtosis/op-service/eth/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
package eth

import (
"context"
"encoding/json"
"log/slog"
"math/big"
"net/http"

"github.com/ethereum-optimism/optimism/op-service/client"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"math/big"
)

// L1ChainConfigByChainID returns the chain config for the given chain ID,
Expand All @@ -20,6 +27,7 @@ func L1ChainConfigByChainID(chainID ChainID) *params.ChainConfig {
case ChainIDFromBig(params.HoodiChainConfig.ChainID):
return params.HoodiChainConfig
default:
genesisTimestamp := getGenesis()
return &params.ChainConfig{
ChainID: chainID.ToBig(),
HomesteadBlock: big.NewInt(0),
Expand All @@ -43,14 +51,36 @@ func L1ChainConfigByChainID(chainID ChainID) *params.ChainConfig {
PragueTime: newUint64(0),
OsakaTime: newUint64(0),
BPO1Time: newUint64(0),
DepositContractAddress: common.HexToAddress("0x00000000219ab540356cbb839cbe05303d7705fa"),
// 2 epoch * 8 slot * 6 seconds
BPO2Time: newUint64(genesisTimestamp + 2*8*6),
DepositContractAddress: common.HexToAddress("0x00000000219ab540356cbb839cbe05303d7705fa"),
BlobScheduleConfig: &params.BlobScheduleConfig{
Cancun: params.DefaultCancunBlobConfig,
Prague: params.DefaultPragueBlobConfig,
Osaka: params.DefaultOsakaBlobConfig,
BPO1: params.DefaultBPO1BlobConfig,
BPO2: params.DefaultBPO2BlobConfig,
},
}
}
}

func newUint64(val uint64) *uint64 { return &val }

func getGenesis() uint64 {
logger := log.NewLogger(slog.Default().Handler())
cl := client.NewBasicHTTPClient("http://cl-1-lodestar-geth:4000", logger)
headers := http.Header{}
headers.Add("Accept", "application/json")

var genesisResp APIGenesisResponse
resp, err := cl.Get(context.Background(), "eth/v1/beacon/genesis", nil, headers)
if err != nil {
panic(err)
}
defer resp.Body.Close()
if err = json.NewDecoder(resp.Body).Decode(&genesisResp); err != nil {
panic(err)
}
return uint64(genesisResp.Data.GenesisTime)
}
8 changes: 4 additions & 4 deletions kurtosis/simple.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ optimism_package:
node0:
el:
type: op-geth
image: ""
image: "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101603.1"
log_level: ""
extra_env_vars: {}
extra_labels: {}
Expand Down Expand Up @@ -85,9 +85,9 @@ ethereum_package:
bpo_1_epoch: 0
bpo_1_max_blobs: 15
bpo_1_target_blobs: 10
#bpo_2_epoch: 0 # required to be bigger than bpo_1_epoch
#bpo_2_max_blobs: 21
#bpo_2_target_blobs: 14
bpo_2_epoch: 2 # required to be bigger than bpo_1_epoch
bpo_2_max_blobs: 21
bpo_2_target_blobs: 14
genesis_delay: 5
additional_preloaded_contracts: |
{
Expand Down