From f8a5c671e6137f4557988404df26abb3700244fc Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 10:41:08 +0100 Subject: [PATCH 01/10] Upgrade 'mithril-core' Rust edition to 2021 --- mithril-core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril-core/Cargo.toml b/mithril-core/Cargo.toml index 3db6c4016f3..b0017d17893 100644 --- a/mithril-core/Cargo.toml +++ b/mithril-core/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mithril" version = "0.1.0" -edition = "2018" +edition = { workspace = true } authors = { workspace = true } documentation = { workspace = true } homepage = { workspace = true } From 6e4083c2e66e1470a9bd5b1f5d532aa83d13748b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 11:00:59 +0100 Subject: [PATCH 02/10] Rename 'mithril-core' package to 'mithril-stm' --- .../build-upload-mithril-artifact/action.yml | 2 +- .github/workflows/docs.yml | 2 +- Cargo.lock | 46 +++++++++---------- mithril-common/Cargo.toml | 6 +-- .../cardano/key_certification.rs | 6 +-- mithril-common/src/crypto_helper/types.rs | 6 +-- mithril-core/Cargo.toml | 2 +- mithril-core/README.md | 6 +-- mithril-core/benches/size_benches.rs | 4 +- mithril-core/benches/stm.rs | 4 +- mithril-core/examples/key_registration.rs | 4 +- mithril-core/src/stm.rs | 6 +-- mithril-core/tests/integration.rs | 6 +-- 13 files changed, 50 insertions(+), 50 deletions(-) diff --git a/.github/workflows/actions/build-upload-mithril-artifact/action.yml b/.github/workflows/actions/build-upload-mithril-artifact/action.yml index 75d770db00e..87b5764b54c 100644 --- a/.github/workflows/actions/build-upload-mithril-artifact/action.yml +++ b/.github/workflows/actions/build-upload-mithril-artifact/action.yml @@ -25,7 +25,7 @@ runs: with: name: mithril-distribution-${{ runner.os }}-${{ runner.arch }} path: | - target/release/libmithril.* + target/release/libmithril_stm.* target/release/libmithril_common.* target/release/mithril-aggregator target/release/mithril-aggregator.exe diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6af35a9e5db..9cbedcae7ea 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -21,7 +21,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: doc - args: --no-deps -p mithril -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client + args: --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client - name: Publish Mithril-rust-doc uses: actions/upload-artifact@v3 diff --git a/Cargo.lock b/Cargo.lock index f25c1a677c4..865e8a2d826 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1933,28 +1933,6 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "mithril" -version = "0.1.0" -dependencies = [ - "bincode", - "blake2 0.10.5", - "blst", - "criterion", - "digest 0.10.6", - "hex", - "num-bigint 0.4.3", - "num-rational", - "num-traits", - "proptest", - "rand_chacha 0.3.1", - "rand_core 0.6.4", - "rayon", - "rug", - "serde", - "thiserror", -] - [[package]] name = "mithril-aggregator" version = "0.1.2" @@ -2028,7 +2006,7 @@ dependencies = [ "http", "jsonschema", "kes-summed-ed25519", - "mithril", + "mithril-stm", "mockall", "nom", "rand_chacha 0.2.2", @@ -2097,6 +2075,28 @@ dependencies = [ "tokio", ] +[[package]] +name = "mithril-stm" +version = "0.1.0" +dependencies = [ + "bincode", + "blake2 0.10.5", + "blst", + "criterion", + "digest 0.10.6", + "hex", + "num-bigint 0.4.3", + "num-rational", + "num-traits", + "proptest", + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "rayon", + "rug", + "serde", + "thiserror", +] + [[package]] name = "mithrildemo" version = "0.1.0" diff --git a/mithril-common/Cargo.toml b/mithril-common/Cargo.toml index 304a2a128b4..3fc2f2f1be9 100644 --- a/mithril-common/Cargo.toml +++ b/mithril-common/Cargo.toml @@ -44,16 +44,16 @@ warp = "0.3" [target.'cfg(not(windows))'.dependencies] # non-windows: use default rug backend -mithril = { path = "../mithril-core" } +mithril-stm = { path = "../mithril-core" } [target.'cfg(windows)'.dependencies] # Windows doesn't support rug backend, fallback to num-integer -mithril = { path = "../mithril-core", default-features = false, features = ["num-integer-backend"] } +mithril-stm = { path = "../mithril-core", default-features = false, features = ["num-integer-backend"] } [dev-dependencies] slog-scope = "4.4.0" [features] -portable = ["mithril/portable"] +portable = ["mithril-stm/portable"] test_only = [] allow_skip_signer_certification = [] diff --git a/mithril-common/src/crypto_helper/cardano/key_certification.rs b/mithril-common/src/crypto_helper/cardano/key_certification.rs index 4a2a3f73ac0..f857800ee4e 100644 --- a/mithril-common/src/crypto_helper/cardano/key_certification.rs +++ b/mithril-common/src/crypto_helper/cardano/key_certification.rs @@ -9,9 +9,9 @@ use crate::crypto_helper::types::{ ProtocolStakeDistribution, }; -use mithril::key_reg::{ClosedKeyReg, KeyReg}; -use mithril::stm::{Stake, StmInitializer, StmParameters, StmSigner, StmVerificationKeyPoP}; -use mithril::RegisterError; +use mithril_stm::key_reg::{ClosedKeyReg, KeyReg}; +use mithril_stm::stm::{Stake, StmInitializer, StmParameters, StmSigner, StmVerificationKeyPoP}; +use mithril_stm::RegisterError; use blake2::{ digest::{consts::U32, FixedOutput}, diff --git a/mithril-common/src/crypto_helper/types.rs b/mithril-common/src/crypto_helper/types.rs index c87d6322149..5bd6e77d663 100644 --- a/mithril-common/src/crypto_helper/types.rs +++ b/mithril-common/src/crypto_helper/types.rs @@ -2,14 +2,14 @@ use crate::crypto_helper::cardano::{ KeyRegWrapper, ProtocolRegistrationErrorWrapper, StmInitializerWrapper, }; -use mithril::stm::{ +use mithril_stm::stm::{ Index, Stake, StmAggrSig, StmAggrVerificationKey, StmClerk, StmParameters, StmSig, StmSigner, StmVerificationKeyPoP, }; -use mithril::AggregationError; +use mithril_stm::AggregationError; #[cfg(any(test, feature = "allow_skip_signer_certification"))] -use mithril::{key_reg::KeyReg, stm::StmInitializer}; +use mithril_stm::{key_reg::KeyReg, stm::StmInitializer}; use blake2::{digest::consts::U32, Blake2b}; use ed25519_dalek; diff --git a/mithril-core/Cargo.toml b/mithril-core/Cargo.toml index b0017d17893..40f152bbf85 100644 --- a/mithril-core/Cargo.toml +++ b/mithril-core/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mithril" +name = "mithril-stm" version = "0.1.0" edition = { workspace = true } authors = { workspace = true } diff --git a/mithril-core/README.md b/mithril-core/README.md index 378ac8d1997..4ec35263691 100644 --- a/mithril-core/README.md +++ b/mithril-core/README.md @@ -24,11 +24,11 @@ The user-facing documentation for the above modules can be found [here](). # Example ```rust -use mithril::key_reg::KeyReg; -use mithril::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner}; +use mithril_stm::key_reg::KeyReg; +use mithril_stm::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner}; use rayon::prelude::*; -use mithril::error::AggregationFailure; +use mithril_stm::error::AggregationFailure; use rand_chacha::ChaCha20Rng; use rand_core::{RngCore, SeedableRng}; diff --git a/mithril-core/benches/size_benches.rs b/mithril-core/benches/size_benches.rs index 7b0867ec65f..6531f0e95fb 100644 --- a/mithril-core/benches/size_benches.rs +++ b/mithril-core/benches/size_benches.rs @@ -3,8 +3,8 @@ use blake2::{ digest::consts::{U32, U64}, Blake2b, Digest, }; -use mithril::key_reg::KeyReg; -use mithril::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner}; +use mithril_stm::key_reg::KeyReg; +use mithril_stm::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner}; use rand_chacha::ChaCha20Rng; use rand_core::{RngCore, SeedableRng}; use rayon::iter::ParallelIterator; diff --git a/mithril-core/benches/stm.rs b/mithril-core/benches/stm.rs index 56671e8e740..c2e5e490e78 100644 --- a/mithril-core/benches/stm.rs +++ b/mithril-core/benches/stm.rs @@ -1,8 +1,8 @@ use blake2::digest::{Digest, FixedOutput}; use blake2::{digest::consts::U32, Blake2b}; use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; -use mithril::key_reg::KeyReg; -use mithril::stm::{StmClerk, StmInitializer, StmParameters, StmSigner}; +use mithril_stm::key_reg::KeyReg; +use mithril_stm::stm::{StmClerk, StmInitializer, StmParameters, StmSigner}; use rand_chacha::ChaCha20Rng; use rand_core::{RngCore, SeedableRng}; use rayon::prelude::*; diff --git a/mithril-core/examples/key_registration.rs b/mithril-core/examples/key_registration.rs index d270f082356..904c0ef6d67 100644 --- a/mithril-core/examples/key_registration.rs +++ b/mithril-core/examples/key_registration.rs @@ -2,8 +2,8 @@ //! but instead by all the participants in the signature process. Contrarily to the full protocol //! run presented in `tests/integration.rs`, we explicitly treat each party individually. use blake2::{digest::consts::U32, Blake2b}; -use mithril::key_reg::{ClosedKeyReg, KeyReg}; -use mithril::stm::{Stake, StmClerk, StmInitializer, StmParameters, StmVerificationKeyPoP}; +use mithril_stm::key_reg::{ClosedKeyReg, KeyReg}; +use mithril_stm::stm::{Stake, StmClerk, StmInitializer, StmParameters, StmVerificationKeyPoP}; use rand_chacha::ChaCha20Rng; use rand_core::{RngCore, SeedableRng}; diff --git a/mithril-core/src/stm.rs b/mithril-core/src/stm.rs index 766248f2626..047da642553 100644 --- a/mithril-core/src/stm.rs +++ b/mithril-core/src/stm.rs @@ -7,9 +7,9 @@ //! ```rust //! # fn main() -> Result<(), Box> { //! use blake2::{Blake2b, digest::consts::U32}; -//! use mithril::key_reg::KeyReg; // Import key registration functionality -//! use mithril::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner}; -//! use mithril::AggregationError; +//! use mithril_stm::key_reg::KeyReg; // Import key registration functionality +//! use mithril_stm::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner}; +//! use mithril_stm::AggregationError; //! use rayon::prelude::*; // We use par_iter to speed things up //! //! use rand_chacha::ChaCha20Rng; diff --git a/mithril-core/tests/integration.rs b/mithril-core/tests/integration.rs index fd86f1e756f..fb26bf0b7f2 100644 --- a/mithril-core/tests/integration.rs +++ b/mithril-core/tests/integration.rs @@ -1,8 +1,8 @@ use blake2::{digest::consts::U32, Blake2b}; -use mithril::key_reg::KeyReg; -use mithril::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner}; -use mithril::AggregationError; +use mithril_stm::key_reg::KeyReg; +use mithril_stm::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner}; +use mithril_stm::AggregationError; use rayon::prelude::*; From ba8a06a2fa3460f0169fa69df534765312c307ca Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 11:02:38 +0100 Subject: [PATCH 03/10] Add multiple build types for 'mithril-core' Add .so and .a compilations artifacts for the library. --- mithril-core/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mithril-core/Cargo.toml b/mithril-core/Cargo.toml index 40f152bbf85..3f2a70e1be5 100644 --- a/mithril-core/Cargo.toml +++ b/mithril-core/Cargo.toml @@ -8,6 +8,9 @@ homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } +[lib] +crate-type = ["lib", "cdylib", "staticlib"] + [dependencies] blake2 = "0.10.4" blst = { version = "0.3.10" } From 568a90df453313d3162761fed14e39026bb2fd14 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 11:14:13 +0100 Subject: [PATCH 04/10] Add description and categories for 'mithril-core' Add these fields in the Cargo.toml file, they will be published on crates.io --- mithril-core/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mithril-core/Cargo.toml b/mithril-core/Cargo.toml index 3f2a70e1be5..e1f30cc999d 100644 --- a/mithril-core/Cargo.toml +++ b/mithril-core/Cargo.toml @@ -7,6 +7,8 @@ documentation = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } +description = "A Rust implementation of Mithril Stake-based Threshold Multisignatures (STMs)." +categories = ["cryptography"] [lib] crate-type = ["lib", "cdylib", "staticlib"] From f4a908db8e6984ef82c42b59a08e2001b9b661ef Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 11:22:08 +0100 Subject: [PATCH 05/10] Rename 'mitril-core' to 'mithril-stm' --- .gitignore | 6 +++--- Cargo.toml | 2 +- Makefile | 2 +- README.md | 2 +- docs/root/manual/developer-docs/references.md | 2 +- mithril-aggregator/Dockerfile | 4 ++-- mithril-client/Dockerfile | 4 ++-- mithril-common/Cargo.toml | 4 ++-- .../src/crypto_helper/cardano/key_certification.rs | 4 ++-- mithril-signer/Dockerfile | 4 ++-- {mithril-core => mithril-stm}/.dockerignore | 0 {mithril-core => mithril-stm}/.gitignore | 0 {mithril-core => mithril-stm}/Cargo.toml | 0 {mithril-core => mithril-stm}/Dockerfile | 0 {mithril-core => mithril-stm}/Makefile | 0 {mithril-core => mithril-stm}/README.md | 6 +++--- {mithril-core => mithril-stm}/benches/size_benches.rs | 0 {mithril-core => mithril-stm}/benches/stm.rs | 0 {mithril-core => mithril-stm}/examples/key_registration.rs | 0 {mithril-core => mithril-stm}/proptest-regressions/stm.txt | 0 {mithril-core => mithril-stm}/src/dense_mapping.rs | 0 {mithril-core => mithril-stm}/src/error.rs | 0 {mithril-core => mithril-stm}/src/key_reg.rs | 0 {mithril-core => mithril-stm}/src/lib.rs | 0 {mithril-core => mithril-stm}/src/merkle_tree.rs | 0 {mithril-core => mithril-stm}/src/multi_sig.rs | 0 {mithril-core => mithril-stm}/src/stm.rs | 0 {mithril-core => mithril-stm}/tests/integration.rs | 0 28 files changed, 20 insertions(+), 20 deletions(-) rename {mithril-core => mithril-stm}/.dockerignore (100%) rename {mithril-core => mithril-stm}/.gitignore (100%) rename {mithril-core => mithril-stm}/Cargo.toml (100%) rename {mithril-core => mithril-stm}/Dockerfile (100%) rename {mithril-core => mithril-stm}/Makefile (100%) rename {mithril-core => mithril-stm}/README.md (94%) rename {mithril-core => mithril-stm}/benches/size_benches.rs (100%) rename {mithril-core => mithril-stm}/benches/stm.rs (100%) rename {mithril-core => mithril-stm}/examples/key_registration.rs (100%) rename {mithril-core => mithril-stm}/proptest-regressions/stm.txt (100%) rename {mithril-core => mithril-stm}/src/dense_mapping.rs (100%) rename {mithril-core => mithril-stm}/src/error.rs (100%) rename {mithril-core => mithril-stm}/src/key_reg.rs (100%) rename {mithril-core => mithril-stm}/src/lib.rs (100%) rename {mithril-core => mithril-stm}/src/merkle_tree.rs (100%) rename {mithril-core => mithril-stm}/src/multi_sig.rs (100%) rename {mithril-core => mithril-stm}/src/stm.rs (100%) rename {mithril-core => mithril-stm}/tests/integration.rs (100%) diff --git a/.gitignore b/.gitignore index c343e76428f..2685dee72eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ mithril.cabal .stack-work/ .direnv/ -mithril-core/c-tests/tests -mithril-core/c-tests/tests.dSYM/ +mithril-stm/c-tests/tests +mithril-stm/c-tests/tests.dSYM/ *~ -mithril-core/proptest-regressions/ +mithril-stm/proptest-regressions/ *.dump .tmp/ .s.PGSQL* diff --git a/Cargo.toml b/Cargo.toml index 54c8694b9b3..7457f60f5ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = [ "mithril-aggregator", "mithril-client", "mithril-common", - "mithril-core", + "mithril-stm", "mithril-signer", "mithril-test-lab/mithril-end-to-end" ] diff --git a/Makefile b/Makefile index aff05ac8352..e743a27e12b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -COMPONENTS = mithril-common mithril-core mithril-aggregator mithril-client mithril-signer demo/protocol-demo mithril-test-lab +COMPONENTS = mithril-common mithril-stm mithril-aggregator mithril-client mithril-signer demo/protocol-demo mithril-test-lab GOALS := $(or $(MAKECMDGOALS),all) .PHONY: $(GOALS) $(COMPONENTS) diff --git a/README.md b/README.md index 6b79e69c4ff..8425a1ad56a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ This repository is sliced in the following parts: * [**Mithril Common**](./mithril-common): this is the **common** library that is used by the **Mithril Network** nodes. -* [**Mithril Core**](./mithril-core): the **core** library that implements **Mithril** protocol cryptographic engine. +* [**Mithril Core**](./mithril-stm): the **core** library that implements **Mithril** protocol cryptographic engine. * [**Mithril Explorer**](./mithril-explorer): the **explorer** website that connects to a **Mithril Aggregator** and displays its **Certificate Chain**. diff --git a/docs/root/manual/developer-docs/references.md b/docs/root/manual/developer-docs/references.md index 46ae5d0e513..87774fa1569 100644 --- a/docs/root/manual/developer-docs/references.md +++ b/docs/root/manual/developer-docs/references.md @@ -29,7 +29,7 @@ For more information about the **Mithril Protocol**, please refer to the [About | Dependency | Description | Source Repository | Rust Documentation | REST API |------------|-------------|:-----------------:|:------------------:|:------------:| | **Mithril Common** | This is the **common** library that is used by the **Mithril Network** nodes. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-common) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_common/index.html) | - -| **Mithril Core** | The **core** library that implements **Mithril** protocol cryptographic engine. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-core) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril/index.html) | - +| **Mithril Core** | The **core** library that implements **Mithril** protocol cryptographic engine. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-stm) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril/index.html) | - | **Mithril Aggregator** | The node of the **Mithril Network** responsible for collecting individual signatures from the **Mithril Signers** and aggregate them into a multisignature. The **Mithril Aggregator** uses this ability to provide certified snapshots of the **Cardano** blockchain. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-aggregator) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_aggregator/index.html) | [:arrow_upper_right:](/aggregator-api) | **Mithril Client** | The node of the **Mithril Network** responsible for restoring the **Cardano** blockchain on an empty node from a certified snapshot. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-client) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_client/index.html) | - | **Mithril Signer** | The node of the **Mithril Network** responsible for producing individual signatures that are collected and aggregated by the **Mithril Aggregator**. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-signer) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_signer/index.html) | - diff --git a/mithril-aggregator/Dockerfile b/mithril-aggregator/Dockerfile index ce223f26f73..a9ec5b93fb2 100644 --- a/mithril-aggregator/Dockerfile +++ b/mithril-aggregator/Dockerfile @@ -18,8 +18,8 @@ RUN adduser --no-create-home --disabled-password appuser WORKDIR /app # Copy local dependencies -COPY mithril-core/ /mithril-core/ -COPY Cargo.lock /mithril-core/ +COPY mithril-stm/ /mithril-stm/ +COPY Cargo.lock /mithril-stm/ COPY mithril-common/ /mithril-common/ COPY Cargo.lock /mithril-common/ diff --git a/mithril-client/Dockerfile b/mithril-client/Dockerfile index d49f86f477f..d58ca255321 100644 --- a/mithril-client/Dockerfile +++ b/mithril-client/Dockerfile @@ -18,8 +18,8 @@ RUN adduser --no-create-home --disabled-password appuser WORKDIR /app # Copy local dependencies -COPY mithril-core/ /mithril-core/ -COPY Cargo.lock /mithril-core/ +COPY mithril-stm/ /mithril-stm/ +COPY Cargo.lock /mithril-stm/ COPY mithril-common/ /mithril-common/ COPY Cargo.lock /mithril-common/ diff --git a/mithril-common/Cargo.toml b/mithril-common/Cargo.toml index 3fc2f2f1be9..5e56a9b541b 100644 --- a/mithril-common/Cargo.toml +++ b/mithril-common/Cargo.toml @@ -44,11 +44,11 @@ warp = "0.3" [target.'cfg(not(windows))'.dependencies] # non-windows: use default rug backend -mithril-stm = { path = "../mithril-core" } +mithril-stm = { path = "../mithril-stm" } [target.'cfg(windows)'.dependencies] # Windows doesn't support rug backend, fallback to num-integer -mithril-stm = { path = "../mithril-core", default-features = false, features = ["num-integer-backend"] } +mithril-stm = { path = "../mithril-stm", default-features = false, features = ["num-integer-backend"] } [dev-dependencies] slog-scope = "4.4.0" diff --git a/mithril-common/src/crypto_helper/cardano/key_certification.rs b/mithril-common/src/crypto_helper/cardano/key_certification.rs index f857800ee4e..f781934eec2 100644 --- a/mithril-common/src/crypto_helper/cardano/key_certification.rs +++ b/mithril-common/src/crypto_helper/cardano/key_certification.rs @@ -1,7 +1,7 @@ //! API for mithril key certification. //! Includes the wrappers for StmInitializer and KeyReg, and ProtocolRegistrationErrorWrapper. -//! These wrappers allows keeping mithril-core agnostic to Cardano, while providing some -//! guarantees that mithril-core will not be misused in the context of Cardano. +//! These wrappers allows keeping mithril-stm agnostic to Cardano, while providing some +//! guarantees that mithril-stm will not be misused in the context of Cardano. use crate::crypto_helper::cardano::{OpCert, ParseError, SerDeShelleyFileFormat}; use crate::crypto_helper::types::{ diff --git a/mithril-signer/Dockerfile b/mithril-signer/Dockerfile index 11df77dc717..029feb915be 100644 --- a/mithril-signer/Dockerfile +++ b/mithril-signer/Dockerfile @@ -18,8 +18,8 @@ RUN adduser --no-create-home --disabled-password appuser WORKDIR /app # Copy local dependencies -COPY mithril-core/ /mithril-core/ -COPY Cargo.lock /mithril-core/ +COPY mithril-stm/ /mithril-stm/ +COPY Cargo.lock /mithril-stm/ COPY mithril-common/ /mithril-common/ COPY Cargo.lock /mithril-common/ diff --git a/mithril-core/.dockerignore b/mithril-stm/.dockerignore similarity index 100% rename from mithril-core/.dockerignore rename to mithril-stm/.dockerignore diff --git a/mithril-core/.gitignore b/mithril-stm/.gitignore similarity index 100% rename from mithril-core/.gitignore rename to mithril-stm/.gitignore diff --git a/mithril-core/Cargo.toml b/mithril-stm/Cargo.toml similarity index 100% rename from mithril-core/Cargo.toml rename to mithril-stm/Cargo.toml diff --git a/mithril-core/Dockerfile b/mithril-stm/Dockerfile similarity index 100% rename from mithril-core/Dockerfile rename to mithril-stm/Dockerfile diff --git a/mithril-core/Makefile b/mithril-stm/Makefile similarity index 100% rename from mithril-core/Makefile rename to mithril-stm/Makefile diff --git a/mithril-core/README.md b/mithril-stm/README.md similarity index 94% rename from mithril-core/README.md rename to mithril-stm/README.md index 4ec35263691..4889d15acb3 100644 --- a/mithril-core/README.md +++ b/mithril-stm/README.md @@ -1,9 +1,9 @@ -Mithril-core ![CI workflow](https://github.com/input-output-hk/mithril/actions/workflows/ci.yml/badge.svg) ![crates.io](https://img.shields.io/crates/v/mithril_core.svg) +Mithril-stm ![CI workflow](https://github.com/input-output-hk/mithril/actions/workflows/ci.yml/badge.svg) ![crates.io](https://img.shields.io/crates/v/mithril_stm.svg) ======= This crate is ongoing work, has not been audited, and it's API is by no means final. Do not use in production. ### A rust implementation of Stake-based Threshold Multisignatures (STMs) -`mithril-core` implements Stake-based Threshold Multisignatures as described in the paper +`mithril-stm` implements Stake-based Threshold Multisignatures as described in the paper [Mithril: Stake-based Threshold Multisignatures](https://eprint.iacr.org/2021/916.pdf), by Pyrros Chaidos and Aggelos Kiayias. @@ -160,7 +160,7 @@ STM/Blake2b/Verification/k: 250, m: 1523, nr_parties: 2000 ``` # ToDo list once we go public -- [ ] Upload mithril-core to crates.io +- [ ] Upload mithril-stm to crates.io - [ ] Ensure that the badges are working - [ ] Update links for crates and docs - [ ] Error handling diff --git a/mithril-core/benches/size_benches.rs b/mithril-stm/benches/size_benches.rs similarity index 100% rename from mithril-core/benches/size_benches.rs rename to mithril-stm/benches/size_benches.rs diff --git a/mithril-core/benches/stm.rs b/mithril-stm/benches/stm.rs similarity index 100% rename from mithril-core/benches/stm.rs rename to mithril-stm/benches/stm.rs diff --git a/mithril-core/examples/key_registration.rs b/mithril-stm/examples/key_registration.rs similarity index 100% rename from mithril-core/examples/key_registration.rs rename to mithril-stm/examples/key_registration.rs diff --git a/mithril-core/proptest-regressions/stm.txt b/mithril-stm/proptest-regressions/stm.txt similarity index 100% rename from mithril-core/proptest-regressions/stm.txt rename to mithril-stm/proptest-regressions/stm.txt diff --git a/mithril-core/src/dense_mapping.rs b/mithril-stm/src/dense_mapping.rs similarity index 100% rename from mithril-core/src/dense_mapping.rs rename to mithril-stm/src/dense_mapping.rs diff --git a/mithril-core/src/error.rs b/mithril-stm/src/error.rs similarity index 100% rename from mithril-core/src/error.rs rename to mithril-stm/src/error.rs diff --git a/mithril-core/src/key_reg.rs b/mithril-stm/src/key_reg.rs similarity index 100% rename from mithril-core/src/key_reg.rs rename to mithril-stm/src/key_reg.rs diff --git a/mithril-core/src/lib.rs b/mithril-stm/src/lib.rs similarity index 100% rename from mithril-core/src/lib.rs rename to mithril-stm/src/lib.rs diff --git a/mithril-core/src/merkle_tree.rs b/mithril-stm/src/merkle_tree.rs similarity index 100% rename from mithril-core/src/merkle_tree.rs rename to mithril-stm/src/merkle_tree.rs diff --git a/mithril-core/src/multi_sig.rs b/mithril-stm/src/multi_sig.rs similarity index 100% rename from mithril-core/src/multi_sig.rs rename to mithril-stm/src/multi_sig.rs diff --git a/mithril-core/src/stm.rs b/mithril-stm/src/stm.rs similarity index 100% rename from mithril-core/src/stm.rs rename to mithril-stm/src/stm.rs diff --git a/mithril-core/tests/integration.rs b/mithril-stm/tests/integration.rs similarity index 100% rename from mithril-core/tests/integration.rs rename to mithril-stm/tests/integration.rs From 9d782b2119f4a185b2b6553d7f682486c1b71ee6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 11:22:46 +0100 Subject: [PATCH 06/10] Clean README.md of 'mithril-stm' --- mithril-stm/README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mithril-stm/README.md b/mithril-stm/README.md index 4889d15acb3..40879812611 100644 --- a/mithril-stm/README.md +++ b/mithril-stm/README.md @@ -159,8 +159,3 @@ STM/Blake2b/Verification/k: 250, m: 1523, nr_parties: 2000 ``` -# ToDo list once we go public -- [ ] Upload mithril-stm to crates.io -- [ ] Ensure that the badges are working -- [ ] Update links for crates and docs -- [ ] Error handling From f8dc6ca9c5ac7f1f7f9387fae594c2fbaa0cc5b2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 11:38:03 +0100 Subject: [PATCH 07/10] Fix remaining 'Core' mentions Replace them with 'Stm' for clarity. --- README.md | 2 +- docs/root/manual/developer-docs/references.md | 2 +- mithril-aggregator/src/multi_signer.rs | 2 +- .../cardano/key_certification.rs | 4 +-- mithril-common/src/crypto_helper/mod.rs | 2 +- .../src/crypto_helper/tests_setup.rs | 2 +- mithril-common/src/crypto_helper/types.rs | 30 +++++++++---------- .../src/entities/single_signatures.rs | 2 +- mithril-common/src/lib.rs | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 8425a1ad56a..3c3683947b9 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ This repository is sliced in the following parts: * [**Mithril Common**](./mithril-common): this is the **common** library that is used by the **Mithril Network** nodes. -* [**Mithril Core**](./mithril-stm): the **core** library that implements **Mithril** protocol cryptographic engine. +* [**Mithril STM**](./mithril-stm): the **core** library that implements **Mithril** protocol cryptographic engine. * [**Mithril Explorer**](./mithril-explorer): the **explorer** website that connects to a **Mithril Aggregator** and displays its **Certificate Chain**. diff --git a/docs/root/manual/developer-docs/references.md b/docs/root/manual/developer-docs/references.md index 87774fa1569..19d07b4ccca 100644 --- a/docs/root/manual/developer-docs/references.md +++ b/docs/root/manual/developer-docs/references.md @@ -29,7 +29,7 @@ For more information about the **Mithril Protocol**, please refer to the [About | Dependency | Description | Source Repository | Rust Documentation | REST API |------------|-------------|:-----------------:|:------------------:|:------------:| | **Mithril Common** | This is the **common** library that is used by the **Mithril Network** nodes. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-common) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_common/index.html) | - -| **Mithril Core** | The **core** library that implements **Mithril** protocol cryptographic engine. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-stm) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril/index.html) | - +| **Mithril STM** | The **core** library that implements **Mithril** protocol cryptographic engine. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-stm) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_stm/index.html) | - | **Mithril Aggregator** | The node of the **Mithril Network** responsible for collecting individual signatures from the **Mithril Signers** and aggregate them into a multisignature. The **Mithril Aggregator** uses this ability to provide certified snapshots of the **Cardano** blockchain. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-aggregator) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_aggregator/index.html) | [:arrow_upper_right:](/aggregator-api) | **Mithril Client** | The node of the **Mithril Network** responsible for restoring the **Cardano** blockchain on an empty node from a certified snapshot. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-client) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_client/index.html) | - | **Mithril Signer** | The node of the **Mithril Network** responsible for producing individual signatures that are collected and aggregated by the **Mithril Aggregator**. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-signer) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_signer/index.html) | - diff --git a/mithril-aggregator/src/multi_signer.rs b/mithril-aggregator/src/multi_signer.rs index e4c6182ce6d..bbff025372a 100644 --- a/mithril-aggregator/src/multi_signer.rs +++ b/mithril-aggregator/src/multi_signer.rs @@ -48,7 +48,7 @@ pub enum ProtocolError { #[error("codec error: '{0}'")] Codec(String), - /// Mithril Core library returned an error. + /// Mithril STM library returned an error. #[error("core error: '{0}'")] Core(String), diff --git a/mithril-common/src/crypto_helper/cardano/key_certification.rs b/mithril-common/src/crypto_helper/cardano/key_certification.rs index f781934eec2..5b19b587088 100644 --- a/mithril-common/src/crypto_helper/cardano/key_certification.rs +++ b/mithril-common/src/crypto_helper/cardano/key_certification.rs @@ -79,7 +79,7 @@ pub enum ProtocolInitializerErrorWrapper { #[error("KES key cannot be updated for period {0}")] KesUpdate(KESPeriod), } -/// Wrapper structure for [MithrilCore:StmInitializer](mithril::stm::StmInitializer). +/// Wrapper structure for [MithrilStm:StmInitializer](mithril::stm::StmInitializer). /// It now obtains a KES signature over the Mithril key. This allows the signers prove /// their correct identity with respect to a Cardano PoolID. #[derive(Debug, Clone, Serialize, Deserialize)] @@ -88,7 +88,7 @@ pub struct StmInitializerWrapper { kes_signature: Option, // todo: The option is ONLY for a smooth transition. We have to remove this. } -/// Wrapper structure for [MithrilCore:KeyReg](mithril::key_reg::KeyReg). +/// Wrapper structure for [MithrilStm:KeyReg](mithril::key_reg::KeyReg). /// The wrapper not only contains a map between `Mithril vkey <-> Stake`, but also /// a map `PoolID <-> Stake`. This information is recovered from the node state, and /// is used to verify the identity of a Mithril signer. Furthermore, the `register` function diff --git a/mithril-common/src/crypto_helper/mod.rs b/mithril-common/src/crypto_helper/mod.rs index 7a24a7bc346..3901987632c 100644 --- a/mithril-common/src/crypto_helper/mod.rs +++ b/mithril-common/src/crypto_helper/mod.rs @@ -1,4 +1,4 @@ -//! Tools and types to abstract the use of the [Mithril Core library](https://mithril.network/rust-doc/mithril/index.html) +//! Tools and types to abstract the use of the [Mithril STM library](https://mithril.network/rust-doc/mithril_stm/index.html) mod cardano; mod codec; diff --git a/mithril-common/src/crypto_helper/tests_setup.rs b/mithril-common/src/crypto_helper/tests_setup.rs index d49318a1f68..bfb11110876 100644 --- a/mithril-common/src/crypto_helper/tests_setup.rs +++ b/mithril-common/src/crypto_helper/tests_setup.rs @@ -1,4 +1,4 @@ -//! Test data builders for Mithril Core types, for testing purpose. +//! Test data builders for Mithril STM types, for testing purpose. use super::cardano::ColdKeyGenerator; use super::{genesis::*, key_encode_hex, types::*, OpCert, SerDeShelleyFileFormat}; use crate::certificate_chain::CertificateGenesisProducer; diff --git a/mithril-common/src/crypto_helper/types.rs b/mithril-common/src/crypto_helper/types.rs index 5bd6e77d663..5feae654082 100644 --- a/mithril-common/src/crypto_helper/types.rs +++ b/mithril-common/src/crypto_helper/types.rs @@ -24,43 +24,43 @@ type D = Blake2b; /// The id of a mithril party. pub type ProtocolPartyId = String; -/// Alias of [MithrilCore:Stake](type@mithril::stm::Stake). +/// Alias of [MithrilStm:Stake](type@mithril::stm::Stake). pub type ProtocolStake = Stake; /// A list of [Party Id][ProtocolPartyId] associated with its [Stake][ProtocolStake]. pub type ProtocolStakeDistribution = Vec<(ProtocolPartyId, ProtocolStake)>; -/// Alias of [MithrilCore::StmParameters](struct@mithril::stm::StmParameters). +/// Alias of [MithrilStm::StmParameters](struct@mithril::stm::StmParameters). pub type ProtocolParameters = StmParameters; -/// Alias of [MithrilCore::Index](type@mithril::stm::Index). +/// Alias of [MithrilStm::Index](type@mithril::stm::Index). pub type ProtocolLotteryIndex = Index; -/// Alias of [MithrilCore:StmSigner](struct@mithril::stm::StmSigner). +/// Alias of [MithrilStm:StmSigner](struct@mithril::stm::StmSigner). pub type ProtocolSigner = StmSigner; -/// Alias of a wrapper of [MithrilCore:StmInitializer](struct@mithril::stm::StmInitializer). +/// Alias of a wrapper of [MithrilStm:StmInitializer](struct@mithril::stm::StmInitializer). pub type ProtocolInitializer = StmInitializerWrapper; -/// Alias of [MithrilCore:StmClerk](struct@mithril::stm::StmClerk). +/// Alias of [MithrilStm:StmClerk](struct@mithril::stm::StmClerk). pub type ProtocolClerk = StmClerk; -/// Alias of a wrapper of [MithrilCore:KeyReg](struct@mithril::key_reg::KeyReg). +/// Alias of a wrapper of [MithrilStm:KeyReg](struct@mithril::key_reg::KeyReg). pub type ProtocolKeyRegistration = KeyRegWrapper; -/// Alias of [MithrilCore:StmSig](struct@mithril::stm::StmSig). +/// Alias of [MithrilStm:StmSig](struct@mithril::stm::StmSig). pub type ProtocolSingleSignature = StmSig; -/// Alias of [MithrilCore:StmAggrSig](struct@mithril::stm::StmAggrSig). +/// Alias of [MithrilStm:StmAggrSig](struct@mithril::stm::StmAggrSig). pub type ProtocolMultiSignature = StmAggrSig; -/// Alias of [MithrilCore:StmVerificationKeyPoP](type@mithril::stm::StmVerificationKeyPoP). +/// Alias of [MithrilStm:StmVerificationKeyPoP](type@mithril::stm::StmVerificationKeyPoP). pub type ProtocolSignerVerificationKey = StmVerificationKeyPoP; /// Alias of [KES:Sum6KesSig](https://github.com/input-output-hk/kes/blob/master/src/kes.rs). pub type ProtocolSignerVerificationKeySignature = Sum6KesSig; -/// Alias of [MithrilCore:StmAggrVerificationKey](struct@mithril::stm::StmAggrVerificationKey). +/// Alias of [MithrilStm:StmAggrVerificationKey](struct@mithril::stm::StmAggrVerificationKey). pub type ProtocolAggregateVerificationKey = StmAggrVerificationKey; /// Alias of [Ed25519:PublicKey](https://docs.rs/ed25519-dalek/latest/ed25519_dalek/struct.PublicKey.html). @@ -73,17 +73,17 @@ pub type ProtocolGenesisSecretKey = ed25519_dalek::SecretKey; pub type ProtocolGenesisSignature = ed25519_dalek::Signature; // Error alias -/// Alias of a wrapper of [MithrilCore:RegisterError](enum@mithril::RegisterError). +/// Alias of a wrapper of [MithrilStm:RegisterError](enum@mithril::RegisterError). pub type ProtocolRegistrationError = ProtocolRegistrationErrorWrapper; -/// Alias of [MithrilCore:AggregationError](enum@mithril::AggregationError). +/// Alias of [MithrilStm:AggregationError](enum@mithril::AggregationError). pub type ProtocolAggregationError = AggregationError; // Test only -/// (Test only) Alias of [MithrilCore:StmInitializer](struct@mithril::stm::StmInitializer). +/// (Test only) Alias of [MithrilStm:StmInitializer](struct@mithril::stm::StmInitializer). #[cfg(any(test, feature = "allow_skip_signer_certification"))] pub type ProtocolInitializerNotCertified = StmInitializer; -/// (Test only) Alias of [MithrilCore:KeyReg](struct@mithril::key_reg::KeyReg). (Test only) +/// (Test only) Alias of [MithrilStm:KeyReg](struct@mithril::key_reg::KeyReg). (Test only) #[cfg(any(test, feature = "allow_skip_signer_certification"))] pub type ProtocolKeyRegistrationNotCertified = KeyReg; diff --git a/mithril-common/src/entities/single_signatures.rs b/mithril-common/src/entities/single_signatures.rs index 8db29704c2a..570641be604 100644 --- a/mithril-common/src/entities/single_signatures.rs +++ b/mithril-common/src/entities/single_signatures.rs @@ -31,7 +31,7 @@ impl SingleSignatures { } } - /// Convert this [SingleSignatures] to its corresponding [MithrilCore Signature][ProtocolSingleSignature]. + /// Convert this [SingleSignatures] to its corresponding [MithrilStm Signature][ProtocolSingleSignature]. pub fn to_protocol_signature(&self) -> Result { match key_decode_hex::(&self.signature) { Ok(signature) => Ok(signature), diff --git a/mithril-common/src/lib.rs b/mithril-common/src/lib.rs index 0bb58961877..928a630e602 100644 --- a/mithril-common/src/lib.rs +++ b/mithril-common/src/lib.rs @@ -5,7 +5,7 @@ //! Provide: //! - A way to store data with the [store] types //! - [Digester][digesters] to compute mithril digest from a Cardano database -//! - Helpers for the [Mithril Core](https://mithril.network/rust-doc/mithril/index.html) +//! - Helpers for the [Mithril STM](https://mithril.network/rust-doc/mithril_stm/index.html) //! lib with the [crypto_helper]. //! - A [certificate chain] used to validate the Certificate Chain created by an aggregator //! - The [entities] used by, and exchanged between, the aggregator, signers and client. From c03a7e594c701187bb5092d9b0f09aefde4165d1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 11:42:46 +0100 Subject: [PATCH 08/10] Fix cargo sort workspace --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7457f60f5ec..4984864dd85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,8 +7,8 @@ members = [ "mithril-aggregator", "mithril-client", "mithril-common", - "mithril-stm", "mithril-signer", + "mithril-stm", "mithril-test-lab/mithril-end-to-end" ] From 9ad265b1895f5119060f536110c9c6622909dfd9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 17:24:58 +0100 Subject: [PATCH 09/10] Fix doc links --- .../cardano/key_certification.rs | 4 +-- mithril-common/src/crypto_helper/types.rs | 30 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mithril-common/src/crypto_helper/cardano/key_certification.rs b/mithril-common/src/crypto_helper/cardano/key_certification.rs index 5b19b587088..de2c2ec04ac 100644 --- a/mithril-common/src/crypto_helper/cardano/key_certification.rs +++ b/mithril-common/src/crypto_helper/cardano/key_certification.rs @@ -79,7 +79,7 @@ pub enum ProtocolInitializerErrorWrapper { #[error("KES key cannot be updated for period {0}")] KesUpdate(KESPeriod), } -/// Wrapper structure for [MithrilStm:StmInitializer](mithril::stm::StmInitializer). +/// Wrapper structure for [MithrilStm:StmInitializer](mithril_stm::stm::StmInitializer). /// It now obtains a KES signature over the Mithril key. This allows the signers prove /// their correct identity with respect to a Cardano PoolID. #[derive(Debug, Clone, Serialize, Deserialize)] @@ -88,7 +88,7 @@ pub struct StmInitializerWrapper { kes_signature: Option, // todo: The option is ONLY for a smooth transition. We have to remove this. } -/// Wrapper structure for [MithrilStm:KeyReg](mithril::key_reg::KeyReg). +/// Wrapper structure for [MithrilStm:KeyReg](mithril_stm::key_reg::KeyReg). /// The wrapper not only contains a map between `Mithril vkey <-> Stake`, but also /// a map `PoolID <-> Stake`. This information is recovered from the node state, and /// is used to verify the identity of a Mithril signer. Furthermore, the `register` function diff --git a/mithril-common/src/crypto_helper/types.rs b/mithril-common/src/crypto_helper/types.rs index 5feae654082..251057b1048 100644 --- a/mithril-common/src/crypto_helper/types.rs +++ b/mithril-common/src/crypto_helper/types.rs @@ -24,43 +24,43 @@ type D = Blake2b; /// The id of a mithril party. pub type ProtocolPartyId = String; -/// Alias of [MithrilStm:Stake](type@mithril::stm::Stake). +/// Alias of [MithrilStm:Stake](type@mithril_stm::stm::Stake). pub type ProtocolStake = Stake; /// A list of [Party Id][ProtocolPartyId] associated with its [Stake][ProtocolStake]. pub type ProtocolStakeDistribution = Vec<(ProtocolPartyId, ProtocolStake)>; -/// Alias of [MithrilStm::StmParameters](struct@mithril::stm::StmParameters). +/// Alias of [MithrilStm::StmParameters](struct@mithril_stm::stm::StmParameters). pub type ProtocolParameters = StmParameters; -/// Alias of [MithrilStm::Index](type@mithril::stm::Index). +/// Alias of [MithrilStm::Index](type@mithril_stm::stm::Index). pub type ProtocolLotteryIndex = Index; -/// Alias of [MithrilStm:StmSigner](struct@mithril::stm::StmSigner). +/// Alias of [MithrilStm:StmSigner](struct@mithril_stm::stm::StmSigner). pub type ProtocolSigner = StmSigner; -/// Alias of a wrapper of [MithrilStm:StmInitializer](struct@mithril::stm::StmInitializer). +/// Alias of a wrapper of [MithrilStm:StmInitializer](struct@mithril_stm::stm::StmInitializer). pub type ProtocolInitializer = StmInitializerWrapper; -/// Alias of [MithrilStm:StmClerk](struct@mithril::stm::StmClerk). +/// Alias of [MithrilStm:StmClerk](struct@mithril_stm::stm::StmClerk). pub type ProtocolClerk = StmClerk; -/// Alias of a wrapper of [MithrilStm:KeyReg](struct@mithril::key_reg::KeyReg). +/// Alias of a wrapper of [MithrilStm:KeyReg](struct@mithril_stm::key_reg::KeyReg). pub type ProtocolKeyRegistration = KeyRegWrapper; -/// Alias of [MithrilStm:StmSig](struct@mithril::stm::StmSig). +/// Alias of [MithrilStm:StmSig](struct@mithril_stm::stm::StmSig). pub type ProtocolSingleSignature = StmSig; -/// Alias of [MithrilStm:StmAggrSig](struct@mithril::stm::StmAggrSig). +/// Alias of [MithrilStm:StmAggrSig](struct@mithril_stm::stm::StmAggrSig). pub type ProtocolMultiSignature = StmAggrSig; -/// Alias of [MithrilStm:StmVerificationKeyPoP](type@mithril::stm::StmVerificationKeyPoP). +/// Alias of [MithrilStm:StmVerificationKeyPoP](type@mithril_stm::stm::StmVerificationKeyPoP). pub type ProtocolSignerVerificationKey = StmVerificationKeyPoP; /// Alias of [KES:Sum6KesSig](https://github.com/input-output-hk/kes/blob/master/src/kes.rs). pub type ProtocolSignerVerificationKeySignature = Sum6KesSig; -/// Alias of [MithrilStm:StmAggrVerificationKey](struct@mithril::stm::StmAggrVerificationKey). +/// Alias of [MithrilStm:StmAggrVerificationKey](struct@mithril_stm::stm::StmAggrVerificationKey). pub type ProtocolAggregateVerificationKey = StmAggrVerificationKey; /// Alias of [Ed25519:PublicKey](https://docs.rs/ed25519-dalek/latest/ed25519_dalek/struct.PublicKey.html). @@ -73,17 +73,17 @@ pub type ProtocolGenesisSecretKey = ed25519_dalek::SecretKey; pub type ProtocolGenesisSignature = ed25519_dalek::Signature; // Error alias -/// Alias of a wrapper of [MithrilStm:RegisterError](enum@mithril::RegisterError). +/// Alias of a wrapper of [MithrilStm:RegisterError](enum@mithril_stm::RegisterError). pub type ProtocolRegistrationError = ProtocolRegistrationErrorWrapper; -/// Alias of [MithrilStm:AggregationError](enum@mithril::AggregationError). +/// Alias of [MithrilStm:AggregationError](enum@mithril_stm::AggregationError). pub type ProtocolAggregationError = AggregationError; // Test only -/// (Test only) Alias of [MithrilStm:StmInitializer](struct@mithril::stm::StmInitializer). +/// (Test only) Alias of [MithrilStm:StmInitializer](struct@mithril_stm::stm::StmInitializer). #[cfg(any(test, feature = "allow_skip_signer_certification"))] pub type ProtocolInitializerNotCertified = StmInitializer; -/// (Test only) Alias of [MithrilStm:KeyReg](struct@mithril::key_reg::KeyReg). (Test only) +/// (Test only) Alias of [MithrilStm:KeyReg](struct@mithril_stm::key_reg::KeyReg). (Test only) #[cfg(any(test, feature = "allow_skip_signer_certification"))] pub type ProtocolKeyRegistrationNotCertified = KeyReg; From 66d583ba609e4f7b4fd1c1553bf913a7152342c7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Wed, 23 Nov 2022 12:47:24 +0100 Subject: [PATCH 10/10] Add crate publication to crates.io --- .github/workflows/release.yml | 57 +++++++++++++++++++++++++++++++++++ mithril-stm/Cargo.toml | 6 ++++ 2 files changed, 63 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e5f0271be7..e688810c254 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,63 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} + check-deploy-crates-io: + runs-on: ubuntu-22.04 + outputs: + should-deploy: ${{ steps.check_version.outputs.should_deploy }} + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Check crate latest version + id: check_version + run: | + LATEST_REMOTE_VERSION=$(wget -q -O - https://crates.io/api/v1/crates/mithril-stm | jq -r '.crate.newest_version') + LOCAL_VERSION=$(cargo metadata --quiet --no-deps | jq -r '.packages[] | select(.name=="mithril-stm") | .version') + echo "Latest crate.io version: $LATEST_REMOTE_VERSION" + echo "Local version: $LOCAL_VERSION" + + if [ "$LOCAL_VERSION" != "$LATEST_REMOTE_VERSION" ]; then + echo "Local version is newer than remote version: we will publish to crates.io" + echo "should_deploy=true" >> $GITHUB_OUTPUT + else + echo "Local version and remote version are the same: no need to publish to crates.io" + echo "should_deploy=false" >> $GITHUB_OUTPUT + fi + + deploy-crates-io: + runs-on: ubuntu-22.04 + needs: check-deploy-crates-io + if: needs.check-deploy-crates-io.outputs.should-deploy == 'true' + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - name: Cargo publish dry run + uses: actions-rs/cargo@v1 + with: + command: publish + args: -p mithril-stm --dry-run + + - name: Cargo package list + uses: actions-rs/cargo@v1 + with: + command: package + args: -p mithril-stm --list + + # We use the '--dry-run' arg until we have a valid CRATES_IO_API_TOKEN to avoid the workflow to crash + - name: Cargo publish + uses: actions-rs/cargo@v1 + with: + command: publish + args: -p mithril-stm --token ${{ secrets.CRATES_IO_API_TOKEN }} --dry-run + deploy-release: strategy: fail-fast: false diff --git a/mithril-stm/Cargo.toml b/mithril-stm/Cargo.toml index e1f30cc999d..9fcdf44f8a3 100644 --- a/mithril-stm/Cargo.toml +++ b/mithril-stm/Cargo.toml @@ -9,6 +9,12 @@ license = { workspace = true } repository = { workspace = true } description = "A Rust implementation of Mithril Stake-based Threshold Multisignatures (STMs)." categories = ["cryptography"] +include = [ + "**/*.rs", + "Cargo.toml", + "README.md", + ".gitignore", +] [lib] crate-type = ["lib", "cdylib", "staticlib"]