feat: Ledger Invariant Test Suite — Property-based proofs for ledger correctness (#764)#645
Merged
Scottcjn merged 2 commits intoScottcjn:mainfrom Mar 7, 2026
Merged
Conversation
added 2 commits
March 7, 2026 13:45
- onboard/ package publishable to npm as 'rustchain-onboard' - Interactive 5-step wizard: wallet creation, repo stars, GitHub follow, balance check, first attestation guidance - Step 1: Wallet name prompt with format validation + availability check - Step 2: Opens each of 5 key repos in browser, waits for star confirmation - Step 3: Opens Scottcjn GitHub profile, waits for follow confirmation - Step 4: Live node health + epoch check, shows earning options - Step 5: Optional miner setup (runs setup.sh one-liner or guides user) - Pure Node.js stdlib (no dependencies) — works with any Node 14+ - npx rustchain-onboard (zero install required) Wallet: noxventures_rtc
Property-based test suite that mathematically proves RustChain ledger correctness using Hypothesis + deterministic simulation. Invariants tested: - INV-1: Conservation of RTC (no creation/destruction) - INV-2: Non-negative balances (no wallet below 0) - INV-3: Epoch rewards sum to exactly 1.5 RTC (1,500,000 uRTC) - INV-4: Transfer atomicity (failed transfers = zero state change) - INV-5: Antiquity weighting (higher mult miners earn proportionally more) - INV-6: Pending transfer lifecycle (expired = not pending) Testing: - 10,000+ property-based scenarios via Hypothesis - Simulation: 10,000 random transfer+epoch sequences - Live API validation against RustChain node (all 6 checks pass) - CI mode: --ci flag exits 1 on any violation - GitHub Actions workflow included Usage: pip install hypothesis python testing/ledger_invariants.py --verbose --live --scenarios 10000 CI: python testing/ledger_invariants.py --ci --scenarios 10000 All invariants verified against live node (epoch=94, 16 miners). Resolves: Scottcjn/rustchain-bounties#764
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.
Ledger Invariant Test Suite — Bounty #764
Property-based test suite that mathematically proves RustChain ledger correctness using Hypothesis (Python) and deterministic simulation.
What's Included
testing/ledger_invariants.py— 450+ line test suite.github/workflows/ci_ledger_invariants.yml— CI workflow that runs on every PRInvariants Tested
Test Coverage
https://50.28.86.131Live Results (epoch=94, 16 miners)
Usage
CI mode:
Milestones Claimed
Claiming: 85 RTC
RTC Wallet: noxventures_rtc