From c229a567b5b67af175068e94093e3e2a054c9207 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 25 Oct 2024 11:26:01 -0300 Subject: [PATCH] fixes Signed-off-by: Ignacio Hagopian --- core/block_validator.go | 4 ++-- core/state_processor_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/block_validator.go b/core/block_validator.go index e45c6e3134af..8f8b013cadbe 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -133,7 +133,7 @@ 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 v.bc.Config().IsVerkle(header.Number, header.Time) { + if blockEw := block.ExecutionWitness(); blockEw != nil && 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) @@ -147,7 +147,7 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD VerkleProof: proof, ParentStateRoot: parent.Root, } - if err := ew.Equal(block.ExecutionWitness()); err != nil { + if err := ew.Equal(blockEw); err != nil { return fmt.Errorf("invalid execution witness: %v", err) } } diff --git a/core/state_processor_test.go b/core/state_processor_test.go index d8f596d7836f..359d6e08f7e4 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -609,7 +609,7 @@ func TestProcessVerkle(t *testing.T) { //fmt.Printf("root= %x\n", chain[0].Root()) // check the proof for the 1st block - err = trie.DeserializeAndVerifyVerkleProof(proofs[0], genesis.Root().Bytes(), chain[0].Root().Bytes(), keyvals[0]) + err = verkle.Verify(proofs[0], genesis.Root().Bytes(), chain[0].Root().Bytes(), keyvals[0]) if err != nil { spew.Dump(genesis.Root().Bytes(), proofs[0]) t.Fatal(err)