Skip to content

Commit

Permalink
Refacto 'allow_skip_signer_certification' feature
Browse files Browse the repository at this point in the history
And allow hybrid certification that is enforced only for signers that sign their keys.
This will help a smooth transition with SPOs and avoid service distruption on GCP.
This hybrid mode will be decommissionned in a near future.
  • Loading branch information
jpraynaud committed Sep 23, 2022
1 parent 23a9f94 commit 430af3c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion demo/protocol-demo/Cargo.toml
Expand Up @@ -9,7 +9,7 @@ base64 = "0.13.0"
clap = { version = "3.1.6", features = ["derive"] }
hex = "0.4.3"
log = "0.4.14"
mithril-common = { path = "../../mithril-common", features = ["skip_signer_certification"]}
mithril-common = { path = "../../mithril-common", features = ["allow_skip_signer_certification"]}
rand_chacha = "0.3.1"
rand_core = "0.6.3"
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 0 additions & 2 deletions mithril-aggregator/Cargo.toml
Expand Up @@ -39,7 +39,5 @@ slog-term = "2.9.0"
tempfile = "3.3.0"

[features]
default = ["skip_signer_certification"] # TODO: remove 'skip_signer_certification' from default features to activate full signer certification
portable = ["mithril-common/portable"]
skip_signer_certification = ["mithril-common/skip_signer_certification"]

2 changes: 1 addition & 1 deletion mithril-common/Cargo.toml
Expand Up @@ -43,4 +43,4 @@ slog-scope = "4.4.0"

[features]
portable = ["mithril/portable"]
skip_signer_certification = []
allow_skip_signer_certification = []
Expand Up @@ -263,7 +263,7 @@ impl StmSignerWrapper {
}
}

#[cfg(all(test, not(feature = "skip_signer_certification")))]
#[cfg(all(test))]
mod test {
use super::*;
use rand_chacha::ChaCha20Rng;
Expand Down
12 changes: 6 additions & 6 deletions mithril-common/src/crypto_helper/types.rs
Expand Up @@ -8,9 +8,9 @@ use mithril::stm::{
};
use mithril::AggregationError;

#[cfg(any(test, feature = "skip_signer_certification"))]
#[cfg(any(test, feature = "allow_skip_signer_certification"))]
use mithril::key_reg::KeyReg;
#[cfg(any(test, feature = "skip_signer_certification"))]
#[cfg(any(test, feature = "allow_skip_signer_certification"))]
use mithril::stm::{StmClerk, StmInitializer, StmSigner};

use blake2::{digest::consts::U32, Blake2b};
Expand Down Expand Up @@ -83,17 +83,17 @@ pub type ProtocolAggregationError = AggregationError;

// Test only
/// (Test only) Alias of [MithrilCore:StmSigner](https://mithril.network/mithril-core/doc/mithril/stm/struct.StmSigner.html).
#[cfg(any(test, feature = "skip_signer_certification"))]
#[cfg(any(test, feature = "allow_skip_signer_certification"))]
pub type ProtocolSignerNotCertified = StmSigner<D>;

/// (Test only) Alias of [MithrilCore:StmInitializer](https://mithril.network/mithril-core/doc/mithril/stm/struct.StmInitializer.html).
#[cfg(any(test, feature = "skip_signer_certification"))]
#[cfg(any(test, feature = "allow_skip_signer_certification"))]
pub type ProtocolInitializerNotCertified = StmInitializer;

/// (Test only) Alias of [MithrilCore:StmClerk](https://mithril.network/mithril-core/doc/mithril/stm/struct.StmClerk.html).
#[cfg(any(test, feature = "skip_signer_certification"))]
#[cfg(any(test, feature = "allow_skip_signer_certification"))]
pub type ProtocolClerkNotCertified = StmClerk<D>;

/// (Test only) Alias of [MithrilCore:KeyReg](https://mithril.network/mithril-core/doc/mithril/key_reg/struct.KeyReg.html). (Test only)
#[cfg(any(test, feature = "skip_signer_certification"))]
#[cfg(any(test, feature = "allow_skip_signer_certification"))]
pub type ProtocolKeyRegistrationNotCertified = KeyReg;
2 changes: 0 additions & 2 deletions mithril-signer/Cargo.toml
Expand Up @@ -33,6 +33,4 @@ mockall = "0.11.0"
slog-term = "2.9.0"

[features]
default = ["skip_signer_certification"] # TODO: remove 'skip_signer_certification' from default features to activate full signer certification
portable = ["mithril-common/portable"]
skip_signer_certification = ["mithril-common/skip_signer_certification"]

0 comments on commit 430af3c

Please sign in to comment.