From 0961f6f8962418c2c1d48ec8a82ecb039e91e61d Mon Sep 17 00:00:00 2001 From: Juraj Piar Date: Fri, 16 Feb 2024 10:45:42 +0000 Subject: [PATCH] feat(devnet): removes genesis hash computation Using a singleton that retreives it from the RSK node --- op-chain-ops/genesis/config.go | 5 +++-- op-node/cmd/genesis/cmd.go | 4 +++- ops-bedrock/docker-compose.yml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/op-chain-ops/genesis/config.go b/op-chain-ops/genesis/config.go index 90d40bc02bc53..709ace178d612 100644 --- a/op-chain-ops/genesis/config.go +++ b/op-chain-ops/genesis/config.go @@ -17,6 +17,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/rsk_utils" "github.com/ethereum-optimism/optimism/op-bindings/hardhat" "github.com/ethereum-optimism/optimism/op-bindings/predeploys" @@ -534,7 +535,7 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas return &rollup.Config{ Genesis: rollup.Genesis{ L1: eth.BlockID{ - Hash: l1StartBlock.Hash(), + Hash: rsk_utils.GetRskBlockHeader().Hash(), Number: l1StartBlock.NumberU64(), }, L2: eth.BlockID{ @@ -842,7 +843,7 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage "number": block.Number(), "timestamp": block.Time(), "basefee": big.NewInt(1), //block.BaseFee(), - "hash": block.Hash(), + "hash": rsk_utils.GetRskBlockHeader(), "sequenceNumber": 0, "batcherHash": eth.AddressAsLeftPaddedHash(config.BatchSenderAddress), "l1FeeOverhead": config.GasPriceOracleOverhead, diff --git a/op-node/cmd/genesis/cmd.go b/op-node/cmd/genesis/cmd.go index 178abb92ae348..ad17d905b38db 100644 --- a/op-node/cmd/genesis/cmd.go +++ b/op-node/cmd/genesis/cmd.go @@ -17,6 +17,7 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/rsk_utils" "github.com/ethereum-optimism/optimism/op-bindings/hardhat" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis" @@ -232,7 +233,8 @@ var Subcommands = cli.Commands{ return err } - log.Info("Using L1 Start Block", "number", l1StartBlock.Number(), "hash", l1StartBlock.Hash().Hex()) + rskHeader := rsk_utils.GetRskBlockHeader() + log.Info("Using L1 Start Block", "number", l1StartBlock.Number(), "hash", rskHeader.Hash().Hex()) // Build the L2 genesis block l2Genesis, err := genesis.BuildL2Genesis(config, l1StartBlock) diff --git a/ops-bedrock/docker-compose.yml b/ops-bedrock/docker-compose.yml index fe60734337d74..c0cb3d720cc61 100644 --- a/ops-bedrock/docker-compose.yml +++ b/ops-bedrock/docker-compose.yml @@ -101,6 +101,7 @@ services: --metrics.port=7300 --pprof.enabled --rpc.enable-admin + --l1.trustrpc ports: - "7545:8545" - "9003:9003"