-
Notifications
You must be signed in to change notification settings - Fork 403
Misc (mostly-)feature cleanups #3250
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
Misc (mostly-)feature cleanups #3250
Conversation
468d088
to
d27e098
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3250 +/- ##
==========================================
- Coverage 89.82% 89.81% -0.01%
==========================================
Files 125 125
Lines 102867 102798 -69
Branches 102867 102798 -69
==========================================
- Hits 92398 92327 -71
- Misses 7753 7756 +3
+ Partials 2716 2715 -1 ☔ View full report in Codecov by Sentry. |
d27e098
to
5b615fe
Compare
Needs a rebase. |
In 81389de we removed a note about mixing the `std` and `no-std` feature when de/serializing `ProbabilisticScorer`s but forgot to note that there was a second copy of that note in the module documentation. This removes that note.
To handle `std` and `no-std` concepts of time in scoring, we'd originally written a generic `Time` trait which we could use to fetch the current time, observe real (not wall-clock) elapsed time, and serialize the time. Eventually, scoring stopped using this `Time` trait but outbound payment retry expiry started using it instead to mock time in tests. Since scoring no longer uses the full features which required the `Time` trait, we can substantially simplify by just having the mocking option.
Not sure why we ever really had this, no one really ever bounds anything on `std::Error` and its kinda a dead type, so there's no need for us to `impl` it for our types.
Fewer feature flags makes for more readable code, so we opt for that over very marginally more effecient code here.
We never actually build with `#![no_std]` in tests as Rust does not support it. Thus, many tests have spurious `std` feature gates when they run just fine without them. Here we remove those gates, though note that tests that depend on behavior elsewhere in the codebase which is `std`-gated obviously need to retain their feature gates.
5b615fe
to
11ab302
Compare
Rebased. |
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.
/// Returns true when a full routing table sync should be performed with a peer. | ||
fn should_request_full_sync(&self, _node_id: &PublicKey) -> bool { | ||
//TODO: Determine whether to request a full sync based on the network map. |
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.
Did you mean to remove this todo?
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.
Yea, I don't think we will/can ever make such a decision - instead we need the spec to include a set reconciliation protocol.
#[allow(unused)] | ||
let should_sync = self.should_request_full_sync(); |
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.
nit: I don't see why this got moved and allow(unused)
'd?
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.
I removed the std
bounds on should_request_full_sync
, and in order to make it not-unused, I moved this out of the std
block below. But that also means that in no-std builds this value is unused. In theory we should keep the bounds as they were, but I liked the diff stats 😅
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.
ah, I had a similar issue once. Hate this aspect of conditional compilation
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.
Looks good, with the same questions that @valentinewallace raised.
Built on #3249, random stuff I came across while writing that.