Skip to content

Commit

Permalink
parallelize tests and add pathfinder response verification
Browse files Browse the repository at this point in the history
  • Loading branch information
pnowosie committed Nov 1, 2024
1 parent 6b52bbe commit 7252e10
Show file tree
Hide file tree
Showing 2 changed files with 359 additions and 45 deletions.
6 changes: 5 additions & 1 deletion core/trie/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ func VerifyProof(root *felt.Felt, key *Key, value *felt.Felt, proofs []ProofNode
remainingPath := NewKey(key.len, key.bitset[:])
for i, proofNode := range proofs {
if !proofNode.Hash(hash).Equal(expectedHash) {
proofHash := proofNode.Hash(hash)
fmt.Println("Proof verification failure", "node", proofHash, "expected", expectedHash)
fmt.Printf("%v\n", proofNode)

Check warning on line 326 in core/trie/proof.go

View check run for this annotation

Codecov / codecov/patch

core/trie/proof.go#L324-L326

Added lines #L324 - L326 were not covered by tests
return false
}

Expand All @@ -340,12 +343,13 @@ func VerifyProof(root *felt.Felt, key *Key, value *felt.Felt, proofs []ProofNode

// Todo:
// If we are verifying the key doesn't exist, then we should
// update.Status subKey to point in the other direction
// update subKey to point in the other direction
if value == nil && i == len(proofs)-1 {
return true
}

if !proofNode.Path.Equal(subKey) && !subKey.Equal(&Key{}) {
fmt.Println("Proof verification failure", "node", proofNode.Path, "expected", subKey)

Check warning on line 352 in core/trie/proof.go

View check run for this annotation

Codecov / codecov/patch

core/trie/proof.go#L352

Added line #L352 was not covered by tests
return false
}
expectedHash = proofNode.Child
Expand Down
Loading

0 comments on commit 7252e10

Please sign in to comment.