Repository navigation
test(rewards): add soak and concurrency stress test for double-spend detection - #102
Open
Ranjeet2063 wants to merge 1 commit into
Open
Ranjeet2063 wants to merge 1 commit into
Ranjeet2063 wants to merge 1 commit into
Conversation
…detection Implements comprehensive soak and concurrency stress testing for proof approval and reward payout pipeline under concurrent worker races and failure injections. - Simulates 50+ concurrent proof approvals with competing workers claiming outbox rows. - Injects controllable failures: worker termination/crashes mid-payout and transient network drops. - Asserts global invariants via automated query verification: 1. Zero duplicate on-chain Stellar transactions per proofId. 2. Zero duplicate PAID rows in RewardPayout table. 3. Zero orphaned PROCESSING rows after sweeper drain. 4. Exact token amount conservation (sum of payouts == sum of approved rewards). Closes ecotask-network#82
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
Problem
Without a comprehensive load/soak stress test, the proof approval and reward payout pipeline cannot be systematically verified against race conditions, process crashes, or network dropouts that could risk duplicate on-chain Stellar transactions or duplicate
RewardPayoutrecords (#82).Solution
This PR adds a dedicated soak and concurrency stress testing suite to
tests/integration/proof-to-reward.test.tswith controllable failure injections and automated invariant query verification:High-Throughput Concurrency Simulation:
Controllable Failure Injections:
PROCESSINGstate, verifying that the sweeper recovers stale rows without duplicating transactions upon retry.Automated Invariant Queries:
proofIdacross all injected failures (duplicateOnChainPayments.length === 0).PAIDstatus rows inRewardPayouttable (duplicatePaidRows.length === 0).PROCESSINGrows remaining after sweep and drainage.sum(paid amounts) === sum(approved proof reward amounts)).Verification
npx jest tests/integration/proof-to-reward.test.ts: 5/5 tests passed 100% green.npx eslint tests/integration/proof-to-reward.test.ts: 0 errors, 0 warnings.npx prettier --check tests/integration/proof-to-reward.test.ts: 100% compliant.Closes #82