Skip to content

fix+feat: unbreak CI + add Across V3 cross-chain decoder (Arbitrum-preferring)#3

Merged
abhicris merged 1 commit intomainfrom
fix-ci-and-arbitrum-intents
Apr 21, 2026
Merged

fix+feat: unbreak CI + add Across V3 cross-chain decoder (Arbitrum-preferring)#3
abhicris merged 1 commit intomainfrom
fix-ci-and-arbitrum-intents

Conversation

@abhicris
Copy link
Copy Markdown
Contributor

Root cause of CI break

cargo clippy -- -D warnings rejected six things the initial scaffold left behind:

  1. Unused ResolverError import in src/solver/engine.rs.
  2. Unused raw: &[u8] parameter in UniswapXDecoder::decode (stub impl).
  3. Dead fields on UniswapXOrder (order_status, swapper) and on OrderInput (end_amount) — these are real API fields we'll want for audit/risk/Dutch-decay work, so they're kept with #[allow(dead_code)] and a comment explaining why, rather than deleted.
  4. clippy::implicit_saturating_sub in Intent::time_remaining — replaced with saturating_sub.
  5. clippy::let_and_return on the surplus_f64 binding in SolverEngine::evaluate — inlined.
  6. rustfmt drift (import ordering, block bracing). Fixed by running cargo fmt.

All fixes are surgical — no behaviour changes.

What's new

src/intents/across.rs — Across Protocol V3 decoder that the README promised as "Planned". It:

  • Implements IntentDecoder, so it drops into the existing SolverEngine next to UniswapX.
  • Exposes decode_deposit_event — a pure, network-free parse of a V3 FundsDeposited-shaped JSON payload into our normalised Intent. That's what the engine and tests both go through.
  • Exposes RoutingPreferences with preferred_dest: Chain::Arbitrum as the default. Solvers that want to prefer Base or Optimism can .with_preferences(...).
  • Ships with 5 offline unit tests (ETH→Arbitrum decode, default prefers-Arbitrum, custom preference override, unknown-chain rejection, raw-bytes decode() via serde_json).
  • Provides a live probe via fetch_open_intents against app.across.to, but returns an empty list on error rather than propagating, so the engine's cycle loop stays healthy when the API flakes.

CLI wired too:

resolver scan  --protocol across --chain ethereum
resolver solve --protocol across --chain arbitrum

Why it matters for the agent-economy thesis

Agents that settle across chains need intent-based bridging with a preferred landing chain. Across V3 is the protocol for that today; Arbitrum is the landing chain for stablecoin-denominated (CR8-USD-style) agent settlement — cheap gas, deep USDC/USDT liquidity, and the ecosystem the AI-agent economy is building on. This decoder is the first step: every Across deposit flowing Ethereum→Arbitrum now becomes a normalised Intent the solver can reason about, with a preference knob that says "this one lands where agents want to be."

Next steps (separate PRs):

  • Replace the JSON decode() fallback with real ABI decoding of the V3 event log.
  • Teach SolverEngine::evaluate to weight quotes by RoutingPreferences::prefers.
  • Add a CoW Protocol decoder (the other "Planned" item in the README).

kcolbchain / Abhishek Krishna

…eferring)

CI was red because `cargo clippy -- -D warnings` tripped on dead fields
in the UniswapXOrder/OrderInput DTOs, an unused import in solver/engine,
a let-and-return in the surplus_usd calc, an implicit_saturating_sub in
Intent::time_remaining, and an unused `raw` arg in the UniswapX decode
stub. All fixed surgically — no behavioural change.

On top of the CI fix, add the Across Protocol V3 intent decoder the
README promised (`src/intents/across.rs`). The decoder:

- Implements the shared `IntentDecoder` trait so it drops into the
  existing `SolverEngine` alongside UniswapX.
- Exposes a pure `decode_deposit_event` path that turns a V3
  FundsDeposited-shaped JSON payload into our normalised `Intent`,
  making it unit-testable without network.
- Exposes `RoutingPreferences` with Arbitrum as the default preferred
  destination — this is the agent-economy hook. When agents settle in
  a stablecoin (CR8-USD-style), Arbitrum is today's low-fee / deep-
  liquidity landing chain, so the solver now has a knob to express
  that preference.
- Ships with 5 offline unit tests covering ETH→Arbitrum decoding,
  default + overridden preferences, unknown-chain rejection, and the
  raw-bytes `decode()` path via serde_json.

Also wires the CLI so `resolver scan --protocol across --chain ethereum`
and `resolver solve --protocol across --chain arbitrum` route to the
new decoder.

— [kcolbchain](https://kcolbchain.com) / [Abhishek Krishna](https://abhishekkrishna.com)
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