Skip to content

Commit e140acb

Browse files
committed
module visibilities
broken intra doc links clippy
1 parent 7ed4bac commit e140acb

File tree

17 files changed

+57
-67
lines changed

17 files changed

+57
-67
lines changed

demo/protocol-demo/src/types.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use mithril_stm::{
2-
key_reg::KeyReg,
3-
participant::{StmInitializer, StmSigner, StmVerificationKeyPoP},
4-
stm::{Stake, StmAggrSig, StmClerk, StmParameters, StmSig},
2+
KeyReg, Stake, StmAggrSig, StmClerk, StmInitializer, StmParameters, StmSig, StmSigner,
3+
StmVerificationKeyPoP,
54
};
65

76
use blake2::{digest::consts::U32, Blake2b};

mithril-common/src/crypto_helper/cardano/key_certification.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ use crate::{
1616
};
1717

1818
use mithril_stm::{
19-
key_reg::{ClosedKeyReg, KeyReg},
20-
participant::{StmInitializer, StmSigner, StmVerificationKeyPoP},
21-
stm::{Stake, StmParameters},
22-
RegisterError,
19+
ClosedKeyReg, KeyReg, RegisterError, Stake, StmInitializer, StmParameters, StmSigner,
20+
StmVerificationKeyPoP,
2321
};
2422

2523
use crate::crypto_helper::cardano::Sum6KesBytes;

mithril-common/src/crypto_helper/types/alias.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ use crate::crypto_helper::cardano::{
44
};
55

66
use mithril_stm::{
7-
key_reg::ClosedKeyReg,
8-
participant::StmSigner,
9-
stm::{Index, Stake, StmClerk, StmParameters},
10-
AggregationError,
7+
AggregationError, ClosedKeyReg, Index, Stake, StmClerk, StmParameters, StmSigner,
118
};
129

1310
use blake2::{digest::consts::U32, Blake2b};
@@ -21,31 +18,31 @@ pub(crate) type D = Blake2b<U32>;
2118
/// The id of a mithril party.
2219
pub type ProtocolPartyId = String;
2320

24-
/// Alias of [MithrilStm:Stake](type@mithril_stm::stm::Stake).
21+
/// Alias of [MithrilStm:Stake](type@mithril_stm::Stake).
2522
pub type ProtocolStake = Stake;
2623

2724
/// A list of [Party Id][ProtocolPartyId] associated with its [Stake][ProtocolStake].
2825
pub type ProtocolStakeDistribution = Vec<(ProtocolPartyId, ProtocolStake)>;
2926

30-
/// Alias of [MithrilStm::StmParameters](struct@mithril_stm::stm::StmParameters).
27+
/// Alias of [MithrilStm::StmParameters](struct@mithril_stm::StmParameters).
3128
pub type ProtocolParameters = StmParameters;
3229

33-
/// Alias of [MithrilStm::Index](type@mithril_stm::stm::Index).
30+
/// Alias of [MithrilStm::Index](type@mithril_stm::Index).
3431
pub type ProtocolLotteryIndex = Index;
3532

36-
/// Alias of [MithrilStm:StmSigner](struct@mithril_stm::participant::StmSigner).
33+
/// Alias of [MithrilStm:StmSigner](struct@mithril_stm::StmSigner).
3734
pub type ProtocolSigner = StmSigner<D>;
3835

39-
/// Alias of a wrapper of [MithrilStm:StmInitializer](struct@mithril_stm::participant::StmInitializer).
36+
/// Alias of a wrapper of [MithrilStm:StmInitializer](struct@mithril_stm::StmInitializer).
4037
pub type ProtocolInitializer = StmInitializerWrapper;
4138

42-
/// Alias of [MithrilStm:StmClerk](struct@mithril_stm::stm::StmClerk).
39+
/// Alias of [MithrilStm:StmClerk](struct@mithril_stm::StmClerk).
4340
pub type ProtocolClerk = StmClerk<D>;
4441

45-
/// Alias of a wrapper of [MithrilStm:KeyReg](struct@mithril_stm::key_reg::KeyReg).
42+
/// Alias of a wrapper of [MithrilStm:KeyReg](struct@mithril_stm::KeyReg).
4643
pub type ProtocolKeyRegistration = KeyRegWrapper;
4744

