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

Clarify the safety of NetClock::time_point arithmetic: #3787

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ripple/app/tx/impl/CreateOffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ CreateOffer::takerCross(
Sandbox& sbCancel,
Amounts const& takerAmount)
{
NetClock::time_point const when{ctx_.view().parentCloseTime()};
NetClock::time_point const when = ctx_.view().parentCloseTime();

beast::WrappedSink takerSink(j_, "Taker ");

Expand Down
4 changes: 3 additions & 1 deletion src/ripple/consensus/Validations.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ isCurrent(
// Because this can be called on untrusted, possibly
// malicious validations, we do our math in a way
// that avoids any chance of overflowing or underflowing
// the signing time.
// the signing time. All of the expressions below are
// promoted from unsigned 32 bit to signed 64 bit prior
// to computation.

return (signTime > (now - p.validationCURRENT_EARLY)) &&
(signTime < (now + p.validationCURRENT_WALL)) &&
Expand Down
1 change: 0 additions & 1 deletion src/ripple/overlay/impl/Handshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ verifyHandshake(
// We can't blindly "return a-b;" because TimeKeeper::time_point
// uses an unsigned integer for representing durations, which is
// a problem when trying to subtract time points.
// FIXME: @HowardHinnant, should we migrate to using std::int64_t?
auto calculateOffset = [](TimeKeeper::time_point a,
TimeKeeper::time_point b) {
if (a > b)
Expand Down