Skip to content

feat(benchmark): add audit subcommand for on-chain quote validation#215

Open
kayibal wants to merge 2 commits into
mainfrom
feat/benchmark-audit
Open

feat(benchmark): add audit subcommand for on-chain quote validation#215
kayibal wants to merge 2 commits into
mainfrom
feat/benchmark-audit

Conversation

@kayibal

@kayibal kayibal commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an audit subcommand to fynd-benchmark that fetches quotes from Fynd and external aggregators (KyberSwap, Nordstern, 0x) for a set of token pairs, then re-executes each quote on-chain via eth_simulateV1 to measure the real amount received
  • ERC-20 state-override support handles both standard Solidity mapping layouts (slots 0–20) and OpenZeppelin v5 namespaced storage
  • Native ETH output is validated by injecting a 10-byte EVM balance-reader contract into simulation state; zeroing sender balance and setting gasPrice=0 ensures the result equals ETH received exactly
  • Nordstern non-JSON pseudo-schema responses (returned for unsupported pairs) are treated as NoRoute instead of propagating as errors

🤖 Generated with Claude Code

@tamaralipows tamaralipows force-pushed the feat/benchmark-audit branch 2 times, most recently from 1db96a4 to 5ab903c Compare June 8, 2026 19:03
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

No API Breaking Changes Detected

The PR title signals breaking changes, but cargo-semver-checks found none.
If the breaking change is behavioral, CLI, or config-level (not public Rust API), this is expected.
Otherwise, consider using fix: instead of feat: in the PR title.

@tamaralipows tamaralipows force-pushed the feat/benchmark-audit branch from 5ab903c to 06dc7b4 Compare June 11, 2026 04:44
kayibal and others added 2 commits June 12, 2026 11:40
Adds an `audit` subcommand that fetches quotes from Fynd and external
aggregators (KyberSwap, Nordstern, 0x) for a configurable set of token
pairs, then re-executes each quote on-chain via eth_simulateV1 to measure
the real amount received.

- audit.rs: simulation harness using eth_simulateV1 with state overrides
  for token balance and allowance; falls back to eth_call when the node
  does not support eth_simulateV1
- erc20.rs: storage-slot detection for standard Solidity mapping layouts
  (positions 0–20) and OpenZeppelin v5 namespaced storage
- aggregator.rs: quote clients for KyberSwap, Nordstern, and 0x;
  Nordstern non-JSON pseudo-schema responses are mapped to NoRoute
- pair_selector.rs: random pair selection from live Tycho pools
- Native ETH output is measured by injecting a 10-byte balance-reader
  contract into simulation state; zeroing sender balance and setting
  gasPrice=0 ensures the result equals ETH received exactly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Support wrap/unwraps. Increased max_hops to 3 to accommodate for a potential additional wrap/unwrap. This was already what was in the defaults in solver.rs (POOL_MAX_HOPS).
@tamaralipows tamaralipows force-pushed the feat/benchmark-audit branch from 53ce7a2 to 48ae84f Compare June 12, 2026 18:16
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