Skip to content

Commit

Permalink
set verkle mode from genesis with override (#308)
Browse files Browse the repository at this point in the history
* set verkle mode from genesis with override

* make linter happy

* fix more linter snafu
  • Loading branch information
gballet authored Jan 29, 2024
1 parent 8a07de6 commit 16737a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"encoding/json"
"errors"
"fmt"
"math/big"
"os"
"runtime"
"strconv"
Expand Down Expand Up @@ -215,7 +214,7 @@ func initGenesis(ctx *cli.Context) error {
}
triedb := trie.NewDatabaseWithConfig(chaindb, &trie.Config{
Preimages: ctx.Bool(utils.CachePreimagesFlag.Name),
Verkle: genesis.Config.IsPrague(big.NewInt(0), genesis.Timestamp),
Verkle: genesis.IsVerkle(),
})
_, hash, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides)
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 16737a7

Please sign in to comment.