IntersectMBO / IntersectMBO/mithril

Add the missing conversion and error-path tests in `ivc_halo2_snark`

Open
#3,470 0 comments 0 reactions 0 assignees View on GitHub
cryptography :closed_lock_with_key: testing :repeat: to-groom :thinking:
Dominant language
Rust
Stars
154
Forks
51
Avg merge
1d 23h
Merged PRs (30d)
38

Description

## Why

Several conversions and error paths of the IVC proof system have no direct tests, and the existing rejection tests assert rejection without checking which error was produced.

## What

Add direct unit tests for the untested conversions and make the rejection tests assert the specific error.

## How

Paths are relative to `mithril-stm/src/`.

- [ ] `IvcGenesisBootstrapInput::try_from(&AncillaryGenesisData)` (`proof_system/ivc_halo2_snark/proof.rs`): happy path plus both error paths (absent genesis Schnorr signature, preimage not exactly `PREIMAGE_SIZE` bytes)
- [ ] `SnarkProof::into_circuit_proof_bytes` (`proof_system/halo2_snark/proof.rs`) and the `IvcCircuitData::try_new` hand-off (`circuits/halo2_ivc/circuit.rs`)
- [ ] `IvcVerifierSetup::from_ivc_setup` (`proof_system/ivc_halo2_snark/verifier_setup.rs`) and the `IvcVerifierData` accessors
- [ ] Make the fast rejection tests of `proof_system/ivc_halo2_snark/proof.rs` assert the specific `IvcProofError` variant (`errors.rs`: `TranscriptPreparationFailed`, `TranscriptNotFullyConsumed`, `KzgOpeningFailed`, `AccumulatorFailed`, `InvalidMessage`) by downcasting the returned error instead of only checking rejection:
- [ ] `ivc_proof_verify_rejects_wrong_message`
- [ ] `ivc_proof_verify_rejects_tampered_proof_bytes`
- [ ] `ivc_proof_verify_rejects_tampered_message_bytes_with_correct_input_message`
- [ ] `ivc_proof_verify_rejects_tampered_message_bytes_with_tampered_input_message`
- [ ] `ivc_proof_verify_rejects_mismatched_state`
- [ ] `ivc_proof_verify_rejects_mismatched_accumulator`
- [ ] `ivc_proof_verify_rejects_poseidon_proof_bytes`
- [ ] `ivc_proof_verify_rejects_wrong_fixed_bases`
- [ ] Assess the gain (expected: added coverage of the missing conversions and error paths) and report it in the issue

Contributor guide

Open the contributing guide

Research direction

Start with the listed proof.rs, circuit.rs, verifier_setup.rs, and errors.rs paths, then read the existing conversion and rejection tests in ivc_halo2_snark. Add direct coverage for the named conversions and error variants, and finish by reporting the added coverage for the missing conversions and error paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.