Skip to content

Fix BLST bindings: Error handling for infinite values of sigs and vks #2322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 12, 2025

Conversation

curiecrypt
Copy link
Collaborator

@curiecrypt curiecrypt commented Feb 19, 2025

Content

If there is any identity element in the following vectors:

let transmuted_vks: Vec<blst_p2> = vks.iter().map(vk_from_p2_affine).collect();
let transmuted_sigs: Vec<blst_p1> = signatures.iter().map(sig_to_p1).collect();

The content of the following vectors in mithril-stm/src/multi_sig.rs:

let grouped_vks = p2_affines::from(transmuted_vks.as_slice());
let grouped_sigs = p1_affines::from(transmuted_sigs.as_slice());

Becomes vectors full of identity elements.

This PR includes the changes to avoid having an identity element in signature and verification lists.

In mithril-stm/src/multi_sig.rs:

  • Signature::verify function is updated: If signature is an infinity value, it returns an error.
  • VerificationKeyPoP::check function is updated: If the verification key is an infinity value, it returns an error.
  • test_infinity_sig test is added.
  • test_infinity_vk test is added.
  • test_keyreg_with_infinity_vk test is added.

In mithril-stm/src/error.rs:

  • MultiSignatureError is updated to cover
    • SignatureInfinity
    • VerificationKeyInfinity
  • impl From<MultiSignatureError> for StmSignatureError is updated.
  • impl<D: Digest + FixedOutput> From<MultiSignatureError> for StmAggregateSignatureError<D> is updated.
  • impl From<MultiSignatureError> for CoreVerifierError is updated.
  • pub(crate) fn blst_err_to_mithril is updated.

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
    • No clippy warnings in the CI
    • 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)

Issue(s)

Closes #2321

@curiecrypt curiecrypt changed the title error handling done for inf values of sigs and vks Fix BLST bindings: Error handling for infinite values of sigs and vks Feb 19, 2025
Copy link

github-actions bot commented Feb 19, 2025

Test Results

    3 files  ±0     56 suites  ±0   11m 29s ⏱️ + 1m 5s
1 729 tests +3  1 729 ✅ +3  0 💤 ±0  0 ❌ ±0 
2 125 runs  +3  2 125 ✅ +3  0 💤 ±0  0 ❌ ±0 

Results for commit d0d7787. ± Comparison against base commit 62ae79e.

♻️ This comment has been updated with latest results.

@curiecrypt curiecrypt marked this pull request as ready for review February 19, 2025 20:35
@curiecrypt curiecrypt temporarily deployed to testing-preview March 7, 2025 13:45 — with GitHub Actions Inactive
@curiecrypt curiecrypt requested a review from jpraynaud March 7, 2025 14:15
@curiecrypt curiecrypt force-pushed the curiecrypt/fix-bls-bindings branch from 7bae044 to 3767716 Compare March 10, 2025 15:10
@curiecrypt curiecrypt requested a review from jpraynaud March 10, 2025 15:12
Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@curiecrypt curiecrypt force-pushed the curiecrypt/fix-bls-bindings branch from 3767716 to 6c28679 Compare March 12, 2025 13:25
Co-authored-by: Jean-Philippe Raynaud <jp.raynaud@gmail.com>
@curiecrypt curiecrypt merged commit c8f16b9 into main Mar 12, 2025
36 checks passed
@curiecrypt curiecrypt deleted the curiecrypt/fix-bls-bindings branch March 12, 2025 14:01
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.

BLST Rust bindings: Aggregation fails if vk or sig lists include identity elements
2 participants