Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jsign committed Oct 25, 2024
1 parent 034a01c commit b738092
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,19 @@ 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())
}

// TODO(verkle): the right-hand side of the && is a workaround for an existing bug in EIP68000Transition
// test filling. When running these tests, geth decides when inserting some blocks that it is a side chain
// and the execution witness is lost. This is a workaround to avoid failing the tests until fixed.
if v.bc.Config().IsVerkle(header.Number, header.Time) && block.ExecutionWitness() != nil {
if v.bc.Config().IsVerkle(header.Number, header.Time) {
parent := v.bc.GetHeaderByNumber(header.Number.Uint64() - 1)
if parent == nil {
return fmt.Errorf("nil parent header for block %d", header.Number)
}
proot, stateDiff, proof, err := beacon.BuildVerkleProof(header, statedb, parent.Root)
stateDiff, proof, err := beacon.BuildVerkleProof(header, statedb, parent.Root)
if err != nil {
return fmt.Errorf("error building verkle proof: %w", err)
}
ew := types.ExecutionWitness{
StateDiff: stateDiff,
VerkleProof: proof,
ParentStateRoot: proot,
ParentStateRoot: parent.Root,
}
if err := ew.Equal(block.ExecutionWitness()); err != nil {
return fmt.Errorf("invalid execution witness: %v", err)
Expand Down

0 comments on commit b738092

Please sign in to comment.