Skip to content

Commit b2f5213

Browse files
committed
Fix consensus/execution split follower node genesis mismatch
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
1 parent 7ed45eb commit b2f5213

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

cmd/nitro/init/init.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -643,16 +643,10 @@ func OpenInitializeExecutionDB(ctx context.Context, consensusNodeEnabled bool, s
643643
}
644644
} else {
645645
// TODO: What should parsedInitMessage be here? Or how should consensus provide such info to execution?
646-
serializedChainConfig, err := json.Marshal(chainConfig)
646+
parsedInitMessage, err = GetConsensusParsedInitMsg(ctx, true, chainId, l1Client, &rollupAddrs, chainConfig)
647647
if err != nil {
648648
return executionDB, nil, nil, err
649649
}
650-
parsedInitMessage = &arbostypes.ParsedInitMessage{
651-
ChainId: chainConfig.ChainID,
652-
InitialL1BaseFee: arbostypes.DefaultInitialL1BaseFee,
653-
ChainConfig: chainConfig,
654-
SerializedChainConfig: serializedChainConfig,
655-
}
656650
}
657651

658652
l2BlockChain, err = getNewBlockchain(parsedInitMessage, config, initDataReader, chainConfig, genesisArbOSInit, executionDB, cacheConfig, tracer)

cmd/nitro/init/init_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ func TestOpenInitializeExecutionDBIncompatibleStateScheme(t *testing.T) {
441441
// opening for the first time doesn't error
442442
executionDB, _, blockchain, err := OpenInitializeExecutionDB(
443443
ctx,
444+
true,
444445
stack,
445446
&nodeConfig,
446447
new(big.Int).SetUint64(nodeConfig.Chain.ID),
@@ -458,6 +459,7 @@ func TestOpenInitializeExecutionDBIncompatibleStateScheme(t *testing.T) {
458459
// opening for the second time doesn't error
459460
executionDB, _, blockchain, err = OpenInitializeExecutionDB(
460461
ctx,
462+
true,
461463
stack,
462464
&nodeConfig,
463465
new(big.Int).SetUint64(nodeConfig.Chain.ID),
@@ -476,6 +478,7 @@ func TestOpenInitializeExecutionDBIncompatibleStateScheme(t *testing.T) {
476478
nodeConfig.Execution.Caching.StateScheme = rawdb.HashScheme
477479
_, _, _, err = OpenInitializeExecutionDB(
478480
ctx,
481+
true,
479482
stack,
480483
&nodeConfig,
481484
new(big.Int).SetUint64(nodeConfig.Chain.ID),
@@ -704,6 +707,7 @@ func TestOpenInitializeExecutionDbEmptyInit(t *testing.T) {
704707

705708
executionDB, _, blockchain, err := OpenInitializeExecutionDB(
706709
ctx,
710+
true,
707711
stack,
708712
&nodeConfig,
709713
new(big.Int).SetUint64(nodeConfig.Chain.ID),
@@ -1059,6 +1063,7 @@ func getInitHelper(t *testing.T, ownerAdress string, chainID uint64, emptyState
10591063

10601064
executionDB, _, _, err := OpenInitializeExecutionDB(
10611065
ctx,
1066+
true,
10621067
stack,
10631068
&nodeConfig,
10641069
new(big.Int).SetUint64(nodeConfig.Chain.ID),

cmd/nitro/nitro.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,13 @@ func mainImpl() int {
314314

315315
log.Info("connected to l1 chain", "l1url", nodeConfig.ParentChain.Connection.URL, "l1chainid", nodeConfig.ParentChain.ID)
316316

317-
if consensusNodeEnabled {
318-
rollupAddrs, err = chaininfo.GetRollupAddressesConfig(nodeConfig.Chain.ID, nodeConfig.Chain.Name, nodeConfig.Chain.InfoFiles, nodeConfig.Chain.InfoJson)
319-
if err != nil {
320-
log.Crit("error getting rollup addresses", "err", err)
321-
}
317+
// TODO: do we need rollupAddrs for execution node? We seem to need it for initialzing chainConfig
318+
// if consensusNodeEnabled {
319+
rollupAddrs, err = chaininfo.GetRollupAddressesConfig(nodeConfig.Chain.ID, nodeConfig.Chain.Name, nodeConfig.Chain.InfoFiles, nodeConfig.Chain.InfoJson)
320+
if err != nil {
321+
log.Crit("error getting rollup addresses", "err", err)
322322
}
323+
// }
323324
arbSys, _ := precompilesgen.NewArbSys(types.ArbSysAddress, l1Client)
324325
l1Reader, err = headerreader.New(ctx, l1Client, func() *headerreader.Config { return &liveNodeConfig.Get().Node.ParentChainReader }, arbSys)
325326
if err != nil {

0 commit comments

Comments
 (0)