Skip to content

test: pin the bond dispute window to the verdict, to the second - #5

Open
predge-ai wants to merge 1 commit into
mainfrom
test/bond-window-from-verdict-boundaries
Open

predge-ai wants to merge 1 commit into
mainfrom
test/bond-window-from-verdict-boundaries

Conversation

@predge-ai

Copy link
Copy Markdown
Member

A partner review read the pre-2026-10-03 PredgeValidatorBond (v2) and noted that its dispute window started at the stake, not the verdict, while the comment said the opposite. That was real in v2 (reclaim checked s.stakedAt + disputeWindow) and was fixed in c0762ea. v2.1, which runs the window from scoredAt, has been live since 2026-10-03:

Chain v2.1 bond disputeWindow()
Arc mainnet (5042) 0xfeE8b89eb8aa2499F7025Cd9aaEB13a4b046d0d1 86400
Arbitrum One 0x3db39A8dFdc7157f8B8a2AacD201081378Cef04f 86400
Robinhood Chain 0xee76acb042d21EEd8320d44a48E03738288f9737 86400

The 1 second window the review saw is the August Arc testnet bond 0xCDd95Bd9…55d2acF (v1 design, disputeWindow() == 1, nothing bonded). It is labelled as testnet and pre-2026-09-18 in the README.

This PR adds no contract change. It adds boundary tests against the current source, each with a stake posted 30 days before the verdict:

  • the old stake does not shorten the window;
  • reclaim reverts at verdictTime + window - 1;
  • reclaim succeeds at exactly verdictTime + window;
  • a lying verdict is still challenged on the last second of the window, and the challenger receives the whole bond.

Block time is deterministic (ganache timestampIncrement: 1), so each transaction lands on the intended second. Switching reclaim back to stakedAt makes the new suite fail (checked locally).

npm test now runs all five bond and arbiter suites: 8 + 3 + 4 + 8 + 3 passed.

PredgeValidatorBond v2.1 (live since 2026-10-03 on Arc, Arbitrum One and
Robinhood Chain) runs the dispute window from recordScore. These tests pin
that at the boundaries, with a stake posted 30 days before the verdict:

- the old stake does not shorten the window;
- reclaim reverts at verdictTime + window - 1;
- reclaim succeeds at exactly verdictTime + window;
- a lying verdict is still challenged on the last second of the window,
  and the challenger receives the whole bond.

Block time is made deterministic (ganache timestampIncrement 1) so each
transaction lands on the intended second. Switching reclaim back to
stakedAt makes the suite fail.

npm test now runs all five bond and arbiter suites. Refreshes the header of
bond-reclaim-window.test.mjs, which still called the v2 source "deployed".
@claude

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

This branch has not been deployed

No deployments
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.

1 participant