Skip to content

perp-fees harness: 4 data bugs (Paradex, gains, dYdX, GMX) - #1234

Merged
Flotapponnier merged 1 commit into
mainfrom
fix/critical-audit-batch-main
Jul 16, 2026
Merged

perp-fees harness: 4 data bugs (Paradex, gains, dYdX, GMX)#1234
Flotapponnier merged 1 commit into
mainfrom
fix/critical-audit-batch-main

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Cherry-pick of #1233 to main.

Fixes 4 data-quality bugs in the perp-fees harness. See #1233 for the full breakdown.

Note: merging this to main does NOT deploy the harness. The harness runs on VPS ocb-par-main and needs a manual rsync + rebuild via the standard runbook after merge.

Test plan

  • go build clean
  • Post-deploy: verify Paradex tiers, gains SOL, dYdX ETH walk, GMX Subsquid error surfacing

…order, GMX Subsquid error surfacing

- Paradex: cap fill ratio at 90% of visible book (depth=100). Tiers that eat through the tail now return book_too_thin and skip publishing instead of inflated 150-500 bps ghost values.
- gains: only cache USD-quoted pairs during pair discovery, widen scan 60->200. Root cause was a SOL/BTC pair overwriting the SOL/USD cache entry, publishing the wrong feeIndex and uniform 4.333 bps across ETH/BTC/SOL.
- dydx: sort v4-indexer level responses (asks ascending, bids descending) before walking the book. Insertion-order walk produced 1.7-2x inflated headline at 100k/1M tiers.
- gmx: prefix Subsquid errors, surface GraphQL errors[], fall back to unsuffixed positionFeeFactor if the impact-branch field is absent, and error out on zero factor. Prevents the silent-6bps-constant fallback path.

Verified: go build + go vet clean.
@Flotapponnier
Flotapponnier merged commit ba97dc5 into main Jul 16, 2026
1 check failed
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