Repository navigation
fix(tests): update test_c8_adm_double_credit_poc to exercise settle_epoch_rip200 rollback (#8353) - #8421
Merged
Conversation
…poch_rip200 rollback (fixes Scottcjn#8353)
Contributor
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
This was referenced Sep 15, 2026
Contributor
RTC RewardThis merged PR earned 5 RTC — sent to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Diagnosis & Summary of Changes
Fixes #8353.
Root Cause Analysis
In
node/test_c8_adm_double_credit_poc.py, the test did not invokesettle_epoch_rip200()at all. Instead, it directly hardcoded two identicalINSERT INTO balancesqueries on a raw connection without a rollback between them, asserting that the balance equaled a single credit. Because it never invokedsettle_epoch_rip200(), it never exercised the actualdb.rollback()mechanism (lines 257-260 ofnode/rewards_implementation_rip200.py) added to purge uncommitted ADM partial writes before standard fallback.Solution
node/test_c8_adm_double_credit_poc.pyto import and invokesettle_epoch_rip200().settle_epoch_with_anti_double_miningthat performs uncommitted writes to the shared connection (balances and ledger) and then raises an exception.settle_epoch_rip200()catches the failure, cleanly issuesdb.rollback(), and transitions to the standard fallback path.1,500,000 uRTC) and that the uncommitted ADM ledger rows are purged, leaving only the standard epoch reward entry.Verification
python3 node/test_c8_adm_double_credit_poc.py-> PASSpython3 node/test_wt3_adm_fallback_double_credit_poc.py-> PASSClaiming RTC wallet:
RTC8b1fb717791b0a7b72649342b5c7c7bd822786af