From beb2b95ff82c8f510709f27bc037940e59a31001 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:23:02 +0100 Subject: [PATCH] set verkle mode from genesis with override --- cmd/geth/chaincmd.go | 2 +- core/genesis.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 55c22f7322f3..2179b61032b6 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -214,7 +214,7 @@ func initGenesis(ctx *cli.Context) error { } triedb := trie.NewDatabaseWithConfig(chaindb, &trie.Config{ Preimages: ctx.Bool(utils.CachePreimagesFlag.Name), - Verkle: true, + Verkle: genesis.IsVerkle(), }) _, hash, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides) if err != nil { diff --git a/core/genesis.go b/core/genesis.go index 74294afb7272..e6874039f2e2 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -456,6 +456,12 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { } } +// IsVerkle indicates whether the state is already stored in a verkle +// tree at genesis time. +func (g *Genesis) IsVerkle() bool { + return g.Config.IsPrague(new(big.Int).SetUint64(g.Number), g.Timestamp) +} + // ToBlock returns the genesis block according to genesis specification. func (g *Genesis) ToBlock() *types.Block { root, err := g.Alloc.deriveHash(g.Config, g.Timestamp)