Skip to content
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

Switch Cargo.toml in packages to use workspace dependencies #1407

Merged
merged 18 commits into from
Aug 30, 2024

Conversation

carver
Copy link
Collaborator

@carver carver commented Aug 29, 2024

What was wrong?

Fix #845

How was it fixed?

My process:

  • Copied the version definitions into the workspace Cargo.toml and referred to them from each package
  • If multiple versions are used in different packages, specify the highest version to use in the workspace
  • If different features are used in different packages, specify the minimal subset in the workspace, and add features as needed in each package

There are several dependencies that are only used in a single package. I can see arguments for moving them to the workspace for tracking too. For example, if we don't move the dependencies, then it will be easy to accidentally create duplicates again in the future. But I landed on leaving them in place, because:

  1. It highlights that removing a singular dependency from a package will completely remove it from the whole workspace
  2. It feels a tiny bit burdensome to add every future dependency to the workspace when it's only in use in one place. So I wasn't ready to pick that as the new norm

But I'm open to persuasive arguments :)

To-Do

  • root
  • e2store
  • ethportal-api
  • ethportal-peertest
  • light-client
  • portal-bridge
  • portalnet
  • rpc
  • trin-beacon
  • trin-execution
  • trin-history
  • trin-metrics
  • trin-state
  • trin-storage
  • trin-utils
  • trin-validation
  • utp-testing
  • Clean up commit history and use conventional commits.
  • Follow-up task writeups
    • Move dependency repositories to ethereum org
    • ssz unification?

I checked that all of these dependencies are used in other repos first.
It's much nicer to have the dependency versions defined once in the
repo, for future upgrades.

Why did the version spec change when moving to the root Cargo.toml?
- hyper is used elswehere with different features, like rpc
- serde is used elsewhere at higher versions, like portalnet
- serde_yaml is used elsewhere at higher versions, like in trin-beacon
Why did the version spec change when moving to the root Cargo.toml?
- async-trait is used elsewhere at higher versions, like portal-bridge
- chrono is used elsewhere at higher versions, like trin-beacon
@carver carver marked this pull request as ready for review August 29, 2024 22:57
Copy link
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

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

:shipit: looks good

Copy link
Collaborator

@morph-dev morph-dev left a comment

Choose a reason for hiding this comment

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

Looks good! 🚢

Few sidenotes.

Since Cargo.lock wasn't updated, does that mean that there was no dependency that was used with different version?

Somewhat related, should we create issue(s) for:

  • figuring out if we have some unused dependencies that can be removed
    • e.g. using some tools like cargo-udeps
    • if we find convenient tool, maybe create a github action that runs it weekly (similar to update dependencies)
  • finding out if we have multiple crates that do the same thing and we can simplify to using one (e.g. I noticed ssz-rs in light-client and I'm wondering if we can replace it with ethereum_ssz)
    • probably more of a manual task, but it might not be too hard not that most dependencies are in one place

@carver
Copy link
Collaborator Author

carver commented Aug 30, 2024

Since Cargo.lock wasn't updated, does that mean that there was no dependency that was used with different version?

Yeah, I think because of the regular updates, like this one, most of the locked dependencies were further ahead of any of the Cargo.toml specs anyway.

Somewhat related, should we create issue(s) for

Sure, I'll take a stab at writing some up 👍🏻

@carver carver merged commit c05605b into ethereum:master Aug 30, 2024
8 checks passed
@carver carver deleted the workspace-dependencies branch August 30, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor: use workspace to eliminate duplicate dependency definitions
3 participants