Skip to content

Conversation

@muXxer
Copy link
Contributor

@muXxer muXxer commented Dec 16, 2025

Description of change

This PR adds a new "consolidation mode" to cargo_sort.py, which will analyze all dependencies across the workspace and:

  • If an external dependency is used by multiple crates: adds it to root [workspace.dependencies] and updates crates to use package.workspace = true
  • If an external dependency is used by only one crate: removes it from root and gives the crate the full version spec

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

@vercel
Copy link

vercel bot commented Dec 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

6 Skipped Deployments
Project Deployment Review Updated (UTC)
apps-backend Ignored Ignored Preview Jan 5, 2026 7:15pm
apps-ui-kit Ignored Ignored Preview Jan 5, 2026 7:15pm
iota-evm-bridge Ignored Ignored Preview Jan 5, 2026 7:15pm
iota-multisig-toolkit Ignored Ignored Preview Jan 5, 2026 7:15pm
rebased-explorer Ignored Ignored Preview Jan 5, 2026 7:15pm
wallet-dashboard Ignored Ignored Preview Jan 5, 2026 7:15pm

@github-actions github-actions bot added the ci Issues related to our CI pipeline label Dec 16, 2025
@iota-ci iota-ci added core-protocol node Issues related to the Core Node team labels Dec 16, 2025
Copy link
Contributor

@semenov-vladyslav semenov-vladyslav left a comment

Choose a reason for hiding this comment

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

default-features = false in a member crate dependency has no effect and may be misleading. Default features are enabled/disabled in workspace manifest.

For example, if two member crates have a common dependency, but one crate needs default-features = false and another uses default features, then the default features must be disabled in workspace manifest (eg. [workspace.dependencies] dep = { "0.1", default-features = false }, and enabled in member crate that needs them (eg. dep = { workspace = true, default-features = true }. The other way around will not work.

This should be another check by cargo_sort.py probably.

@DaughterOfMars
Copy link
Contributor

Nice!!!

@muXxer muXxer force-pushed the feat/scripts-cargo-sort-consolidate-external-deps branch from 353dfa8 to a04f638 Compare January 5, 2026 18:11
@muXxer muXxer force-pushed the feat/scripts-cargo-sort-consolidate-external-deps branch from 266b996 to 42975b5 Compare January 5, 2026 19:14
flate2.workspace = true
itertools.workspace = true
packable = { version = "0.8", default-features = false, features = ["io"] }
packable = { workspace = true, features = ["io"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
packable = { workspace = true, features = ["io"] }
packable.workspace = true

"io" feature is enabled in the root.

num-traits = "0.2.18"
once_cell.workspace = true
packable = { version = "0.8", default-features = false, features = ["io"] }
packable = { workspace = true, features = ["io"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
packable = { workspace = true, features = ["io"] }
packable.workspace = true

"io" feature is enabled in the root.

lru.workspace = true
nonempty.workspace = true
num-bigint = { version = "0.4", default-features = false, features = ["rand"] }
num-bigint = { workspace = true, features = ["rand"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Is "rand" feature really used? I haven't found a place where we generate random BigInts.

better_any.workspace = true
fastcrypto.workspace = true
fastcrypto-vdf.workspace = true
fastcrypto-vdf = { git = "https://github.com/MystenLabs/fastcrypto", rev = "69d496c71fb37e3d22fe85e5bbfd4256d61422b9", features = ["experimental"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it make sense to keep fastcrypto-vdf dependency in the root Cargo.toml close to other fastcrypto deps that also have the same rev? Otherwise fastcrypto deps might go out of sync.

codespan-reporting.workspace = true
log.workspace = true
ouroboros.workspace = true
ouroboros = "0.17.2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we update it to "0.18" to avoid duplicates? ouroboros-0.18 is used in typed-store.

[dependencies]
# external dependencies
clap = { version = "4.1.4", features = ["derive"] }
clap = { workspace = true, features = ["derive"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
clap = { workspace = true, features = ["derive"] }
clap.workspace = true

"derive" feature is enabled in the root.

async-trait.workspace = true
bcs.workspace = true
clap = { version = "4.1.4", features = ["derive"] }
clap = { workspace = true, features = ["derive"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
clap = { workspace = true, features = ["derive"] }
clap.workspace = true

"derive" feature is enabled in the root.

tonic-prost-build = "0.14"
tonic-rustls = "0.3.0"
tower = { version = "0.4.12", features = ["full", "util", "timeout", "load-shed", "limit"] }
tower = { version = "0.4.12", default-features = false, features = ["full", "util", "timeout", "load-shed", "limit"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need "full" feature? It enables everything, the other features including.

tower = { version = "0.4", default-features = false, features = ["util"] }
tracing = { version = "0.1" }
tokio-util.workspace = true
tower = { workspace = true, features = ["util"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tower = { workspace = true, features = ["util"] }
tower.workspace = true

"util" feature is enabled in the root.

- If an external dependency is only used by one crate:
- Removes it from root Cargo.toml (if present)
- Ensures the crate has the full version spec
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a note how features are handled, it's not trivial after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Issues related to our CI pipeline core-protocol node Issues related to the Core Node team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants