Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

No side-effects in getters #39

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions benches/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ fn criterion_benchmark(c: &mut Criterion) {
let mut aggregator = SignatureAggregator::new(params, group_key, &message[..]);

for i in 1..THRESHOLD_OF_PARTICIPANTS + 1 {
aggregator.include_signer(
i,
participants_public_comshares[(i - 1) as usize].commitments[0],
&participants_secret_keys[(i - 1) as usize].to_public(),
);
aggregator
.include_signer(
i,
participants_public_comshares[(i - 1) as usize].commitments[0],
&participants_secret_keys[(i - 1) as usize].to_public(),
)
.unwrap();
}

let signers = aggregator.get_signers().clone();
let signers = aggregator.signers().to_vec();
let message_hash = Secp256k1Sha256::h4(&message[..]);
let message_hash_copy = message_hash;

Expand Down
11 changes: 10 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub enum Error<C: CipherSuite> {
ComplaintVerificationError,
/// The index of a participant is zero
IndexIsZero,
/// The index of a signer does not match the index in the public key
IndexMismatch(u32, u32),
/// GroupVerifyingKey generation failure
InvalidGroupKey,
/// Invalid NiZK proof of knowledge
Expand Down Expand Up @@ -87,7 +89,14 @@ impl<C: CipherSuite> core::fmt::Display for Error<C> {
write!(f, "The complaint is not correct.")
}
Error::IndexIsZero => {
write!(f, "The indexs of a participant cannot be 0.")
write!(f, "The index of a participant cannot be 0.")
}
Error::IndexMismatch(participant_idx, pubkey_idx) => {
write!(
f,
"Index mismatch between participant index ({}) and the publick key index ({}).",
dvdplm marked this conversation as resolved.
Show resolved Hide resolved
participant_idx, pubkey_idx
)
}
Error::InvalidGroupKey => {
write!(
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@
//! #
//! # aggregator.include_signer(1, alice_public_comshares.commitments[0], &alice_public_key);
//! # aggregator.include_signer(3, carol_public_comshares.commitments[0], &carol_public_key);
//! let signers = aggregator.get_signers();
//! let signers = aggregator.signers();
//! # Ok(()) }
//! # fn main() { assert!(do_test().is_ok()); }
//! ```
Expand Down Expand Up @@ -1530,7 +1530,7 @@
//! # aggregator.include_signer(1, alice_public_comshares.commitments[0], &alice_public_key);
//! # aggregator.include_signer(3, carol_public_comshares.commitments[0], &carol_public_key);
//! #
//! # let signers = aggregator.get_signers();
//! # let signers = aggregator.signers();
//! # let message_hash = Secp256k1Sha256::h4(&message[..]);
//!
//! let alice_partial = alice_secret_key.sign(
Expand Down
Loading
Loading