Skip to content

Commit c25d492

Browse files
committed
core: remove genesis transition state writing
1 parent d4bea65 commit c25d492

File tree

3 files changed

+0
-33
lines changed

3 files changed

+0
-33
lines changed

core/chain_makers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
581581

582582
func GenerateVerkleChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int, gen func(int, *BlockGen)) (common.Hash, ethdb.Database, []*types.Block, []types.Receipts, []*verkle.VerkleProof, []verkle.StateDiff) {
583583
db := rawdb.NewMemoryDatabase()
584-
saveVerkleTransitionStatusAtVerlkeGenesis(db)
585584
cacheConfig := DefaultConfig().WithStateScheme(rawdb.PathScheme)
586585
cacheConfig.SnapshotLimit = 0
587586
triedb := triedb.NewDatabase(db, cacheConfig.triedbConfig(true))

core/genesis.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package core
1818

1919
import (
2020
"bytes"
21-
"encoding/gob"
2221
"encoding/json"
2322
"errors"
2423
"fmt"
@@ -28,7 +27,6 @@ import (
2827
"github.com/ethereum/go-ethereum/common"
2928
"github.com/ethereum/go-ethereum/common/hexutil"
3029
"github.com/ethereum/go-ethereum/common/math"
31-
"github.com/ethereum/go-ethereum/core/overlay"
3230
"github.com/ethereum/go-ethereum/core/rawdb"
3331
"github.com/ethereum/go-ethereum/core/state"
3432
"github.com/ethereum/go-ethereum/core/tracing"
@@ -147,9 +145,6 @@ func hashAlloc(ga *types.GenesisAlloc, isVerkle bool) (common.Hash, error) {
147145
emptyRoot = types.EmptyVerkleHash
148146
}
149147
db := rawdb.NewMemoryDatabase()
150-
if isVerkle {
151-
saveVerkleTransitionStatusAtVerlkeGenesis(db)
152-
}
153148
statedb, err := state.New(emptyRoot, state.NewDatabase(triedb.NewDatabase(db, config), nil))
154149
if err != nil {
155150
return common.Hash{}, err
@@ -281,24 +276,6 @@ func (o *ChainOverrides) apply(cfg *params.ChainConfig) error {
281276
return cfg.CheckConfigForkOrder()
282277
}
283278

284-
// saveVerkleTransitionStatusAtVerlkeGenesis saves a conversion marker
285-
// representing a converted state, which is used in devnets that activate
286-
// verkle at genesis.
287-
func saveVerkleTransitionStatusAtVerlkeGenesis(db ethdb.Database) {
288-
saveVerkleTransitionStatus(db, common.Hash{}, &overlay.TransitionState{Ended: true})
289-
}
290-
291-
func saveVerkleTransitionStatus(db ethdb.Database, root common.Hash, ts *overlay.TransitionState) {
292-
var buf bytes.Buffer
293-
enc := gob.NewEncoder(&buf)
294-
err := enc.Encode(ts)
295-
if err != nil {
296-
log.Error("failed to encode transition state", "err", err)
297-
return
298-
}
299-
rawdb.WriteVerkleTransitionState(db, root, buf.Bytes())
300-
}
301-
302279
// SetupGenesisBlock writes or updates the genesis block in db.
303280
// The block that will be used is:
304281
//
@@ -322,11 +299,6 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, g
322299
if genesis != nil && genesis.Config == nil {
323300
return nil, common.Hash{}, nil, errGenesisNoConfig
324301
}
325-
// In case of verkle-at-genesis, we need to ensure that the conversion
326-
// markers are indicating that the conversion has completed.
327-
if genesis != nil && genesis.Config.VerkleTime != nil && *genesis.Config.VerkleTime == genesis.Timestamp {
328-
saveVerkleTransitionStatusAtVerlkeGenesis(db)
329-
}
330302
// Commit the genesis if the database is empty
331303
ghash := rawdb.ReadCanonicalHash(db, 0)
332304
if (ghash == common.Hash{}) {
@@ -578,9 +550,6 @@ func (g *Genesis) Commit(db ethdb.Database, triedb *triedb.Database) (*types.Blo
578550
if err != nil {
579551
return nil, err
580552
}
581-
if g.IsVerkle() {
582-
saveVerkleTransitionStatus(db, block.Root(), &overlay.TransitionState{Ended: true})
583-
}
584553
batch := db.NewBatch()
585554
rawdb.WriteGenesisStateSpec(batch, block.Hash(), blob)
586555
rawdb.WriteBlock(batch, block)

core/genesis_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ func TestVerkleGenesisCommit(t *testing.T) {
314314
}
315315

316316
db := rawdb.NewMemoryDatabase()
317-
saveVerkleTransitionStatusAtVerlkeGenesis(db)
318317
config := *pathdb.Defaults
319318
config.NoAsyncFlush = true
320319

0 commit comments

Comments
 (0)