-
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 78.1% 78.2% +0.1%
=========================================
Files 790 790
Lines 67623 67676 +53
Branches 8163 8149 -14
=========================================
+ Hits 52846 52927 +81
+ Misses 14777 14749 -28
|
* 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
* upstream/develop: chore: add macos dependency installation (5233) prefix Uint384 and Uint512 with Hash in server_definitions (5231) refactor: add `rpcName` to `LEDGER_ENTRY` macro (5202)
* upstream/develop: chore: update deprecated Github Actions (5241) XLS-46: DynamicNFT (5048)
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.
LGTM
* upstream/develop: chore: Update Visual Studio CI to VS 2022, and add VS Debug builds (5240) Add [validator_list_threshold] to validators.txt to improve UNL security (5112) Switch from assert to XRPL_ASSERT (5245) Add missing space character to a log message (5251) Cleanup API-CHANGELOG.md (5207) test: Unit tests to recreate invalid index logic error (5242) Update branch management and merge / release processes (5215) fix: Error consistency in LedgerEntry::parsePermissionedDomains() (5252) Set version to 2.4.0-b2 fix: Use consistent CMake settings for all modules (5228) Fix levelization script to ignore commented includes (5194) Fix the flag processing of NFTokenModify (5246) Fix failing assert in `connect` RPC (5235) Permissioned Domains (XLS-80d) (5161)
* upstream/develop: Fix CI unit tests (5196) Update secp256k1 library to 0.6.0 (5254)
* upstream/develop: Set version to 2.4.0-b3 Set version to 2.3.1 Update conan in the "nix" CI jobs Add RPC "simulate" to execute a dry run of a transaction (5069) Set version to 2.3.1-rc1 Reduce the peer charges for well-behaved peers:
* upstream/develop: Add deep freeze feature (XLS-77d) (5187)
* upstream/develop: Amendment `fixFrozenLPTokenTransfer` (5227) Improve git commit hash lookup (5225)
* upstream/develop: Updates Conan dependencies (5256)
* upstream/develop: fix: Do not allow creating Permissioned Domains if credentials are not enabled (5275) fix: issues in `simulate` RPC (5265)
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:
.