Skip to content

Commit

Permalink
generate parentRoot for witness check
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Oct 24, 2024
1 parent 0406d61 commit a588006
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
receipts = make(types.Receipts, 0)
txIndex = 0
)
parentRoot := statedb.GetTrie().Hash()

gaspool.AddGas(pre.Env.GasLimit)
vmContext := vm.BlockContext{
CanTransfer: core.CanTransfer,
Expand Down Expand Up @@ -392,7 +394,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
BaseFee: (*math.HexOrDecimal256)(vmContext.BaseFee),
VerkleProof: vktProof,
StateDiff: vktStateDiff,
ParentRoot: pre.Env.BlockHashes[math.HexOrDecimal64(pre.Env.Number-1)],
ParentRoot: parentRoot,
}
if pre.Env.Withdrawals != nil {
h := types.DeriveSha(types.Withdrawals(pre.Env.Withdrawals), trie.NewStackTrie(nil))
Expand Down Expand Up @@ -453,7 +455,9 @@ func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prest
codeHash := crypto.Keccak256Hash(acc.Code)
rawdb.WriteCode(codeWriter, codeHash, acc.Code)
}
statedb.Commit(0, false)
if _, err := statedb.Commit(0, false); err != nil {
panic(err)
}

return statedb
}
Expand Down

0 comments on commit a588006

Please sign in to comment.