Skip to content

test(L1): cover claimCredit 14-day no-proof fallback path - #456

Open
forumevi wants to merge 1 commit into
base:mainfrom
forumevi:test/claimcredit-no-proof-14day-fallback
Open

forumevi wants to merge 1 commit into
base:mainfrom
forumevi:test/claimcredit-no-proof-14day-fallback

Conversation

@forumevi

Copy link
Copy Markdown

Summary

AggregateVerifier.claimCredit() has two distinct execution paths:

  • (A) Normal path (expectedResolution != type(uint64).max): requires the game to be resolved before credit can be claimed.
  • (B) 14-day fallback (expectedResolution == type(uint64).max): entered when all submitted proofs are nullified and proofCount drops back to zero; allows the original proposer to recover the bond after 14 days regardless of resolution state.

Path (A) is exercised across AggregateVerifier.t.sol, Nullify.t.sol, and Challenge.t.sol. Path (B) had no coverage.

Changes

Add AggregateVerifierClaimCreditFallbackTest in a new file test/L1/proofs/AggregateVerifierClaimCredit.t.sol with three cases:

Test Outcome
test_claimCredit_noProof_beforeFourteenDays_reverts GameNotOver before the 14-day window
test_claimCredit_noProof_afterFourteenDays_succeeds full two-step DelayedWETH bond return after 14 days
test_claimCredit_noProof_doubleClaimReverts NoCreditToClaim on a second claim attempt

The setUp drives the game into the no-proof state using the same shared-verifier nullification pattern from Nullify.t.sol: a child game nullifies the shared teeVerifier, and a subsequent resolve() call on the parent triggers the early-return path that zeroes proofCount and resets expectedResolution to type(uint64).max.

Validation

  • forge test --match-path test/L1/proofs/AggregateVerifierClaimCredit.t.sol: 3 passed, 0 failed
  • forge test --match-path test/L1/proofs/AggregateVerifier.t.sol: 32 passed, 0 failed (no regressions)

AggregateVerifier.claimCredit() has two branches:
  (A) expectedResolution != max: requires the game to be resolved
  (B) expectedResolution == max: requires 14 days since createdAt

Branch (A) is covered across AggregateVerifier.t.sol, Nullify.t.sol,
and Challenge.t.sol. Branch (B) — reached when all proofs are nullified
and proofCount drops to zero — had no coverage.

Add AggregateVerifierClaimCreditFallbackTest with three cases:
- reverts with GameNotOver before 14 days
- succeeds (full two-step DelayedWETH bond return) after 14 days
- reverts with NoCreditToClaim on a second claim attempt
@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/2
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants