SIG-605: add comprehensive fork e2e tests for SignalsRouter#66
Conversation
7 fork tests validating Router against real Citrea mainnet state: - Real Satsuma USDC.e→ctUSD swap + ABI selector verification - All 5 Router functions (open/increase/decrease/close/claim) against real SignalsCore and SignalsPosition - Claim uses secondary settlement path (no oracle dependency)
There was a problem hiding this comment.
Summary
This PR adds comprehensive fork tests for SignalsRouter (introduced in PR #65), exercising all 5 router entry points (openPositionWithSwap, increasePositionWithSwap, decreasePositionWithSwap, closePositionWithSwap, claimPayoutWithSwap) against a live Citrea mainnet fork with real Satsuma swap liquidity and real Core contract state. The claimPayoutWithSwap test drives the full secondary settlement path end-to-end. The existing swap test is renamed for clarity and simplified.
Cross-PR Context
Sibling PRs (SIG-605)
v1-contractPR#65 (MERGED): SIG-605: add SignalsRouter for atomic swap-and-bet — the production contract this PR tests
No downstream repos affected — this is test-only code with no interface or ABI changes.
Issues
No issues found.
Suggestions
No suggestions.
Verdict
APPROVE: Clean test PR with comprehensive coverage of all router entry points including the settlement claim path. Settlement timing logic (warp sequences, PendingOps phase, claimDelay) is correct. The settlementValue = winningTick * 1e6 calculation correctly maps tick values (price × 100) to 8-decimal Redstone feed format. Helper design (_findActiveMarket backward search, _openRealPosition center-tick alignment) is sound.
Context
SIG-605 added the
SignalsRouterfor atomic swap-and-bet operations (PR #65). This PR adds comprehensive fork tests that exercise the Router against a live Citrea mainnet fork — real Satsuma swaps, real Core contract state.Decisions
FORK_ENV=prod) so they validate against actual deployed contracts and pool liquidity, not mock stateopenPositionWithSwap,increasePositionWithSwap,decreasePositionWithSwap,closePositionWithSwap,claimPayoutWithSwapclaimPayoutWithSwaptest drives the settlement path (warp → markSettlementFailed → finalizeSecondarySettlement → requestSettlementChunks → claim) to cover the payout flow end-to-end_findActiveMarkethelper searches backward fromnextMarketIdfor an active, seeded, in-window market — tests skip gracefully if none exists_openRealPositionplaces the position at center ticks (not edge) so the cost/payout is meaningful rather than near-zerotest_satsuma_swap_usdcE_to_ctUSDfor clarity and simplified (removed redundant local variables)Risk Areas
claimPayoutWithSwaptest manipulates settlement state viaownerSafe— the settlement value calculation (winningTick * 1e6) assumes 8-decimal Redstone feed and tick = price * 100 convention_findActiveMarketiterates up tonextMarketId + 5— relies on there being an active market during test executionSibling PRs
v1-contractPR SIG-605: add SignalsRouter for atomic swap-and-bet #65: SIG-605: add SignalsRouter for atomic swap-and-bet (CLOSED/MERGED)