Skip to content

feat: decode contract event logs using verified ABIs#80

Draft
pthmas wants to merge 1 commit into
mainfrom
mewing-bill
Draft

feat: decode contract event logs using verified ABIs#80
pthmas wants to merge 1 commit into
mainfrom
mewing-bill

Conversation

@pthmas
Copy link
Copy Markdown
Collaborator

@pthmas pthmas commented May 28, 2026

Summary

Adds a background worker that decodes EVM contract event logs using verified contract ABIs (including proxy contracts). Decoded results are persisted and surfaced through the API.

Changes

  • contract_abi.rs: Resolves ABIs for contracts — direct or via EIP-1967/EIP-1822 proxy storage slots (calls eth_getStorageAt to find implementation address)
  • event_log_decode.rs: Core decoding logic — matches topic0 to ABI events, decodes indexed/non-indexed params, serializes results; defines decode statuses (pending, decoded, no_abi, no_matching_event, decode_failed)
  • indexer/event_log_decode_worker.rs: Background worker — claims jobs from event_log_decode_jobs queue (SKIP LOCKED), processes logs in batches of 500 per address, supports full rescans
  • Migration 20260528000001: Adds decode_status, decoded_at, decode_attempted_at, decode_source columns to event_logs; creates event_log_decode_jobs queue table; adds partial index on pending logs
  • api/handlers/logs.rs: Simplified — strips proxy forwarding logic, returns decoded fields in log responses
  • api/handlers/proxy.rs: Cleaned up — removes log-related proxy passthrough now handled natively
  • api/handlers/contracts.rs: Queues a decode job when a contract ABI is uploaded
  • indexer/indexer.rs + main.rs: Spawns EventLogDecodeWorker as a tokio task alongside existing workers
  • frontend/src/types/index.ts: Adds EventLog type fields for decode status and decoded params
  • tests/integration/logs.rs: Integration tests for log API responses with decoded data

@pthmas pthmas self-assigned this May 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 302d8e6d-6da9-4fa7-bebe-b636077db5a2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mewing-bill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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