48-
/// Alias of a wrapper of [MithrilStm:ClosedKeyReg](struct@mithril_stm::key_reg::KeyReg).
45+
/// Alias of a wrapper of [MithrilStm:ClosedKeyReg](struct@mithril_stm::KeyReg).
4946
pub type ProtocolClosedKeyRegistration = ClosedKeyReg<D>;
5047

5148
// Error alias

mithril-common/src/crypto_helper/types/protocol_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ mod test {
222222
crypto_helper::ProtocolKey,
223223
test_utils::{fake_keys, TempDir},
224224
};
225-
use mithril_stm::participant::StmVerificationKeyPoP;
225+
use mithril_stm::StmVerificationKeyPoP;
226226
use serde::{Deserialize, Serialize};
227227

228228
static VERIFICATION_KEY: &str = fake_keys::signer_verification_key()[0];

mithril-common/src/crypto_helper/types/wrappers.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use anyhow::Context;
22
use hex::{FromHex, ToHex};
33
use kes_summed_ed25519::kes::Sum6KesSig;
4-
use mithril_stm::participant::StmVerificationKeyPoP;
5-
use mithril_stm::stm::{StmAggrSig, StmAggrVerificationKey, StmSig};
4+
use mithril_stm::{StmAggrSig, StmAggrVerificationKey, StmSig, StmVerificationKeyPoP};
65

76
use crate::crypto_helper::{MKMapProof, MKProof, OpCert, ProtocolKey, ProtocolKeyCodec, D};
87
use crate::entities::BlockRange;

mithril-common/src/entities/single_signature.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use mithril_stm::stm::StmSig;
1+
use mithril_stm::StmSig;
22
use serde::{Deserialize, Serialize};
33
use std::fmt::{Debug, Formatter};
44

mithril-common/src/protocol/multi_signer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::{anyhow, Context};
2-
use mithril_stm::stm::StmParameters;
2+
use mithril_stm::StmParameters;
33

44
use crate::{
55
crypto_helper::{

mithril-common/src/test_utils/fake_keys.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Pre hex encoded StmTypes for testing.
22
3-
/// A list of pre json hex encoded [MithrilStm:StmSig](type@mithril_stm::stm::StmSig)
3+
/// A list of pre json hex encoded [MithrilStm:StmSig](type@mithril_stm::StmSig)
44
pub const fn single_signature<'a>() -> [&'a str; 4] {
55
[
66
"7b227369676d61223a5b3133302c3137372c31352c3232392c32342c3235312c3234372c3137312c3139362c32\
@@ -52,7 +52,7 @@ pub const fn single_signature<'a>() -> [&'a str; 4] {
5252
]
5353
}
5454

55-
/// A list of pre json hex encoded [MithrilStm:StmAggrSig](struct@mithril_stm::stm::StmAggrSig)
55+
/// A list of pre json hex encoded [MithrilStm:StmAggrSig](struct@mithril_stm::StmAggrSig)
5656
pub const fn multi_signature<'a>() -> [&'a str; 2] {
5757
[
5858
"7b227369676e617475726573223a5b5b7b227369676d61223a5b3137312c3136312c3232352c3139342c32382c\
@@ -158,7 +158,7 @@ pub const fn signable_manifest_signature<'a>() -> [&'a str; 2] {
158158
]
159159
}
160160

161-
/// A list of pre json hex encoded [MithrilStm:StmVerificationKeyPoP](type@mithril_stm::participant::StmVerificationKeyPoP)
161+
/// A list of pre json hex encoded [MithrilStm:StmVerificationKeyPoP](type@mithril_stm::StmVerificationKeyPoP)
162162
pub const fn signer_verification_key<'a>() -> [&'a str; 4] {
163163
[
164164
"7b22766b223a5b3134352c32332c3135382c31322c3138332c3230392c33322c3134302c33372c3132342c3136\
@@ -366,7 +366,7 @@ pub const fn operational_certificate<'a>() -> [&'a str; 2] {
366366
]
367367
}
368368

369-
/// A list of pre json hex encoded [MithrilStm:StmAggrVerificationKey](struct@mithril_stm::stm::StmAggrVerificationKey)
369+
/// A list of pre json hex encoded [MithrilStm:StmAggrVerificationKey](struct@mithril_stm::StmAggrVerificationKey)
370370
pub const fn aggregate_verification_key<'a>() -> [&'a str; 3] {
371371
[
372372
"7b226d745f636f6d6d69746d656e74223a7b22726f6f74223a5b3134302c31332c3135352c3134312c3136332c\
@@ -392,8 +392,7 @@ mod test {
392392
use super::*;
393393
use ed25519_dalek::VerifyingKey;
394394
use kes_summed_ed25519::kes::Sum6KesSig;
395-
use mithril_stm::stm::{StmAggrSig, StmAggrVerificationKey, StmSig};
396-
use mithril_stm::participant::StmVerificationKeyPoP;
395+
use mithril_stm::{StmAggrSig, StmAggrVerificationKey, StmSig, StmVerificationKeyPoP};
397396
use serde::{de::DeserializeOwned, Serialize};
398397
use std::any::type_name;
399398

mithril-stm/README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ cargo bench
6262
The following is a simple example of the STM implementation:
6363

6464
```rust
65-
use mithril_stm::key_reg::KeyReg;
66-
use mithril_stm::stm::{StmClerk, StmParameters, StmSig};
67-
use mithril_stm::participant::{StmInitializer, StmSigner};
68-
use mithril_stm::AggregationError;
65+
use mithril_stm::{StmClerk, StmParameters, StmSig, KeyReg, StmInitializer, StmSigner, AggregationError};
6966

7067
use blake2::{digest::consts::U32, Blake2b};
7168
use rayon::prelude::*;

mithril-stm/benches/multi_sig.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use blake2::{digest::consts::U64, Blake2b, Digest};
22
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
3-
use mithril_stm::bls_multi_signature::{Signature, SigningKey, VerificationKey};
3+
use mithril_stm::{Signature, SigningKey, VerificationKey};
44
use rand_chacha::ChaCha20Rng;
55
use rand_core::{RngCore, SeedableRng};
66

mithril-stm/benches/size_benches.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ use blake2::{
33
digest::consts::{U32, U64},
44
Blake2b, Digest,
55
};
6-
use mithril_stm::key_reg::KeyReg;
7-
use mithril_stm::participant::{StmInitializer, StmSigner, StmVerificationKey};
8-
use mithril_stm::stm::{CoreVerifier, Stake, StmClerk, StmParameters, StmSig, StmSigRegParty};
6+
use mithril_stm::{
7+
CoreVerifier, KeyReg, Stake, StmClerk, StmInitializer, StmParameters, StmSig, StmSigRegParty,
8+
StmSigner, StmVerificationKey,
9+
};
910
use rand_chacha::ChaCha20Rng;
1011
use rand_core::{RngCore, SeedableRng};
1112
use rayon::iter::ParallelIterator;

mithril-stm/benches/stm.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use blake2::digest::{Digest, FixedOutput};
22
use blake2::{digest::consts::U32, Blake2b};
33
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
4-
use mithril_stm::key_reg::KeyReg;
5-
use mithril_stm::participant::{StmInitializer, StmSigner, StmVerificationKey};
6-
use mithril_stm::stm::{CoreVerifier, Stake, StmAggrSig, StmClerk, StmParameters};
4+
use mithril_stm::{
5+
CoreVerifier, KeyReg, Stake, StmAggrSig, StmClerk, StmInitializer, StmParameters, StmSigner,
6+
StmVerificationKey,
7+
};
78
use rand_chacha::ChaCha20Rng;
89
use rand_core::{RngCore, SeedableRng};
910
use rayon::prelude::*;

mithril-stm/examples/key_registration.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
//! but instead by all the participants in the signature process. Contrarily to the full protocol
33
//! run presented in `tests/integration.rs`, we explicitly treat each party individually.
44
use blake2::{digest::consts::U32, Blake2b};
5-
use mithril_stm::key_reg::{ClosedKeyReg, KeyReg};
6-
use mithril_stm::participant::{StmInitializer, StmVerificationKeyPoP};
7-
use mithril_stm::stm::{Stake, StmClerk, StmParameters};
5+
use mithril_stm::{
6+
ClosedKeyReg, KeyReg, Stake, StmClerk, StmInitializer, StmParameters, StmVerificationKeyPoP,
7+
};
88

99
use rand_chacha::ChaCha20Rng;
1010
use rand_core::{RngCore, SeedableRng};

mithril-stm/src/lib.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
#![warn(missing_docs)]
21
#![doc = include_str!("../README.md")]
32
//! Implementation of Stake-based Threshold Multisignatures
43
5-
extern crate core;
4+
mod bls_multi_signature;
65

76
mod eligibility_check;
87
mod error;
9-
pub mod key_reg;
8+
mod key_reg;
109
mod merkle_tree;
11-
pub mod stm;
10+
mod participant;
11+
mod stm;
1212

1313
pub use crate::error::{
1414
AggregationError, CoreVerifierError, RegisterError, StmAggregateSignatureError,
1515
StmSignatureError,
1616
};
17+
pub use participant::{StmInitializer, StmSigner, StmVerificationKey, StmVerificationKeyPoP};
18+
pub use stm::{
19+
CoreVerifier, Index, Stake, StmAggrSig, StmAggrVerificationKey, StmClerk, StmParameters,
20+
StmSig, StmSigRegParty,
21+
};
1722

1823
#[cfg(feature = "benchmark-internals")]
19-
pub mod bls_multi_signature;
20-
21-
#[cfg(not(feature = "benchmark-internals"))]
22-
mod bls_multi_signature;
24+
pub use crate::bls_multi_signature::{
25+
ProofOfPossession, Signature, SigningKey, VerificationKey, VerificationKeyPoP,
26+
};
2327

24-
pub mod participant;
28+
pub use key_reg::{ClosedKeyReg, KeyReg};

mithril-stm/src/stm.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
//! ```rust
88
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
99
//! use blake2::{Blake2b, digest::consts::U32};
10-
//! use mithril_stm::key_reg::KeyReg; // Import key registration functionality
11-
//! use mithril_stm::stm::{StmClerk, StmParameters, StmSig};
12-
//! use mithril_stm::participant::{StmInitializer, StmSigner};
10+
//! use mithril_stm::{StmClerk, StmParameters, StmSig, KeyReg, StmInitializer, StmSigner};
1311
//! use mithril_stm::AggregationError;
1412
//! use rayon::prelude::*; // We use par_iter to speed things up
1513
//!
@@ -864,7 +862,6 @@ impl CoreVerifier {
864862
mod tests {
865863
use super::*;
866864
use crate::key_reg::*;
867-
use bincode;
868865
use blake2::{digest::consts::U32, Blake2b};
869866
use proptest::collection::{hash_map, vec};
870867
use proptest::prelude::*;

mithril-stm/tests/stm_core.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use blake2::Blake2b;
22
use digest::consts::U32;
3-
use mithril_stm::participant::{StmInitializer, StmSigner, StmVerificationKey};
4-
use mithril_stm::stm::{CoreVerifier, Stake, StmParameters, StmSig};
5-
use mithril_stm::CoreVerifierError;
3+
use mithril_stm::{
4+
CoreVerifier, CoreVerifierError, Stake, StmInitializer, StmParameters, StmSig, StmSigner,
5+
StmVerificationKey,
6+
};
67
use rand_chacha::ChaCha20Rng;
78
use rand_core::{RngCore, SeedableRng};
89
type D = Blake2b<U32>;

mithril-stm/tests/stm_protocol.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
use mithril_stm::key_reg::KeyReg;
2-
use mithril_stm::participant::{StmInitializer, StmSigner, StmVerificationKey};
3-
use mithril_stm::stm::{
4-
Stake, StmAggrSig, StmAggrVerificationKey, StmClerk, StmParameters, StmSig,
5-
};
6-
use mithril_stm::AggregationError;
7-
81
use blake2::{digest::consts::U32, Blake2b};
2+
use mithril_stm::{
3+
AggregationError, KeyReg, Stake, StmAggrSig, StmAggrVerificationKey, StmClerk, StmInitializer,
4+
StmParameters, StmSig, StmSigner, StmVerificationKey,
5+
};
96
use rand_chacha::ChaCha20Rng;
107
use rand_core::{RngCore, SeedableRng};
118
use rayon::prelude::*;

0 commit comments

Comments
 (0)