Skip to content

Commit

Permalink
fix: add baseRoot to InitTransitionStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed May 15, 2024
1 parent 2c7b045 commit b157a5f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prest
if pre.Env.Started != nil {
log.Info("non-nil started", "started", *pre.Env.Started)
}
sdb.InitTransitionStatus(pre.Env.Started != nil && *pre.Env.Started, pre.Env.Ended != nil && *pre.Env.Ended)
sdb.InitTransitionStatus(pre.Env.Started != nil && *pre.Env.Started, pre.Env.Ended != nil && *pre.Env.Ended, mptRoot)
log.Info("loading current account address, if available", "available", pre.Env.CurrentAccountAddress != nil)
if pre.Env.CurrentAccountAddress != nil {
log.Info("loading current account address", "address", *pre.Env.CurrentAccountAddress)
Expand Down
4 changes: 2 additions & 2 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
// for it to be able to recover if interrupted during the transition
// but that's left out to a later PR since there's not really a need
// right now.
bc.stateCache.InitTransitionStatus(true, true)
bc.stateCache.InitTransitionStatus(true, true, common.Hash{})
bc.stateCache.EndVerkleTransition()
}

Expand Down Expand Up @@ -1772,7 +1772,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
// If the verkle activation time hasn't started, declare it as "not started".
// This is so that if the miner activates the conversion, the insertion happens
// in the correct mode.
bc.stateCache.InitTransitionStatus(false, false)
bc.stateCache.InitTransitionStatus(false, false, common.Hash{})
}
if parent.Number.Uint64() == conversionBlock {
bc.StartVerkleTransition(parent.Root, emptyVerkleRoot, bc.Config(), &parent.Time, parent.Root)
Expand Down
5 changes: 3 additions & 2 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type Database interface {

Transitioned() bool

InitTransitionStatus(bool, bool)
InitTransitionStatus(bool, bool, common.Hash)

SetCurrentSlotHash(common.Hash)

Expand Down Expand Up @@ -245,12 +245,13 @@ func (db *cachingDB) ReorgThroughVerkleTransition() {
log.Warn("trying to reorg through the transition, which makes no sense at this point")
}

func (db *cachingDB) InitTransitionStatus(started, ended bool) {
func (db *cachingDB) InitTransitionStatus(started, ended bool, baseRoot common.Hash) {
db.CurrentTransitionState = &TransitionState{
Ended: ended,
Started: started,
// TODO add other fields when we handle mid-transition interrupts
}
db.baseRoot = baseRoot
}

func (db *cachingDB) EndVerkleTransition() {
Expand Down
2 changes: 1 addition & 1 deletion light/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (db *odrDatabase) Transitioned() bool {
panic("not implemented") // TODO: Implement
}

func (db *odrDatabase) InitTransitionStatus(bool, bool) {
func (db *odrDatabase) InitTransitionStatus(bool, bool, common.Hash) {
panic("not implemented") // TODO: Implement
}

Expand Down

0 comments on commit b157a5f

Please sign in to comment.