diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 57abf78d04e..f10be12ab95 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,9 +22,32 @@ jobs: uses: ./.github/workflows/actions/toolchain-and-cache with: cache-version: ${{ secrets.CACHE_VERSION }} + cargo-tools: clippy-sarif sarif-fmt - name: Generate cargo doc - run: cargo doc --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client + run: | + cargo doc --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator \ + -p mithril-signer -p mithril-client --message-format=json \ + | clippy-sarif | tee rust-cargo-doc-results.sarif | sarif-fmt + + # Update tool sarif metadata from "clippy" to "cargo-doc" (since it's set this way by clippy-sarif) + contents=$(cat rust-cargo-doc-results.sarif \ + | jq '.runs[].tool.driver.name = "cargo-doc"' \ + | jq '.runs[].tool.driver.informationUri = "https://doc.rust-lang.org/cargo/commands/cargo-doc.html"' \ + ) + echo -E "${contents}" > rust-cargo-doc-results.sarif + + # Make this step fail if any warning has been found + if [[ $(cat rust-cargo-doc-results.sarif | jq '.runs[0].results') != "[]" ]]; then + false + fi + + - name: Upload cargo-doc results to GitHub + if: success() || failure() + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: rust-cargo-doc-results.sarif + wait-for-processing: true - name: Publish Mithril-rust-doc uses: actions/upload-artifact@v3 diff --git a/Cargo.lock b/Cargo.lock index 2e1c5c2682f..9efc28e8a5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2063,7 +2063,7 @@ dependencies = [ [[package]] name = "mithril-aggregator" -version = "0.3.8" +version = "0.3.9" dependencies = [ "async-trait", "chrono", @@ -2126,7 +2126,7 @@ dependencies = [ [[package]] name = "mithril-common" -version = "0.2.44" +version = "0.2.45" dependencies = [ "async-trait", "bech32", diff --git a/mithril-aggregator/Cargo.toml b/mithril-aggregator/Cargo.toml index 16674429405..3127bb20c24 100644 --- a/mithril-aggregator/Cargo.toml +++ b/mithril-aggregator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mithril-aggregator" -version = "0.3.8" +version = "0.3.9" description = "A Mithril Aggregator server" authors = { workspace = true } edition = { workspace = true } diff --git a/mithril-aggregator/src/certifier_service.rs b/mithril-aggregator/src/certifier_service.rs index cee18331b8e..73fad144588 100644 --- a/mithril-aggregator/src/certifier_service.rs +++ b/mithril-aggregator/src/certifier_service.rs @@ -1,7 +1,7 @@ //! ## Certifier Service //! //! This service is responsible of [OpenMessage] cycle of life. It creates open -//! messages and turn them into [CertificateRecord]. To do so, it registers +//! messages and turn them into [Certificate]. To do so, it registers //! single signatures and deal with the multi_signer for aggregate signature //! creation. use std::sync::Arc; diff --git a/mithril-aggregator/src/database/provider/open_message.rs b/mithril-aggregator/src/database/provider/open_message.rs index 2adf5de5b86..ea85ae8eb67 100644 --- a/mithril-aggregator/src/database/provider/open_message.rs +++ b/mithril-aggregator/src/database/provider/open_message.rs @@ -471,7 +471,7 @@ impl OpenMessageRepository { Self { connection } } - /// Return the latest [OpenMessage] for the given Epoch and [SignedEntityType]. + /// Return the latest [OpenMessageRecord] for the given Epoch and [SignedEntityType]. pub async fn get_open_message( &self, signed_entity_type: &SignedEntityType, @@ -486,7 +486,7 @@ impl OpenMessageRepository { Ok(messages.next()) } - /// Create a new [OpenMessage] in the database. + /// Create a new [OpenMessageRecord] in the database. pub async fn create_open_message( &self, epoch: Epoch, @@ -503,7 +503,7 @@ impl OpenMessageRepository { .ok_or_else(|| panic!("Inserting an open_message should not return nothing.")) } - /// Updates an [OpenMessage] in the database. + /// Updates an [OpenMessageRecord] in the database. pub async fn update_open_message( &self, open_message: &OpenMessageRecord, @@ -518,7 +518,7 @@ impl OpenMessageRepository { .ok_or_else(|| panic!("Updating an open_message should not return nothing.")) } - /// Remove all the [OpenMessage] for the given Epoch in the database. + /// Remove all the [OpenMessageRecord] for the given Epoch in the database. /// It returns the number of messages removed. pub async fn clean_epoch(&self, epoch: Epoch) -> StdResult { let lock = self.connection.lock().await; diff --git a/mithril-aggregator/src/dependency_injection/builder.rs b/mithril-aggregator/src/dependency_injection/builder.rs index 4c9eadbb032..44cbb1a9149 100644 --- a/mithril-aggregator/src/dependency_injection/builder.rs +++ b/mithril-aggregator/src/dependency_injection/builder.rs @@ -864,7 +864,7 @@ impl DependenciesBuilder { Ok(signer_recorder) } - /// [SignerRecorder] + /// [SignerRecorder] service pub async fn get_signer_recorder(&mut self) -> Result> { if self.signer_recorder.is_none() { self.signer_recorder = Some(self.build_signer_recorder().await?); diff --git a/mithril-aggregator/src/lib.rs b/mithril-aggregator/src/lib.rs index 51ea56d46a8..2d44df6fac3 100644 --- a/mithril-aggregator/src/lib.rs +++ b/mithril-aggregator/src/lib.rs @@ -34,10 +34,14 @@ mod store; pub mod ticker_service; mod tools; +pub use crate::artifact_builder::{ArtifactBuilder, ArtifactBuilderService}; pub use crate::configuration::{ Configuration, DefaultConfiguration, ExecutionEnvironment, SnapshotUploaderType, }; pub use crate::multi_signer::{MultiSigner, MultiSignerImpl, ProtocolError}; +pub use crate::signable_builder::{ + ImmutableSignableBuilder, MithrilStakeDistributionSignableBuilder, SignableBuilderService, +}; pub use crate::snapshot_stores::{LocalSnapshotStore, SnapshotStore}; pub use command_args::MainOpts; pub use dependency::DependencyManager; @@ -48,8 +52,8 @@ pub use runtime::{ AggregatorConfig, AggregatorRunner, AggregatorRunnerTrait, AggregatorRuntime, RuntimeError, }; pub use signer_registerer::{ - MithrilSignerRegisterer, SignerRegisterer, SignerRegistrationError, SignerRegistrationRound, - SignerRegistrationRoundOpener, + MithrilSignerRegisterer, SignerRecorder, SignerRegisterer, SignerRegistrationError, + SignerRegistrationRound, SignerRegistrationRoundOpener, }; pub use snapshot_uploaders::{ DumbSnapshotUploader, LocalSnapshotUploader, RemoteSnapshotUploader, SnapshotUploader, diff --git a/mithril-aggregator/src/signable_builder/immutable_signable_builder.rs b/mithril-aggregator/src/signable_builder/immutable_signable_builder.rs index e5517a193f3..7eea1756172 100644 --- a/mithril-aggregator/src/signable_builder/immutable_signable_builder.rs +++ b/mithril-aggregator/src/signable_builder/immutable_signable_builder.rs @@ -8,6 +8,7 @@ use mithril_common::{ StdResult, }; +/// A [SignableBuilder] for cardano immutable files. pub struct ImmutableSignableBuilder { immutable_digester: Arc, } diff --git a/mithril-aggregator/src/signable_builder/mithril_stake_distribution.rs b/mithril-aggregator/src/signable_builder/mithril_stake_distribution.rs index cfa0c6f5288..68ae922c6d8 100644 --- a/mithril-aggregator/src/signable_builder/mithril_stake_distribution.rs +++ b/mithril-aggregator/src/signable_builder/mithril_stake_distribution.rs @@ -11,7 +11,7 @@ use mithril_common::{ use crate::MultiSigner; -/// A [MithrilStakeDistributionSignable] builder +/// A [SignableBuilder] for mithril stake distribution. pub struct MithrilStakeDistributionSignableBuilder { multi_signer: Arc>, } diff --git a/mithril-common/Cargo.toml b/mithril-common/Cargo.toml index 63dd1bbd366..1e963308954 100644 --- a/mithril-common/Cargo.toml +++ b/mithril-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mithril-common" -version = "0.2.44" +version = "0.2.45" authors = { workspace = true } edition = { workspace = true } documentation = { workspace = true } diff --git a/mithril-common/src/crypto_helper/mod.rs b/mithril-common/src/crypto_helper/mod.rs index eadd46b9762..8fd6245e022 100644 --- a/mithril-common/src/crypto_helper/mod.rs +++ b/mithril-common/src/crypto_helper/mod.rs @@ -8,8 +8,10 @@ mod genesis; pub mod tests_setup; mod types; -pub use cardano::ColdKeyGenerator; -pub use cardano::{KESPeriod, OpCert, SerDeShelleyFileFormat, Sum6KesBytes}; +pub use cardano::{ + ColdKeyGenerator, KESPeriod, OpCert, ProtocolInitializerErrorWrapper, + ProtocolRegistrationErrorWrapper, SerDeShelleyFileFormat, Sum6KesBytes, +}; pub use codec::*; pub use era::{ EraMarkersSigner, EraMarkersVerifier, EraMarkersVerifierError, EraMarkersVerifierSecretKey, diff --git a/mithril-common/src/crypto_helper/types.rs b/mithril-common/src/crypto_helper/types.rs index f41603700ef..8df6a740da2 100644 --- a/mithril-common/src/crypto_helper/types.rs +++ b/mithril-common/src/crypto_helper/types.rs @@ -71,10 +71,10 @@ pub type ProtocolGenesisSecretKey = ed25519_dalek::SecretKey; pub type ProtocolGenesisSignature = ed25519_dalek::Signature; // Error alias -/// Alias of a wrapper of [MithrilCommon:ProtocolRegistrationErrorWrapper](enum@mithril_common::ProtocolRegistrationErrorWrapper). +/// Alias of a wrapper of [MithrilCommon:ProtocolRegistrationErrorWrapper](enum@ProtocolRegistrationErrorWrapper). pub type ProtocolRegistrationError = ProtocolRegistrationErrorWrapper; -/// Alias of a wrapper of [MithrilCommon:ProtocolInitializerErrorWrapper](enum@mithril_common::ProtocolInitializerErrorWrapper). +/// Alias of a wrapper of [MithrilCommon:ProtocolInitializerErrorWrapper](enum@ProtocolInitializerErrorWrapper). pub type ProtocolInitializerError = ProtocolInitializerErrorWrapper; /// Alias of [MithrilStm:AggregationError](enum@mithril_stm::AggregationError).