Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Jun 10, 2025

This test derives n-t partial signatures from t provided partial signatures (i.e. it tests "generic" signature recovery).

Justification

While we never perform this operation in practice (at least for now), it [1] serves as a reminder that using partial signatures for accountability (when >= t exist) is unsound and [2] serves as a conformance test that our share derivation, partial signing, and msm logic is consistent.

match namespace {
Some(namespace) => hm.map(V::MESSAGE, &union_unique(namespace, msg)),
None => hm.map(V::MESSAGE, msg),
let hm = match namespace {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switching to hash_message fixes an erroneous linting error.

@patrick-ogrady patrick-ogrady requested a review from Copilot June 10, 2025 14:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new test for deriving missing BLS partial signatures and refactors message hashing to use hash_message.

  • Replaces manual Signature::zero + map calls with hash_message in three loops.
  • Introduces threshold_derive_missing_partials helper and test_threshold_signature_derive_partials test.
Comments suppressed due to low confidence (2)

cryptography/src/bls12381/primitives/ops.rs:2367

  • [nitpick] The parameter names eval_at_x and i_x are ambiguous. Consider renaming them to target_index and basis_index respectively to clarify their roles in the Lagrange coefficient calculation.
fn lagrange_coeff(eval_at_x: u32, i_x: u32, x_coords: &[u32]) -> Scalar {

cryptography/src/bls12381/primitives/ops.rs:2366

  • [nitpick] Consider expanding this doc comment with the mathematical formula and explaining why eval_at_x + 1 is used before converting to Scalar.
// Helper to compute the Lagrange basis polynomial l_i(x) evaluated at a specific point `eval_at_x`.

@patrick-ogrady patrick-ogrady changed the title [cryptography/bls12381] Add Test for Deriving Partial Signatures [cryptography/bls12381] Test Partial Signature Derivation Jun 10, 2025
@patrick-ogrady patrick-ogrady marked this pull request as ready for review June 10, 2025 14:38
@patrick-ogrady patrick-ogrady merged commit 2e8f14c into main Jun 10, 2025
15 checks passed
@patrick-ogrady patrick-ogrady deleted the recover-partial branch June 10, 2025 16:43
@codecov
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 97.87234% with 2 lines in your changes missing coverage. Please review.

Project coverage is 91.11%. Comparing base (b665bd1) to head (723f98f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cryptography/src/bls12381/primitives/ops.rs 97.87% 2 Missing ⚠️
@@            Coverage Diff             @@
##             main    #1082      +/-   ##
==========================================
+ Coverage   91.10%   91.11%   +0.01%     
==========================================
  Files         191      191              
  Lines       54839    54919      +80     
==========================================
+ Hits        49960    50040      +80     
  Misses       4879     4879              
Files with missing lines Coverage Δ
consensus/src/threshold_simplex/types.rs 92.90% <ø> (ø)
cryptography/src/bls12381/primitives/ops.rs 97.98% <97.87%> (+0.10%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b665bd1...723f98f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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