-
Notifications
You must be signed in to change notification settings - Fork 596
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
[chore] Separated near-primitives dependencies into features #11597
Conversation
@nagisa Can you have a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle LGTM, some nits inline.
where | ||
R: Rng + ?Sized, | ||
{ | ||
// Shuffling shard ids to avoid a bias towards lower ids, see [`ShuffledShardIds`]. We |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW this looks very much like business logic that has no business living in near-primitives in the first place. We should figure out an effective way to prevent engineers from adding such code to this crate in the long run, otherwise the eventual end state is going to be the same as it was just recently...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Though not sure how to prevent that ... My only thought that code review + eventually we could make primitives quite thin and limit by amount of deps 👍🏻
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11597 +/- ##
=======================================
Coverage 71.48% 71.49%
=======================================
Files 788 790 +2
Lines 160921 160950 +29
Branches 160921 160950 +29
=======================================
+ Hits 115034 115070 +36
+ Misses 40864 40858 -6
+ Partials 5023 5022 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Passed :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs rebase/merge for the conflict.
@@ -264,7 +257,9 @@ near-state-viewer = { path = "tools/state-viewer", package = "state-viewer" } | |||
near-store = { path = "core/store" } | |||
near-telemetry = { path = "chain/telemetry" } | |||
near-test-contracts = { path = "runtime/near-test-contracts" } | |||
near-time = { path = "core/time" } | |||
near-time = { path = "core/time", default-features = false, features = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: enabling features here means that they cannot be disabled in any of the dependencies anymore, so e.g. if there is a published crate that depends on near-time
but doesn't need the serde
feature then it will be enabling that feature superfluously. Not a big deal as far as I am concerned, but thought you should be aware of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, but I would keep it as it is for now. I think it might be a good pr to feature-gate serde across repo, but not for this PR.
Head branch was pushed to by a user without write access
This pull request decreases near-primitive dependencies count even more by separating part of functionality into features.
I have created three new features:
rand
- extracts rand, rand-chacha crates from the compilation. This is common practice to split by this type.solomon
- extracts reed-solomon-erasure, libc, lru, and some outdated subdeps (e.g. hashbrowns)clock
- removestokio
from dependency list that is nice :)Moreover, I have featured gated rand in near-crypto following the same logic :)
Final results: near-primitives have 107 dependencies (-23) using a feature-less version