Skip to content

Commit 5512099

Browse files
authored
Merge pull request #2412 from input-output-hk/curiecrypt/module-participant
Organize STM - Module participant
2 parents 7c1f5aa + af7e967 commit 5512099

File tree

26 files changed

+389
-307
lines changed

26 files changed

+389
-307
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/protocol-demo/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithrildemo"
3-
version = "0.1.50"
3+
version = "0.1.51"
44
authors = { workspace = true }
55
edition = { workspace = true }
66
documentation = { workspace = true }

demo/protocol-demo/src/types.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use mithril_stm::key_reg::KeyReg;
2-
use mithril_stm::stm::{
3-
Stake, StmAggrSig, StmClerk, StmInitializer, StmParameters, StmSig, StmSigner,
1+
use mithril_stm::{
2+
KeyReg, Stake, StmAggrSig, StmClerk, StmInitializer, StmParameters, StmSig, StmSigner,
43
StmVerificationKeyPoP,
54
};
65

mithril-common/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-common"
3-
version = "0.5.29"
3+
version = "0.5.30"
44
description = "Common types, interfaces, and utilities for Mithril nodes."
55
authors = { workspace = true }
66
edition = { workspace = true }
@@ -47,7 +47,9 @@ kes-summed-ed25519 = { version = "0.2.1", features = [
4747
"serde_enabled",
4848
"sk_clone_enabled",
4949
] }
50-
mithril-stm = { path = "../mithril-stm", version = "0.3", default-features = false, features = ["batch-verify-aggregates"] }
50+
mithril-stm = { path = "../mithril-stm", version = ">=0.3", default-features = false, features = [
51+
"batch-verify-aggregates"
52+
] }
5153
nom = "8.0.0"
5254
pallas-addresses = { version = "0.32.0", optional = true }
5355
pallas-codec = { version = "0.32.0", optional = true }

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ use crate::{
1515
StdError, StdResult,
1616
};
1717

18-
use mithril_stm::key_reg::{ClosedKeyReg, KeyReg};
19-
use mithril_stm::stm::{Stake, StmInitializer, StmParameters, StmSigner, StmVerificationKeyPoP};
20-
use mithril_stm::RegisterError;
18+
use mithril_stm::{
19+
ClosedKeyReg, KeyReg, RegisterError, Stake, StmInitializer, StmParameters, StmSigner,
20+
StmVerificationKeyPoP,
21+
};
2122

2223
use crate::crypto_helper::cardano::Sum6KesBytes;
2324
use anyhow::{anyhow, Context};

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use crate::crypto_helper::cardano::{
44
};
55

66
use mithril_stm::{
7-
key_reg::ClosedKeyReg,
8-
stm::{Index, Stake, StmClerk, StmParameters, StmSigner},
9-
AggregationError,
7+
AggregationError, ClosedKeyReg, Index, Stake, StmClerk, StmParameters, StmSigner,
108
};
119

1210
use blake2::{digest::consts::U32, Blake2b};
@@ -20,31 +18,31 @@ pub(crate) type D = Blake2b<U32>;
2018
/// The id of a mithril party.
2119
pub type ProtocolPartyId = String;
2220

23-
/// Alias of [MithrilStm:Stake](type@mithril_stm::stm::Stake).
21+
/// Alias of [MithrilStm:Stake](type@mithril_stm::Stake).
2422
pub type ProtocolStake = Stake;
2523

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

29-
/// Alias of [MithrilStm::StmParameters](struct@mithril_stm::stm::StmParameters).
27+
/// Alias of [MithrilStm::StmParameters](struct@mithril_stm::StmParameters).
3028
pub type ProtocolParameters = StmParameters;
3129

32-
/// Alias of [MithrilStm::Index](type@mithril_stm::stm::Index).
30+
/// Alias of [MithrilStm::Index](type@mithril_stm::Index).
3331
pub type ProtocolLotteryIndex = Index;
3432

35-
/// Alias of [MithrilStm:StmSigner](struct@mithril_stm::stm::StmSigner).
33+
/// Alias of [MithrilStm:StmSigner](struct@mithril_stm::StmSigner).
3634
pub type ProtocolSigner = StmSigner<D>;
3735

38-
/// Alias of a wrapper of [MithrilStm:StmInitializer](struct@mithril_stm::stm::StmInitializer).
36+
/// Alias of a wrapper of [MithrilStm:StmInitializer](struct@mithril_stm::StmInitializer).
3937
pub type ProtocolInitializer = StmInitializerWrapper;
4038

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

44-
/// 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).
4543
pub type ProtocolKeyRegistration = KeyRegWrapper;
4644

47-
/// 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).
4846
pub type ProtocolClosedKeyRegistration = ClosedKeyReg<D>;
4947

5048
// Error alias

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

Lines changed: 1 addition & 1 deletion
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::stm::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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::Context;
22
use hex::{FromHex, ToHex};
33
use kes_summed_ed25519::kes::Sum6KesSig;
4-
use mithril_stm::stm::{StmAggrSig, StmAggrVerificationKey, StmSig, StmVerificationKeyPoP};
4+
use mithril_stm::{StmAggrSig, StmAggrVerificationKey, StmSig, StmVerificationKeyPoP};
55

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

mithril-common/src/entities/single_signature.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 5 deletions
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::stm::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,7 +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, StmVerificationKeyPoP};
395+
use mithril_stm::{StmAggrSig, StmAggrVerificationKey, StmSig, StmVerificationKeyPoP};
396396
use serde::{de::DeserializeOwned, Serialize};
397397
use std::any::type_name;
398398

