Update Penalty (New) scenario to accepted TIP-004 (per-algorithm scope) - #2
Merged
Conversation
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.
Summary
Aligns the Penalty (New) scenario with the accepted TIP-RFC-MT-0004 (Last Modified 2026-08-19, Status: Accepted). The TIP no longer groups RxM/RxT into a shared RandomX penalty class — each of the four algorithms is now its own penalty scope.
Changes
js/config.js— removedPENALTY_CLASS_MAP; reworded thePENALTY_CAPcomment (cap applies to per-algorithm runs).js/simulation.js—runCompetitionSW/computeAlgoRatesSWnow tracklastWinner/consecutiveCountper algorithm instead of per class. Only the algorithm that mined the previous block receives themin(2^n, 32)modifier; an RxT block following an RxM block now resets the run and pays no penalty (previously continued the RandomX run at 2x).js/simulation.js(2nd commit) — fixed a pre-existing off-by-one in the New path's run tracking: the counter now holds the run length ending at the previous block, so a block extending a run at positionrpaysm = 2^(r-1)exactly per the TIP's cap table (previously the 2nd consecutive block paid 1x, the 3rd 2x, etc.).js/lwma_sw.js— comment-only update (engine is scope-agnostic).README.md— class wording replaced throughout; source date → 2026-08-19; config table documents per-algorithm scope; "Why no penalty" critique updated to the TIP's corrected figures (E[m]≈1.16, ~1.7% mean block-time inflation) instead of the old draft's class-based numbers.Baseline, Penalty (Original), and WTEMA scenarios are untouched, preserving the comparison.
Verification
Test suite run headless on the VPS (Node v22.23.1, vm-context harness over the real block data, blocks 294400–296521):
LwmaWindowSWwith m=1 is numerically identical toLwmaWindow(499 targets, 0 mismatches).2^kfor k preceding same-algo blocks, cap at 32 for k=6.runCompetitionSW, 1522 simulated blocks: every block's recorded multiplier matchesmin(2^(r-1), 32)for its run position; 190 real-data RxM↔RxT switches all reset to multiplier 1 (the class-based behavior would have continued the run at 2x).lwma45pnewwithpenaltyMode: 'new'present.All tests passed. Note: "Penalty (New)" results will shift relative to the previous class-based version (lower effective penalty, less block-time inflation) — expected, per the accepted TIP.