Skip to content

Commit

Permalink
gracefully fails if provided state scheme is incompatible with stored…
Browse files Browse the repository at this point in the history
… trie
  • Loading branch information
diegoximenes committed May 20, 2024
1 parent 05f0b56 commit 298612f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/nitro/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo
return nil, nil, err
}
chainDb := rawdb.WrapDatabaseWithWasm(chainData, wasmDb)
_, err = rawdb.ParseStateScheme(cacheConfig.StateScheme, chainDb)
if err != nil {
return nil, nil, err
}
err = pruning.PruneChainDb(ctx, chainDb, stack, &config.Init, cacheConfig, l1Client, rollupAddrs, config.Node.ValidatorRequired())
if err != nil {
return chainDb, nil, fmt.Errorf("error pruning: %w", err)
Expand Down Expand Up @@ -244,6 +248,10 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo
return nil, nil, err
}
chainDb := rawdb.WrapDatabaseWithWasm(chainData, wasmDb)
_, err = rawdb.ParseStateScheme(cacheConfig.StateScheme, chainDb)
if err != nil {
return nil, nil, err
}

if config.Init.ImportFile != "" {
initDataReader, err = statetransfer.NewJsonInitDataReader(config.Init.ImportFile)
Expand Down

0 comments on commit 298612f

Please sign in to comment.