Integration engineering

Record the block context behind a route

Preserve quote and simulation block context so differences can be investigated without pretending routes are immutable.

Two identical quote requests can legitimately produce different routes because they observe different market and chain state. Record context before concluding that the routing engine is inconsistent.

Capture a useful comparison record

Keep request parameters, provider version, response time, supplied block context, selected route and gas assumptions. If the provider does not disclose its block, mark it unknown. Do not substitute your RPC's current head and present it as the provider's observed state.

Ethereum RPC state methods support block selectors, and EIP-1898 describes hash-based selection. Those tools can make your own balance and simulation reads reproducible where the endpoint supports the requested state.

Diagnose differences systematically

Start with the amount, decimals, token identity and trade direction. Then compare account roles, enabled liquidity sources, fee configuration, slippage and gas assumptions. Only after those match should you investigate changing pool state or off-chain quote availability.

An external RFQ can change even while an on-chain block remains the same. Pinning a block therefore does not freeze every source considered by an aggregator. Document which parts of the route depend on off-chain information.

Keep evidence separate from execution

A historical quote is a diagnostic artifact. It should not become an executable transaction merely because its inputs match a current form. Fresh approval state, deadlines and prices still matter.

For a support fixture, store the two request snapshots and their contexts side by side. A difference report should identify unknown fields as unknown, not fill them with zero or current values. This makes investigations honest and avoids invented explanations for route changes.

Sources & verification (2)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. JSON-RPC API

    Transaction submission, receipt retrieval and transaction fields

    https://ethereum.org/developers/docs/apis/json-rpc/
  2. EIP-1898

    Block hash selectors and canonical state

    https://eips.ethereum.org/EIPS/eip-1898

Continue reading

Swap API integration: quote, approve, simulate, submit