Skip to content

Conversation

@curiecrypt
Copy link
Collaborator

Content

This PR includes lottery target value computation for snark proof system.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)
    • Add dev blog post (if relevant)
    • Add ADR blog post or Dev ADR entry (if relevant)
    • No new TODOs introduced

Comments

A new sub-module lottery is added under protocol module.
lottery only includes the snark_eligibility. Eligibility check for concatenation proof will be moved to this sub-module later.

Issue(s)

Relates to #2792

@curiecrypt curiecrypt force-pushed the curiecrypt/msnark/phase1-target-value branch from e2e6a9e to 1160cc5 Compare January 26, 2026 18:04
@github-actions
Copy link

Test Results

    4 files   -   1    169 suites   - 3   23m 42s ⏱️ - 8m 17s
2 320 tests  - 104  2 320 ✅  - 104  0 💤 ±0  0 ❌ ±0 
7 394 runs   - 151  7 394 ✅  - 151  0 💤 ±0  0 ❌ ±0 

Results for commit 1160cc5. ± Comparison against base commit 376235c.

This pull request removes 105 and adds 1 tests. Note that renamed tests count towards both.
mithril-stm ‑ circuits::halo2::circuit::certificate::tests::test_certificate_medium
mithril-stm ‑ circuits::halo2::circuit::certificate::tests::test_certificate_small
mithril-stm ‑ circuits::halo2::off_circuit::merkle_tree::tests::test_merkle_path_generation
mithril-stm ‑ circuits::halo2::off_circuit::merkle_tree::tests::test_merkle_path_verification
mithril-stm ‑ circuits::halo2::off_circuit::merkle_tree::tests::test_merkle_tree_creation
mithril-stm ‑ circuits::halo2::off_circuit::unique_signature::tests::test_signature_unique_long_verification_valid
mithril-stm ‑ circuits::halo2::off_circuit::unique_signature::tests::test_signature_unique_verification_invalid_signature
mithril-stm ‑ circuits::halo2::off_circuit::unique_signature::tests::test_signature_unique_verification_valid
mithril-stm ‑ circuits::halo2::off_circuit::utils::tests::test_bytes
mithril-stm ‑ circuits::halo2::off_circuit::utils::tests::test_decompose
…
mithril-stm ‑ membership_commitment::merkle_tree::leaf::tests::golden_json::golden_conversions

let w = Float::with_val(117, stake) / Float::with_val(117, total_stake);
let phi = Float::with_val(117, 1.0) - Float::with_val(117, 1.0 - phi_f).pow(w);
// increase precision
let phi_high = Float::with_val(300, phi);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can phi_high really have a precision of 300 if phi has a precision of 100 (I do not know how this work)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked, and float (such as f64) should be deterministic, not sure about Float though.

) -> StmResult<LotteryTargetValue> {
// modulus - 1
let ev_max = -BaseFieldElement::get_one();
if !(0.0..=1.0).contains(&phi_f) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this remove 0?

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.

3 participants