test(stm): add property tests for the IVC pure helpers - #3535
Draft
hjeljeli32 wants to merge 11 commits into
Draft
test(stm): add property tests for the IVC pure helpers#3535hjeljeli32 wants to merge 11 commits into
hjeljeli32 wants to merge 11 commits into
Conversation
…he examples they subsume
…rce under both transitions
Test Results 5 files ± 0 221 suites ±0 1h 38m 34s ⏱️ - 1m 22s Results for commit 87759ab. ± Comparison against base commit cccb650. This pull request removes 44 and adds 20 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
hjeljeli32
force-pushed
the
hjeljeli32/3469-ivc-helper-property-tests
branch
from
September 11, 2026 08:26
f4232ce to
87759ab
Compare
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.
Content
proptestis established inhalo2_snarkbut absent fromhalo2_ivc_snark, whose helpers and hand-written codecs are covered by examples driven by single fixtures that hide what the helper could get wrong: every rigid-preimage test runs on a zero aggregate key root with stake 1 and epoch 42, so seven of eight bytes in each integer slot are zero. This adds twelve properties across seven helpers, retires twelve examples a property subsumes, and costs 7.0 to 7.4 ms per property at 100 cases — some 6.9 ms of that process launch, so a few milliseconds inside the shared fast-tier process.The properties found four defects in the two byte decoders, all fixed here because each fix turned out small: one commit apiece, directly after the test that found it. Nothing is left ignored.
Changes
io.rs,aggregate_key.rs): mismatched point and scalar counts are rejected before reaching a constructor that asserts they agree; a fixed-base key length is read throughtakeinto a growing buffer, so an overstated prefix cannot size an allocation; a truncated point payload is gathered withread_exactfirst, usingbyte_length::<EmulatedCurve>(format)so no width is hardcoded and point validation is unchanged; and the legacy aggregate key decoder constructs its commitment directly instead of asking it to re-detect a format already classified, which had let a CBOR-shaped root decode to an empty one.io.rs,types.rs,aggregate_key.rs): MSM and accumulator round trips preserve every component over arbitrary counts and key strings and consume the whole encoding; each preimage accessor equals the direct decode of its own range and ignores everything outside it; legacy aggregate keys survive the CBOR round trip on both paths, the fallback property constraining the byte after the version prefix since the prefix only selects the branch.protocol_message.rs,tests/encoding/positive.rs): all 190 bytes match expectations computed from the generated inputs, and the same array decodes back through the accessors, with the dynamic digest recomputed independently so the builder is not its own oracle. A deterministic test pins the range constants to literal ranges, which the accessor properties cannot do because they index through them.prover_input_helpers.rs,rolling_state.rs): each next-state field equals its declared source under both transition types on the same tuple; the epoch relation selects same-epoch, next-epoch and both gap directions with typed payloads; the promotion guard rejects exactly the combinations where all three of its conditions hold.u64epochs are equal or adjacent with probability about 2⁻⁶⁴, and a nonzero step counter almost never lands on 1, so every boundary deciding a branch is forced — including a parameter pair sharing all but its last byte, which a comparison narrowed to the low 64 bits would call equal.tests/encoding/positive.rs,prover_input_helpers.rs): twelve single-fixture examples a property now covers over a value space, plus four helpers left without callers. The dynamic-digest example is kept — its 64-character hex value is the shape production sends, guaranteed every run rather than sampled.read_raw_uncheckedcarries a second panic on the decode result. The allocation fix has no test observing allocation — the old code returned the same error once its allocation succeeded — so that rests on inspection.Pre-submit checklist
Comments
Draft: seven of the helpers on the issue are covered, the rest follow.
Issue(s)
Relates to #3469