Skip to content

[good first issue] Golden-file tests for intent decoders (Across + UniswapX) #8

@abhicris

Description

@abhicris

Context

The Across decoder (src/intents/across.rs, PR #3) has a decode_deposit_event pure-function entry point that's perfect for golden-file testing, but right now our coverage is shallow. Agents downstream of resolver trust the decoder to produce stable, normalized Intents — we should lock that behavior with fixture-based tests that fail loudly if the decoder's output drifts.

Scope

  • Create tests/fixtures/ at repo root.
  • For each supported decoder (Across, UniswapX), capture 3 real JSON fixtures:
    • tests/fixtures/across_v3_deposit_eth_to_arb.json — a real V3FundsDeposited event JSON (you can pull one from Etherscan logs or the Across subgraph).
    • tests/fixtures/across_v3_deposit_base_to_arb.json
    • tests/fixtures/across_v3_expired.json — one where fill_deadline < now, to pin expiry-handling behavior.
    • Corresponding UniswapX fixtures for mainnet and Arbitrum.
  • For each fixture, create a matching <name>.expected.json that captures the normalized Intent output (pretty-printed JSON). These become golden files.
  • Add tests/intent_decoders.rs that:
    1. Loads each fixture.
    2. Runs it through the decoder.
    3. Serializes the resulting Intent with serde_json::to_string_pretty.
    4. Asserts == against the .expected.json.
  • Document fixture format in tests/fixtures/README.md so future decoders can add their own.

Acceptance criteria

  • cargo test --test intent_decoders green.
  • cargo clippy --tests clean.
  • If a contributor breaks decoder output, the failing diff is human-readable (use pretty_assertions crate — add as dev-dep).
  • At least 6 fixtures total across the two decoders.

Reference: src/intents/across.rs decode_deposit_event, and PR #3 for the testing conventions already in place.

Estimated effort

S (4–6 hours) — the work is collecting real data and committing the goldens.

kcolbchain / Abhishek Krishna

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions