test(ltc): AutoRatchet sim + desired-version tally KATs (G2) - #676
Merged
Conversation
LTC is the V36 reference impl but, unlike dgb, does not modularize the desired-version tally into src/impl/ltc/coin/. The accumulation lives inline in ShareTracker::get_desired_version_weights (the consensus 60%-by-work switch gate input, share_check step 2 / AutoRatchet tail guard) and its flat-count diagnostic sibling get_desired_version_counts (share_tracker.hpp:2150/:2179). This KAT drives the tally through the real chain-walk API: it builds a resolved ltc::ShareTracker of V36 MergedMiningShare and asserts both per-version maps against the p2pool data.py:2651 oracle (res[dv] += target_to_average_attempts(share.target)). Non-circular: a work-definition anchor pins chain::target_to_average_attempts to hand-derived constants over 2^k-1 targets; the tracker-tally expectations are re-derived by an independent accumulation applying the same production primitive to the input bits, not read from the maps under test. Covers empty/absent tip, single/repeated/multi-version bucketing, the work-weight-inverts-flat-count case, and the lookbehind clamp. Additive: joins the existing share_test target; no production code touched.
Port the dgb AutoRatchet sim/tail-guard coverage to LTC, adapted to LTCs 2-arg ctor (baseline derived inline as target-1) and single-algo Scrypt posture (drops dgbs multi-algo C5). 7 cases through the real ltc::AutoRatchet + ltc::ShareTracker API: thresholds, C2 VOTING-mints-v35-baseline, C3 60%-by-work gate + mint-cannot-outrun-accept + monotonic staged tally, C4 CONFIRMED restart-persistence. Arms ltc_g2_crossing_staged_migration harness rig-free. Joins share_test (build allowlist). FENCED, additive.
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.
Ports the LTC-side G2 AutoRatchet coverage that dgb already carries.
Covers: 95%-by-count activation window, 60%-by-work accept/tail gate boundaries (59/60/61 + empty/zero-total), mint-cannot-outrun-accept, staged monotonic tally, state-persist-across-restart, fresh-node baseline.
Evidence: share_test built fresh from source, 13/13 PASS (6 LtcDesiredVersionTally + 7 LTC_AutoRatchetSim), Linux x86_64. No production code touched — test-only.
Reviewer-authored; I do not merge.