Skip to content

test: AvlTree degenerate-input eval regressions (pairs with ergo_avltree_rust#14)#892

Draft
mwaddip wants to merge 3 commits into
ergoplatform:developfrom
mwaddip:fix/avltree-degenerate-input
Draft

test: AvlTree degenerate-input eval regressions (pairs with ergo_avltree_rust#14)#892
mwaddip wants to merge 3 commits into
ergoplatform:developfrom
mwaddip:fix/avltree-degenerate-input

Conversation

@mwaddip

@mwaddip mwaddip commented Jun 7, 2026

Copy link
Copy Markdown

Draft. Eval-layer regression tests for the F4 AvlTree degenerate-input family (SANTA conformance): garbage/unparseable proof bytes and a wrapped-negative key length.

Merge together with ergoplatform/ergo_avltree_rust#14 (the producer fix). The verifier crate currently panics on these inputs; #14 makes it return Err, mirroring the reference scorex verifier's Try-wrapped reconstruction. With that fix, these inputs route through the wrong-tree-proof arms (contains→false, get→raise) instead of crashing the evaluator.

Blocked on #14's release + version bump — the tests are #[ignore]d until then (validated locally via [patch.crates-io]).

Stacked on #890 (the wrong-tree-proof arms); merge #890 first. The negative-keyLength cost adjustment is cost-only (#876 / eni), not here.

mwaddip and others added 3 commits June 7, 2026 16:20
… 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>
… proof, bad keyLength)

Pin the eval-layer behavior for the F4 degenerate-input family: garbage/
unparseable proof bytes and a wrapped-negative key length must route through the
wrong-tree-proof arms (contains -> false, get -> raise) once the verifier crate
returns an error instead of panicking — rather than crashing the evaluator.

The tests are #[ignore]d: they require ergo_avltree_rust with the no-panic fix
(ergoplatform/ergo_avltree_rust#14), which is not yet released. Un-ignore on its
release + version bump. The op-level wrong-value-length mode (santa-eval
AvlTree.per_op_failure) is covered crate-side in ergoplatform#14 and routes like the existing
insert-bad-proof test once the op returns Err.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant