Skip to content

test(bridge): add fuzz tests for route parameter bounds - #1408

Merged
mijinummi merged 1 commit into
MDTechLabs:mainfrom
integral-830:test/1310-route-bounds-fuzz
Oct 22, 2026
Merged

mijinummi merged 1 commit into
MDTechLabs:mainfrom
integral-830:test/1310-route-bounds-fuzz

Conversation

@integral-830

Copy link
Copy Markdown

Summary

Adds seeded, reproducible fuzz/property tests for BridgeRoute parameter bounds. No contract changes.

  • setRoute: bps accepted exactly in [0, 10000]; out-of-range reverts and leaves state unchanged; zero token rejected; admin-only (access check wins over validation)
  • validateRoute: matches an exact BigInt model including the slippage/fee boundary and check order; 256-bit overflow reverts (Panic 0x11) and never wraps; monotonic in expected amount and fee
  • Routes are directional and keyed by (src, dst, token); unsupported/incompatible routes fail closed for any amounts
  • "Known gaps" block pins current surprising behavior (zero amount skips checks, exposureLimit unenforced, setRoute resets assetCompatible, unbounded chain ids, misleading ZeroAmount error)
  • Wired into CI; docs in docs/ROUTE_PARAMETER_FUZZ_TESTS.md (usage, invariants, failure semantics, gas/upgrade notes)

Closes #1310

Verification

  • pnpm exec hardhat test test/bridge/BridgeRoute.fuzz.test.ts → 14 passing (seeds 1310, 1, 42, 99999; 600 runs on seed 7)
  • Mutation checks (bps bound, fee boundary, slippage boundary, bps scale) each make the suite fail
  • Replay a failure with FUZZ_SEED=<seed>

Seeded, reproducible fuzz/property tests for BridgeRoute.setRoute, setAssetCompatible and validateRoute. Known surprising behavior is pinned in a known-gaps block. Wired into CI; no contract changes.

Closes MDTechLabs#1310
@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@integral-830 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@mijinummi
mijinummi merged commit 8e3329f into MDTechLabs:main Oct 22, 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.

Add fuzz tests for route parameter bounds

2 participants