-
Notifications
You must be signed in to change notification settings - Fork 95
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
Create test to catch duplicate dependencies #1582
Comments
## Motivation This PR is motivated by the regression identified in #1349. That PR notes that the metrics stopped working for most of the crates other than `zebrad`. ## Solution This PR resolves the regression by deduplicating the `metrics` crate dependency. During a recent change we upgraded the metrics version in `zebrad` and a couple other of our crates, but we never updated the dependencies in `zebra-state`, `zebra-consensus`, or `zebra-network`. This caused the metrics macros to attempt to retrieve the current metrics exporter through the wrong function. We would install the metrics exporter in `0.13`, but then attempt to look it up through the `0.12` crate, which contains a different instance of the metrics exporter static variable which is unset. Doing this causes the metrics macros to return `None` for the current exporter after which they just silently give up. ## Related Issues closes #1349 ## Follow Up Work I noticed we have quite a few duplicate dependencies in our tree. We might be able to save some compilation time by auditing those and deduplicating them as much as possible. - #1582 Co-authored-by: teor <teor@riseup.net>
This looks good. Once we have a potential contributor, let's schedule the mentoring and review work as part of our sprints? |
i know some rust but never done crypto before, can i contribute ? |
Absolutely! |
Ok cool i take it ! |
I just have to follow all the check listed above ? |
Yup, and let me know if you have any questions. |
@sepiropht try to focus on the "MVP Checklist" first. The "Additional Goals" can wait until later. |
Right now I'm not able to build the project, i have compilation errors in zebra-state |
@sepiropht please open another ticket with:
You might find the bug report template helpful, but it's designed for runtime bugs, not compilation bugs. So it asks for some information you won't have. |
Finally after |
Hey @sepiropht, are you still working on this? |
Curious about this, does it needs to check the direct duplicate dependencies? Does nested dependencies need to be check? |
I think the check is already implemented upstream and that it checks for duplicate direct dependencies, but it might be a good idea to make it configurable. |
Done recently using |
Is your feature request related to a problem? Please describe.
Recently we found a regression in our metrics system in
zebrad
. The issue ended up being that we'd accidentally duplicated themetrics
dependency during a recent refactor. The crates on the old version would silently fail to access the exporter when reporting metrics because the variable containing the exporter was duplicated in each version, and only the newer version's global exporter had been initialized.Describe the solution you'd like
We've already fixed this problem in #1561 but we'd like to prevent this from happening again in the future. The plan is to use
guppy
to write a test/lint to catch and report duplicated dependencies are part of our CI process. The author @sunshowers helpfully already pointed me to where they've already implemented this lint for their work codebase (link).We should more or less vendor this lint into our codebase. If possible we'd also like to do so in a way that is reusable so that other rust projects can utilize this same lint easily.
Design / Mentorship Instructions
TBDI still need to talk some more with Rain about the design for the reusable version ofdiem/guppy.rs
. My expectation is that it would look similar toclippy
, but Rain has thought much more about this than I have so I want to get my ducks in a row before I commit to writing out a design.I've talked to Rain and the plan we came up with is to create a cargo subcommand like
clippy
which we've decided to callseamare
that is based on theguppy
code indiem
. This subcommand can then be distributed on crates.io and run in CI.MVP Checklist
zebra
seamare
: The main library that defines the lint engine and traitsseamare-lints
: A separate library that depends onseamare
and implements the various lints we export by defaultcargo-seamare
: A binary crate that acts as an external cargo subcommand, depends onseamare
andseamare-lints
, instantiates the engine, then passes in the list of lints provided byseamare-lints
to be runseamare
diem
intoseamare-lints/src/duplicate_deps.rs
cargo-seamare
: create aLintEngine
that loads the package graph via guppy, takes a set of types that implement these various traits, and then executes each of the lints via the traits against the package graphAdditional Goals
LintEngine
run all of the lints in paralleldiem
intoseamare-lints
cargo-seamare
for generating a skeleton project that is essentially a copy of itself, which can then be edited and have new lints added in via sourceseamare
,cargo-seamare
, andseamare-lints
into their own organization and repo to consolidate implementations with upstream sourceDescribe alternatives you've considered
I've not really considered any other alternatives, as far as I know guppy is the exact right tool to solve this problem, and this is what it was designed for.
The text was updated successfully, but these errors were encountered: