Skip to content

test(#60,#61): topic-0 keccak guards + EthFlow 429/malformed-body tests#312

Open
lgahdl wants to merge 1 commit into
nullislabs:feat/m1-mock-venuefrom
bleu:feat/60-61-topic0-ethflow-tests
Open

test(#60,#61): topic-0 keccak guards + EthFlow 429/malformed-body tests#312
lgahdl wants to merge 1 commit into
nullislabs:feat/m1-mock-venuefrom
bleu:feat/60-61-topic0-ethflow-tests

Conversation

@lgahdl

@lgahdl lgahdl commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

What

Closes #60 — topic-0 keccak guards
Closes #61 — EthFlow 429 + malformed-body error-path tests

Why

#60: Both modules pin a hardcoded event_signature (topic-0) in module.toml. A typo or upstream ABI change would silently suppress every log delivery with no runtime error. The new tests compare the constant against alloy_sol_types::SolEvent::SIGNATURE_HASH, which is computed by the ABI encoder at compile time, so the assert catches any drift.

#61: The existing test suite covered 200, 404, and a generic non-404 error (502). Missing paths:

  • 429 rate-limit: must hit the Err(err) branch (Warn + no marker), not accidentally collapse into the 404 branch (Info + no marker — which suppresses the warning).
  • Malformed JSON body with HTTP 200: the observe path treats any Ok(_) as confirmation; it does not parse the body. The test documents this invariant so a future refactor that adds body parsing knows to keep the marker write unconditional.

Changes

File Change
modules/twap-monitor/src/strategy.rs +1 test: topic0_matches_conditional_order_created_canonical_signature
modules/ethflow-watcher/src/strategy.rs +3 tests: topic-0 guard, 429 rate-limit, malformed-body

Fixes #60: both twap-monitor and ethflow-watcher now assert at test time
that the hardcoded topic-0 in module.toml equals keccak256 of the
canonical event ABI string via alloy_sol_types::SolEvent::SIGNATURE_HASH.

Fixes #61: adds two missing coverage paths in ethflow-watcher —
  - 429 rate-limit: verify Warn is emitted and no observed: marker is
    written (distinguishes from the 404 indexer-lag path)
  - malformed JSON body with HTTP 200: verify the strategy writes the
    observed: marker because it treats Ok(_) as confirmation without
    parsing the response body

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfSsJPYDQ1GQGbnSVFxATx
@lgahdl lgahdl requested a review from mfw78 as a code owner July 9, 2026 22:32
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