fix: AvlTree ops map wrong-tree proofs and failed ops per the reference impl#890
Open
mwaddip wants to merge 2 commits into
Open
fix: AvlTree ops map wrong-tree proofs and failed ops per the reference impl#890mwaddip wants to merge 2 commits into
mwaddip wants to merge 2 commits into
Conversation
… verifier semantics The reference impl's verifier construction never throws: a proof that does not match the tree digest yields a verifier with no reconstructed tree, every op fails, and each method maps that per its own semantics (CErgoTreeEvaluator): contains → false (failed lookup); get/getMany → "Tree proof is incorrect" (and getMany with no keys returns the empty collection — no lookup runs); insert → raise pre-v3 / None from v3 (issue #908), None with no entries; update/remove → None (None digest). sigma-rust's BatchAVLVerifier::new instead errors at construction on the digest mismatch, and every method but insertOrUpdate (PR ergoplatform#886) propagated that as an eval error. Catch it per method; the op loops and digest inspection already mirrored the reference. Pinned by prover-built wrong-tree proof tests per method and the JVM-blessed byte vectors (santa-eval AvlTree.wrong_tree_proof contains-false/update-none/remove-none, AvlTree.insert_wrong_tree insert-none). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e the reference impl The reference impl's remove_eval loops with cfor — no break, no result check: a failed remove invalidates the verifier and the None digest decides the outcome (None). sigma-rust raised "Incorrect remove" at the first failed op, so a valid proof carrying ops that fail against it (e.g. removing a key the proof does not commit) errored where the JVM evaluates to None. Pinned by a valid-proof/mismatched-op test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BatchAVLVerifier::newerrors on a digest mismatch; every AvlTree method butinsertOrUpdate(#886) propagated that as an eval error. The reference verifier construction never throws (CErgoTreeEvaluator.scala): ops fail on the no-tree verifier and each method maps that itself —contains→ false (:89);get/getManyraise "Tree proof is incorrect" (:106/:126; no keys → empty coll);insertraises pre-v3, evals to None from v3 (#908 gate, :150; no entries → None);update/remove→ None (:183/:240).Second commit:
remove_evalloops withcfor— no break, op results ignored (:240–245) — so a valid proof carrying ops that fail against it evals to None (digest decides); we raised at the first failure.Pinned per arm by prover-built wrong-tree tests and JVM-blessed vectors.