Skip to content

refactor: shared workspace dependencies #2440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 28, 2025
Merged

Conversation

Alenar
Copy link
Collaborator

@Alenar Alenar commented Apr 25, 2025

Content

This PR tries to reduce build time, especially when switching between crates, by moving the most critical or shared dependencies to the workspace directly.

It also:

  • Remove the build script from mithril-stm as everything now compile to wasm without needing to gate batch_verify.
    • Since we don't wan't to touch stm code and still always enable the gated code, this implies to set by default batch-verify-aggregates
    • batch-verify-aggregates is now deprecated and cfg gate that use it should be removed, then we will be able to remove the feature
  • Refactor mithril-build-script open api code generators: to separate the part where we find the open api spec files and the part that generate code based on them
  • mithril-common:
    • Refactor build script: rerun only if a openapi spec file changed
    • Make serde_yaml optional: it's only needed for apispec test tool and this crate is deprecated ( ⚠️ we should find an alternative for our few usages)

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • No new TODOs introduced

Comments

  • devbook dependency upgrade script is not impacted as it bump all crates patch version indiscriminately
  • Even with those changes mithril-stm always recompile if we alternate between aggregator and signer, more work is needed or maybe a tool like cargo-hakari

Issue(s)

Closes #2430

@Alenar Alenar added refactoring 🛠️ Code refactoring and enhancements devX 🌞 Developer experience labels Apr 25, 2025
@Alenar Alenar self-assigned this Apr 25, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors how shared dependencies are managed by moving critical libraries to the workspace level to reduce build times and improve caching. Key changes include converting many Cargo.toml dependency declarations to use workspace versions, adjusting feature sets for some dependencies, and refactoring the Open API code generation logic in the build script.

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
File Description
mithril-client/Cargo.toml Updated dependency declarations to use workspace versions
mithril-client-wasm/Cargo.toml Refactored dependency declarations to use workspace versions
mithril-client-cli/Cargo.toml Converted dependencies to workspace versions with updated features
mithril-aggregator/Cargo.toml Adjusted dependency configurations (notably reqwest features)
internal/signed-entity/, internal/mithril--*/Cargo.toml Updated dependency declarations for shared libraries
internal/mithril-build-script/src/open_api.rs Made Open API file listing public and generalized a file reading function
Cargo.toml Added a workspace dependencies section with specific versions
examples/*/Cargo.toml Refactored dependency declarations in example projects
Comments suppressed due to low confidence (1)

mithril-aggregator/Cargo.toml:41

  • The new reqwest dependency configuration now specifies a different set of features (e.g., 'default', 'gzip', 'zstd', 'deflate', 'brotli') compared to the previous ('json', 'stream'). Please verify that these changes are aligned with the intended behavior of the aggregator.
reqwest = { workspace = true, features = [

Copy link

github-actions bot commented Apr 25, 2025

Test Results

    3 files  ±0     57 suites  ±0   11m 42s ⏱️ -2s
1 875 tests ±0  1 875 ✅ ±0  0 💤 ±0  0 ❌ ±0 
2 337 runs  ±0  2 337 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit d28614e. ± Comparison against base commit ba1dc03.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@turmelclem turmelclem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Alenar Alenar force-pushed the djo/2430/shared_workspace_deps branch from 6af2566 to 20bae7a Compare April 25, 2025 15:25
@Alenar Alenar temporarily deployed to testing-preview April 25, 2025 15:34 — with GitHub Actions Inactive
Copy link
Collaborator

@dlachaume dlachaume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.3.yy (dd-mm-2025)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated before merging 🙂

Comment on lines 10 to 11
- Remove the build script and deprecate `batch-verify-aggregate` feature as the code behind this feature is now
compatible with WASM.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Remove the build script and deprecate `batch-verify-aggregate` feature as the code behind this feature is now
compatible with WASM.
- Removed the build script and deprecated `batch-verify-aggregate` feature as the code behind this feature is now
compatible with WASM.

Copy link
Collaborator

@sfauvel sfauvel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

In order to reduce number of unnecessary rebuild when developping.

Shared dependencies are:
- used in lot of crates (tokio, chrono, clap, ...)
- using derive features (serde, clap, ...)
- used in few crates but high in the dependency tree (ran_chore, rayon,
  strum, ...)
@Alenar Alenar force-pushed the djo/2430/shared_workspace_deps branch from 20bae7a to 1959e62 Compare April 28, 2025 08:11
Alenar added 4 commits April 28, 2025 10:23
…` feature

As the code gated by the feature can now be compiled when targeting
WASM.
as it's only needed for openapi validation
 name = "client-cardano-database-v2" -version = "0.0.4" +version = "0.0.5" * client-cardano-database from `0.1.29` to `0.1.30`
* client-cardano-stake-distribution from `0.1.11` to `0.1.12`
* client-cardano-transaction from `0.1.21` to `0.1.22`
* client-mithril-stake-distribution from `0.2.9` to `0.2.10`
* mithril-build-script from `0.2.19` to `0.2.20`
* mithril-cli-helper from `0.0.3` to `0.0.4`
* mithril-doc from `0.1.20` to `0.1.21`
* mithril-metric from `0.1.10` to `0.1.11`
* mithril-persistence from `0.2.50` to `0.2.51`
* mithril-resource-pool from `0.0.2` to `0.0.3`
* mithril-signed-entity-lock from `0.0.2` to `0.0.3`
* mithril-signed-entity-preloader from `0.0.2` to `0.0.3`
* mithril-aggregator from `0.7.39` to `0.7.40`
* mithril-client-cli from `0.11.14` to `0.11.15`
* mithril-client-wasm from `0.8.7` to `0.8.8`
* mithril-client from `0.11.21` to `0.11.22`
* mithril-common from `0.5.23` to `0.5.24`
* mithril-relay from `0.1.39` to `0.1.40`
* mithril-signer from `0.2.238` to `0.2.239`
* mithril-stm from `0.3.43` to `0.3.44`
* mithril-aggregator-fake from `0.4.5` to `0.4.6`
* mithril-end-to-end from `0.4.80` to `0.4.81`
* [js] mithril-client-wasm from `0.8.7` to `0.8.8`
@Alenar Alenar force-pushed the djo/2430/shared_workspace_deps branch from 1959e62 to d28614e Compare April 28, 2025 08:23
@Alenar Alenar temporarily deployed to testing-preview April 28, 2025 08:57 — with GitHub Actions Inactive
@Alenar Alenar merged commit e7358f2 into main Apr 28, 2025
41 of 43 checks passed
@Alenar Alenar deleted the djo/2430/shared_workspace_deps branch April 28, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devX 🌞 Developer experience refactoring 🛠️ Code refactoring and enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accelerate Rust compilation time with workspace dependencies
5 participants