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

Rippled Server Software Upgrade Notification #3447

Closed
wants to merge 9 commits into from

Conversation

pwang200
Copy link
Contributor

Goal

To urge rippled operators to upgrade their rippled server software, we display a console message when enough validators run a higher version of the rippled software. 

Overview

After the hardened validation amendment is activated, the validators will include their software versions in the validation messages at every (flag - 1) ledger. After receiving these validation messages, a node can check how many of its trusted validators run a higher version of the software than itself. If the number is more than x% (e.g. 60%) of its validators, we display a console message:

Majority of your trusted validators run a higher version of rippled server software. Please upgrade your rippled server software.

Implementation Details

When to check?

The software version information is in the validation messages of every (flag - 1) ledger. We check these information when the corresponding flag ledger is fully validated. The extra one ledger time allows the node to accumulate more (and hopefully all) validation messages of the (flag - 1) ledger. 

Comparing Software Versions

https://github.com/ripple/rippled/blob/f43aeda49c5362dc83c66507cae2ec71cfa7bfdf/src/ripple/protocol/BuildInfo.h#L48

As shown in the code, the software version is encoded into a 64-bit unsigned integer. There are several fields encoded, for this task, when comparing software versions, we will only compare the major version, minor version, and patch version.

Print to console

We use std::cerr to display the console message. Alternatively, we could use a warning log message. As long as the log is not configured as silent, the warning message will be printed to std::cerr as well.

Test

We started 10 validators, 2 of them run 1.6.0, and the rest run 1.7.0 (faked). We shortened the amendment waiting period. At about ledger 768 (the 3rd flag ledger), we saw the warning message printed by the validators running 1.6.0.

src/ripple/protocol/impl/BuildInfo.cpp Outdated Show resolved Hide resolved
src/ripple/protocol/BuildInfo.h Outdated Show resolved Hide resolved
src/ripple/protocol/BuildInfo.h Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@nbougalis nbougalis left a comment

Choose a reason for hiding this comment

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

Left one comment. Once that's fixed, it's a pass from me. Thanks @pwang200. 🖖

src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

I want to start out by saying that it was really a pleasure reviewing this pull request. There were appropriate block comments describing intent. The code was well organized. Variables were well named. Nice work.

I left some comments. They are all optional, but we should talk about any of the changes you choose not to implement. My take is that they all might be useful improvements. But I was also not watching the design of this feature, so some of my comments may be off base. I'm hoping that you'll set me right when that happens. Thanks.

src/ripple/protocol/impl/BuildInfo.cpp Outdated Show resolved Hide resolved
src/ripple/protocol/BuildInfo.h Outdated Show resolved Hide resolved
src/ripple/protocol/impl/BuildInfo.cpp Show resolved Hide resolved
src/ripple/protocol/impl/BuildInfo.cpp Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
src/ripple/app/ledger/LedgerMaster.h Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

👍 Looks great. I really appreciate the added unit tests.

I ran code coverage on your most recent commit. Code coverage looks pretty good. There were three lines that were identified as not exercised. If you feel like going for the extra credit you could see if you can extend the coverage to some of those unexercised lines. But the improved coverage you already got is certainly sufficient.

src/ripple/protocol/impl/BuildInfo.cpp Show resolved Hide resolved
src/ripple/protocol/impl/BuildInfo.cpp Show resolved Hide resolved
src/ripple/protocol/impl/BuildInfo.cpp Show resolved Hide resolved
@carlhua carlhua requested a review from ximinez June 24, 2020 00:40
Copy link
Collaborator

@scottschurr scottschurr 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. Thanks for the extra unit tests.

Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

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

Sorry for not getting to this sooner.

src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
src/ripple/basics/MathUtilities.h Outdated Show resolved Hide resolved
src/ripple/protocol/BuildInfo.h Outdated Show resolved Hide resolved
src/ripple/protocol/impl/BuildInfo.cpp Outdated Show resolved Hide resolved
src/test/basics/MathUtilities_test.cpp Outdated Show resolved Hide resolved
src/test/basics/MathUtilities_test.cpp Outdated Show resolved Hide resolved
src/test/protocol/BuildInfo_test.cpp Show resolved Hide resolved
@pwang200 pwang200 requested a review from ximinez June 25, 2020 03:07
Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

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

Looks great, with room for one nice improvement.

src/test/basics/MathUtilities_test.cpp Outdated Show resolved Hide resolved
@pwang200 pwang200 requested a review from ximinez June 25, 2020 20:27
Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

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

Woo!

@carlhua carlhua added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label Jun 25, 2020
@manojsdoshi manojsdoshi mentioned this pull request Jun 25, 2020
This was referenced Jun 26, 2020
@pwang200 pwang200 requested a review from ximinez June 27, 2020 04:34
@pwang200
Copy link
Contributor Author

pwang200 commented Jun 27, 2020

@ximinez The commit "fix divide by zero" has the fix from Mickey and Ed.

It was tested in a local machine network with 10 validators and the amendment waiting period was reduced from 2 weeks to 2 minutes. The test cases were:

  1. All 1.6.0-b7. The test ran for about 2200 ledgers.
  2. Eight 1.7.0-b7 (faked) and two 1.6.0-b7. The test ran for about 2200 ledgers.
  3. Five non-rippled validators (faked), three 1.7.0-b7 (faked) and two 1.6.0-b7. The test ran for about 1100 ledgers.
  4. Five non-rippled validators (faked), two 1.7.0-b7 (faked) and three 1.6.0-b7. The test ran for about 1100 ledgers.

All tests passed. In tests 2) and 3), the upgrade warning messages were printed.

Copy link
Collaborator

@ximinez ximinez 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. Sorry I missed the divide by 0 the first time around.

reportingPercent &&
calculatePercent(higherVersionCount, rippledCount) >=
cutoffPercent;
if (higherVersionCount > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm going to make a post-approval suggestion that you add assert(higherVersionCount <= rippledCount) before this line, and a comment explaining that because higherVersionCount is dependent on rippledCount, we're avoiding a potential divide by 0, AND skipping the math entirely if there's no point because there are no higher versions reporting trusted validations.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My personal inclination would be to change the if to look like this:

if (higherVersionCount > 0 && rippledCount > 0)

Then I'd add one more condition to the comment: " and (3) the calculation won't cause divide-by-zero."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ximinez updated. I took in Scott suggested since that seems more straightforward and easier to understand.

@pwang200 pwang200 requested a review from ximinez June 29, 2020 18:53
Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

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

Still 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants