Skip to content

feat(ethflow-watcher): decode CoWSwapEthFlow OrderPlacement (BLEU-832)#9

Open
brunota20 wants to merge 2 commits into
feat/ethflow-watcher-skeleton-bleu-831from
feat/ethflow-watcher-decode-bleu-832
Open

feat(ethflow-watcher): decode CoWSwapEthFlow OrderPlacement (BLEU-832)#9
brunota20 wants to merge 2 commits into
feat/ethflow-watcher-skeleton-bleu-831from
feat/ethflow-watcher-decode-bleu-832

Conversation

@brunota20

Copy link
Copy Markdown
Collaborator

Summary

`on_event(Event::Logs)` matches each log against `CoWSwapOnchainOrders.OrderPlacement` and keeps the four fields BLEU-833's submission path consumes: `sender`, `order` (`GPv2OrderData`), `signature` (`OnchainSignature { scheme, data }`), and `data`.

Guardrails

`decode_order_placement` rejects a log when:

  • the contract address is neither `ETH_FLOW_PRODUCTION` nor `ETH_FLOW_STAGING` (both share the same address on every chain — defensive against a misconfigured `[[subscription]]` filter);
  • topic0 does not match `OrderPlacement::SIGNATURE_HASH`;
  • the ABI body fails to decode (truncated or wrong layout).

The decoder is on plain slices, so the host-free tests cover all branches without wit-bindgen scaffolding.

`DecodedPlacement` boxes `GPv2OrderData` (~300 bytes) for cache friendliness; the struct stays private + `#[allow(dead_code)]` until BLEU-833 wires submission.

Stacks on #8 (BLEU-831 skeleton).

Linear: BLEU-832. Ref ADR-0006.

Test plan

  • `cargo test -p ethflow-watcher` — 7 host tests (well-formed, staging address, unrelated contract, wrong topic, truncated address, truncated data, empty topics).
  • `cargo clippy --target wasm32-wasip2 -p ethflow-watcher -- -Dwarnings`.
  • `cargo clippy -p ethflow-watcher --tests -- -Dwarnings`.
  • `cargo build --target wasm32-wasip2 --release -p ethflow-watcher` — 96 KB .wasm (was 67 KB skeleton; `CoWSwapOnchainOrders` ABI + GPv2OrderData decode pull in ~30 KB).

\`on_event(Event::Logs)\` matches each log against
\`CoWSwapOnchainOrders.OrderPlacement\` and keeps the four
fields BLEU-833's submission path will consume:

  (sender, order, signature, data)

where \`order\` is the 12-field \`GPv2OrderData\` the
settlement contract verifies, and \`signature\` is the typed
\`OnchainSignature { scheme, data }\` pair (EIP-1271 or
PreSign).

Guardrails: \`decode_order_placement\` rejects the log when
the contract address is not one of the canonical EthFlow
deployments (production or staging — both share the same
address on every chain). topic0 must match the event
signature hash and the body must round-trip through
\`SolEvent::decode_raw_log\`. The decoder is on plain slices so
the seven host-free tests cover the happy path, the alternate
staging address, an unrelated contract, a wrong topic, a
truncated address, a truncated body, and an empty topic list.

\`DecodedPlacement\` boxes \`GPv2OrderData\` (~300 bytes); the
struct is kept private and \`#[allow(dead_code)]\` until
BLEU-833 wires the submit path.

\`cargo build --target wasm32-wasip2 --release -p
ethflow-watcher\` -> 96 KB .wasm (was 67 KB skeleton; the
\`CoWSwapOnchainOrders\` ABI + GPv2OrderData decode pull in
~30 KB of alloy sol-types runtime).

Linear: BLEU-832. Ref ADR-0006.
@linear-code

linear-code Bot commented Jun 15, 2026

Copy link
Copy Markdown

BLEU-832

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