Add decode-events CLI command for processing JSON event files#2103
Add decode-events CLI command for processing JSON event files#2103findolor wants to merge 2 commits intolocal-db-clifrom
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds a new local-db CLI with fetch-events and decode-events commands. Implements a HyperRpcClient and a SqliteWeb client (fetch/decode/insert modules) with schema SQL. Wires modules into crates, updates Cargo deps, ignores generated files, and tweaks testing/threading and .env newline. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant CLI as CLI LocalDb
participant FE as FetchEvents
participant SW as SqliteWeb
participant HRPC as HyperRpcClient
participant RPC as JSON-RPC Endpoint
User->>CLI: orderbook local-db fetch-events ...
CLI->>FE: execute()
FE->>SW: fetch_events(start,end?,address)
alt end_block not provided
SW->>HRPC: get_latest_block_number()
HRPC->>RPC: eth_blockNumber
RPC-->>HRPC: hex blockNumber
HRPC-->>SW: latest block (u64)
end
loop chunks
SW->>HRPC: get_logs(range,address,topics)
HRPC->>RPC: eth_getLogs
RPC-->>HRPC: logs JSON
HRPC-->>SW: logs text
end
SW-->>FE: aggregated events JSON
FE-->>CLI: write events_{{end}}.json
CLI-->>User: Done
note over SW,HRPC: Retries and concurrency per FetchConfig
sequenceDiagram
autonumber
actor User
participant CLI as CLI LocalDb
participant DE as DecodeEvents
participant DEC as sqlite_web::decode
User->>CLI: orderbook local-db decode-events --input-file ...
CLI->>DE: execute()
DE->>DEC: decode_events(Value::Array)
DEC-->>DE: decoded JSON (structured)
DE-->>CLI: write decoded_events.json
CLI-->>User: Done
note over DEC: Maps topics to event types and decodes ABI data
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (17)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Caution
Chained PR - Do not merge before #2102
Motivation
The CLI needed a way to decode events that have been previously fetched and stored in JSON format. This
functionality allows users to take raw event data and decode it into a more usable format, completing the
workflow of fetching and then processing events locally.
Solution
Checks
By submitting this for review, I'm confirming I've done the following:
Summary by CodeRabbit
New Features
Chores