-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add logging and improve counting of amendment votes from UNL #5173
base: develop
Are you sure you want to change the base?
Conversation
* upstream/develop: Add hubs.xrpkuwait.com to bootstrap (5169)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5173 +/- ##
=======================================
Coverage 77.9% 77.9%
=======================================
Files 783 783
Lines 66707 66759 +52
Branches 8140 8123 -17
=======================================
+ Hits 51964 52014 +50
- Misses 14743 14745 +2
|
* upstream/develop: Add AMMClawback Transaction (XLS-0073d) (5142)
* upstream/develop: Fix unity build (5179)
* upstream/develop: Set version to 2.3.0-rc1 Replace Uint192 with Hash192 in server_definitions response (5177) Fix potential deadlock (5124) Introduce Credentials support (XLS-70d): (5103) Fix token comparison in Payment (5172) Add fixAMMv1_2 amendment (5176)
* upstream/develop: fix: include `index` in `server_definitions` RPC (5190) Fix ledger_entry crash on invalid credentials request (5189)
* upstream/develop: Set version to 2.3.0-rc2
* upstream/develop: Set version to 2.3.0 refactor(AMMClawback): move tfClawTwoAssets check (5201) Add a new serialized type: STNumber (5121) fix: check for valid ammID field in amm_info RPC (5188)
* upstream/develop: test: Add more test cases for Base58 parser (5174) test: Check for some unlikely null dereferences in tests (5004) Add Antithesis intrumentation (5042)
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.
Happy to approve once my comment is answered.
hasValMajority && (majorityTime == NetClock::time_point{}) && | ||
bool const hasLedgerMajority = majorityTime.has_value(); | ||
|
||
std::stringstream ss; |
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] There is no real need to use streams here. We should move to using more modern and concise std::format in such cases.
auto message = std::format("{} ({}) has {} votes",
entry.first,
entry.second.name,
vote->votes(entry.first));
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.
We use streams everywhere else we build strings this way. I don't see any instances of std::format
. I don't object to starting this change process, but I can't promise it'll catch on.
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.
Actually, this didn't work on my end. I think std::format
doesn't like the unit256
type. I can look more into it later.
JLOG(j.debug()) | ||
<< "recordVotes: Timeout: Clearing votes from " | ||
<< pkHuman; | ||
votes.second.timeout.reset(); |
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 agree that this is much clearer and safer, than using NetClock::time_point::max
* upstream/develop: refactor: clean up `LedgerEntry.cpp` (5199)
* upstream/develop: Enforce levelization in libxrpl with CMake (5111)
* upstream/develop: Set version to 2.4.0-b1 fix: Add header for set_difference (5197) fix: allow overlapping types in `Expected` (5218) Add MPTIssue to STIssue (5200) Antithesis instrumentation improvements (5213)
a4504f9
to
1cba48e
Compare
High Level Overview of Change
Adds debug-level logging of the amendment vote counting and decision making process. Also, tweaks the way the vote threshold is computed to only account for validators that the node has votes for, whether fresh or cached.
Context of Change
Some UNL validators were not reflecting an accurate count of the total votes for given amendments. (The problem seemed to resolve itself when the node restarted.) This made it look like the amendment did not have 80% majority, when it actually did. The situation did not resolve itself until the vote count increased again.
Because this processing was completely transparent, there was no way to tell why the votes were inaccurate, and because restarting seemed to fix the issue, it couldn't be reproduced with modified code.
Despite appearances, this issue is not security sensitive because
While adding logging, I noticed and fixed a possible bug in the way that the total validations are counted, which affects the way the threshold is computed. Even with this fixed, though, it doesn't explain why the counts are off.
The primary purpose of this change / PR is to have logging available in case something like this ever happens again.
Type of Change
Test Plan
log_level
forAmendments
andLedgerConsensus
to debug or trace.Amendment:
.