Skip to content

Commit

Permalink
fix: same thing but with the engine api
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Jan 11, 2025
1 parent 600b48c commit baa2caf
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/utils"
"github.com/ethereum/go-verkle"
)

Expand Down Expand Up @@ -152,7 +153,20 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
return fmt.Errorf("invalid merkle root (remote: %x local: %x) dberr: %w", header.Root, root, statedb.Error())
}
if blockEw := block.ExecutionWitness(); blockEw != nil {
err := trie.AddPostValuesToProof(statedb.GetTrie().(*trie.VerkleTrie), proof)
tr := statedb.GetTrie()
var vtr *trie.VerkleTrie
switch pre := tr.(type) {
case *trie.VerkleTrie:
vtr = pre
case *trie.TransitionTrie:
vtr = pre.Overlay()
default:
// This should only happen for the first block of the
// conversion, when the previous tree is a merkle tree.
// Logically, the "previous" verkle tree is an empty tree.
vtr = trie.NewVerkleTrie(verkle.New(), statedb.Database().TrieDB(), utils.NewPointCache(), false)
}
err := trie.AddPostValuesToProof(vtr, proof)
if err != nil {
return fmt.Errorf("error adding post values to proof: %w", err)
}
Expand Down

0 comments on commit baa2caf

Please sign in to comment.