Skip to content

Commit 4a6995a

Browse files
committed
Some minor remarks
1 parent 9732df2 commit 4a6995a

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

mithril-core/benches/size_benches.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ fn main() {
6565
println!("+-------------------+");
6666
println!("| Size of proofs |");
6767
println!("+-------------------+");
68-
println!("|-------------------|");
69-
println!("| Trivial proofs |");
70-
println!("+-------------------+");
7168
println!("| Results obtained by using the parameters suggested in paper.");
7269
println!("+-------------------+");
7370

mithril-core/src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ impl From<MultiSignatureError> for StmSignatureError {
155155
impl<D: Digest + FixedOutput> From<MultiSignatureError> for StmAggregateSignatureError<D> {
156156
fn from(e: MultiSignatureError) -> Self {
157157
match e {
158-
MultiSignatureError::SerializationError => Self::SerializationError,
159-
MultiSignatureError::KeyInvalid(e) => Self::IvkInvalid(e.vk),
160-
MultiSignatureError::SignatureInvalid(_e) => unreachable!(),
161158
MultiSignatureError::AggregateSignatureInvalid => Self::AggregateSignatureInvalid,
159+
MultiSignatureError::SerializationError => unreachable!(),
160+
MultiSignatureError::KeyInvalid(_) => unreachable!(),
161+
MultiSignatureError::SignatureInvalid(_e) => unreachable!(),
162162
}
163163
}
164164
}

mithril-core/src/merkle_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl<D: Digest + FixedOutput> BatchPath<D> {
173173
}
174174

175175
/// Try to convert a byte string into a `BatchPath`.
176-
// todo: We should not panic if the size of the slice is invalid (I believe `bytes[offset + i * 8..offset + (i + 1) * 8]` will panic if bytes is not large enough.
176+
// todo: We should not panic if the size of the slice is invalid (I believe `bytes[offset + i * 8..offset + (i + 1) * 8]` will panic if bytes is not large enough.
177177
pub fn from_bytes(bytes: &[u8]) -> Result<Self, MerkleTreeError<D>> {
178178
let mut u64_bytes = [0u8; 8];
179179
u64_bytes.copy_from_slice(&bytes[..8]);

mithril-core/src/stm.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,8 @@ impl<D: Clone + Digest + FixedOutput> StmSigner<D> {
359359
/// Once the signature is produced, this function checks whether any index in `[0,..,self.params.m]`
360360
/// wins the lottery by evaluating the dense mapping.
361361
/// It records all the winning indexes in `Self.indexes`.
362-
/// If it wins at least one lottery,
363-
/// it does not produce a list of indexes of merkle path for its corresponding `(VerificationKey, Stake)`.
364-
/// Instead it stores the signer's merkle tree index and the merkle path production will be handled in `StmClerk`.
362+
/// If it wins at least one lottery, it stores the signer's merkle tree index. The proof of membership
363+
/// will be handled by the aggregator.
365364
pub fn sign(&self, msg: &[u8]) -> Option<StmSig> {
366365
let msgp = self
367366
.closed_reg
@@ -457,6 +456,8 @@ impl<D: Digest + Clone + FixedOutput> StmClerk<D> {
457456
/// The function selects at least `self.k` indexes.
458457
/// # Error
459458
/// If there is no sufficient signatures, then the function fails.
459+
// todo: We need to agree on a criteria to dedup (by defaut we use a BTreeMap that guarantees keys order)
460+
// todo: not good, because it only removes index if there is a conflict (see benches)
460461
pub fn dedup_sigs_for_indices(
461462
&self,
462463
msg: &[u8],
@@ -1102,7 +1103,6 @@ mod tests {
11021103

11031104
#[derive(Debug)]
11041105
struct ProofTest {
1105-
n: usize,
11061106
msig: Result<Sig, AggregationError>,
11071107
clerk: StmClerk<D>,
11081108
msg: [u8; 16],
@@ -1124,12 +1124,7 @@ mod tests {
11241124
let sigs = find_signatures(&msg, &ps, &all_ps);
11251125

11261126
let msig = clerk.aggregate(&sigs, &msg);
1127-
ProofTest {
1128-
n,
1129-
msig,
1130-
clerk,
1131-
msg,
1132-
}
1127+
ProofTest { msig, clerk, msg }
11331128
})
11341129
})
11351130
}

0 commit comments

Comments
 (0)