Skip to content

Commit

Permalink
verify proof before returning it
Browse files Browse the repository at this point in the history
  • Loading branch information
antonis19 committed Jan 16, 2025
1 parent d044cdb commit a7b614f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions turbo/jsonrpc/eth_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,20 @@ func (api *APIImpl) getProof(ctx context.Context, address libcommon.Address, sto
}
}

// Verify proofs before returning result to the user
err = trie.VerifyAccountProof(header.Root, proof)
if err != nil {
return nil, fmt.Errorf("internal error: failed to verify account proof for generated proof : %w", err)
}

// verify storage proofs
for _, storageProof := range proof.StorageProof {
err = trie.VerifyStorageProof(proof.StorageHash, storageProof)
if err != nil {
return nil, fmt.Errorf("internal error: failed to verify storage proof for key=%x , proof=%+v : %w", storageProof.Key.Bytes(), proof, err)
}
}

return proof, nil
}

Expand Down

0 comments on commit a7b614f

Please sign in to comment.