Skip to content

fix(ethereum): handle trace_filter traces missing result.output via c…#6535

Open
ibrahim1023 wants to merge 1 commit intographprotocol:masterfrom
ibrahim1023:fix-6489-trace-output-compat
Open

fix(ethereum): handle trace_filter traces missing result.output via c…#6535
ibrahim1023 wants to merge 1 commit intographprotocol:masterfrom
ibrahim1023:fix-6489-trace-output-compat

Conversation

@ibrahim1023
Copy link
Copy Markdown

Summary

Fixes #6489

This PR fixes a regression where trace_filter responses fail to deserialize when a trace result is missing the output field (for example, some Sonic traces), causing repeated retries and trace ingestion failure.

Root Cause

Graph Node now uses Alloy trace types for trace_filter responses. Some providers return traces where result.gasUsed is present but result.output is omitted. Alloy deserialization treats that as an invalid TraceOutput variant and fails the entire response.

What Changed

  • Kept the normal typed Alloy trace_filter request path unchanged for healthy responses.
  • Added targeted detection for the known deserialization error:
    • data did not match any variant of untagged enum TraceOutput
  • Added a compatibility fallback path only for that error:
    • re-issue trace_filter as raw JSON
    • patch traces with missing result.output by injecting "output": "0x" when result.gasUsed exists
    • deserialize patched JSON back into Vec<LocalizedTransactionTrace>
  • Added/updated regression coverage in ethereum_adapter tests for:
    • reproducing the original missing-output deserialization error
    • verifying the compatibility patch injects result.output

Why This Is Safe

  • The fallback is narrow and only activates for one known error signature.
  • Normal successful responses stay on the existing typed path.
  • Patch logic is minimal and scoped to trace entries where result already indicates execution output context (gasUsed) but output is omitted.
  • Existing parsing/trigger logic remains unchanged.

Validation

Executed locally:

  • cargo test -p graph-chain-ethereum missing_output_trace_repro -- --nocapture
  • cargo test -p graph-chain-ethereum

Result: all tests passed (50 passed, 0 failed for graph-chain-ethereum).

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.

[Bug] Graphnode can no longer parse traces with results missing output field

1 participant