mithril-stm/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.4.0 (15-05-2025)
9+
10+
### Added
11+
12+
- Added a `participant` module and `StmInitializer` and `StmSigner` functionality covered by its submodules.
13+
14+
### Changed
15+
16+
- STM module visibilities are changed.
17+
818
## 0.3.44 (28-04-2025)
919

1020
- Removed the build script and deprecated `batch-verify-aggregate` feature as the code behind this feature is now

mithril-stm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-stm"
3-
version = "0.3.46"
3+
version = "0.4.0"
44
edition = { workspace = true }
55
authors = { workspace = true }
66
homepage = { workspace = true }

mithril-stm/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +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, StmInitializer, StmParameters, StmSig, StmSigner};
67-
use mithril_stm::AggregationError;
65+
use mithril_stm::{StmClerk, StmParameters, StmSig, KeyReg, StmInitializer, StmSigner, AggregationError};
6866

6967
use blake2::{digest::consts::U32, Blake2b};
7068
use rayon::prelude::*;

mithril-stm/benches/multi_sig.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use blake2::{
33
digest::consts::{U32, U64},
44
Blake2b, Digest,
55
};
6-
use mithril_stm::key_reg::KeyReg;
7-
use mithril_stm::stm::{
8-
CoreVerifier, Stake, StmClerk, StmInitializer, StmParameters, StmSig, StmSigRegParty,
6+
use mithril_stm::{
7+
CoreVerifier, KeyReg, Stake, StmClerk, StmInitializer, StmParameters, StmSig, StmSigRegParty,
98
StmSigner, StmVerificationKey,
109
};
1110
use rand_chacha::ChaCha20Rng;

mithril-stm/benches/stm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
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::stm::{
6-
CoreVerifier, Stake, StmAggrSig, StmClerk, StmInitializer, StmParameters, StmSigner,
4+
use mithril_stm::{
5+
CoreVerifier, KeyReg, Stake, StmAggrSig, StmClerk, StmInitializer, StmParameters, StmSigner,
76
StmVerificationKey,
87
};
98
use rand_chacha::ChaCha20Rng;

mithril-stm/examples/key_registration.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +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::stm::{Stake, StmClerk, StmInitializer, StmParameters, StmVerificationKeyPoP};
5+
use mithril_stm::{
6+
ClosedKeyReg, KeyReg, Stake, StmClerk, StmInitializer, StmParameters, StmVerificationKeyPoP,
7+
};
78

89
use rand_chacha::ChaCha20Rng;
910
use rand_core::{RngCore, SeedableRng};

mithril-stm/src/lib.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
#![warn(missing_docs)]
21
#![doc = include_str!("../README.md")]
32
//! Implementation of Stake-based Threshold Multisignatures
43
5-
extern crate core;
6-
4+
mod bls_multi_signature;
75
mod eligibility_check;
86
mod error;
9-
pub mod key_reg;
7+
mod key_reg;
108
mod merkle_tree;
11-
pub mod stm;
9+
mod participant;
10+
mod stm;
1211

13-
pub use crate::error::{
12+
pub use error::{
1413
AggregationError, CoreVerifierError, RegisterError, StmAggregateSignatureError,
1514
StmSignatureError,
1615
};
16+
pub use key_reg::{ClosedKeyReg, KeyReg};
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 bls_multi_signature::{
25+
ProofOfPossession, Signature, SigningKey, VerificationKey, VerificationKeyPoP,
26+
};

mithril-stm/src/merkle_tree/leaf.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::bls_multi_signature::VerificationKey;
22
use crate::error::MerkleTreeError;
3-
use crate::stm::{Stake, StmVerificationKey};
3+
use crate::participant::StmVerificationKey;
4+
use crate::stm::Stake;
45
use blake2::Blake2b;
56
use digest::consts::U32;
67
use serde::{Deserialize, Serialize};

0 commit comments

Comments
 (0)