Skip to content

fix: optimize collect_events in Eth RPC#6750

Merged
hanabi1224 merged 7 commits intomainfrom
hm/optimize-eth-collect-events
Mar 17, 2026
Merged

fix: optimize collect_events in Eth RPC#6750
hanabi1224 merged 7 commits intomainfrom
hm/optimize-eth-collect-events

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Mar 16, 2026

Summary of changes

This PR tries to optimize the performance of collect_events by porting Sqlite index generation logic from lotus. Simplified caching logic and performance is now bound to tipset_by_height which will be improved later.

Manually verified issues in #6249 are gone.

k6 benchmark results:

# Forest@PR
❯ k6 run -e K6_RPC_URL=http://localhost:2345/rpc/v1 -e K6_METHOD=eth_getLogs tests/single_method.js --duration 30s --vus 20

  █ TOTAL RESULTS

    checks_total.......: 3189670 106319.653008/s
    checks_succeeded...: 100.00% 3189670 out of 3189670
    checks_failed......: 0.00%   0 out of 3189670

    ✓ is status 200
    ✓ is JSON-RPC without error

    HTTP
    http_req_duration..............: avg=313.59µs min=44.86µs med=266.69µs max=7.66ms p(90)=529.85µs p(95)=676.46µs
      { expected_response:true }...: avg=313.59µs min=44.86µs med=266.69µs max=7.66ms p(90)=529.85µs p(95)=676.46µs
    http_req_failed................: 0.00%   0 out of 1594835
    http_reqs......................: 1594835 53159.826504/s

    EXECUTION
    iteration_duration.............: avg=371.36µs min=63.03µs med=323.39µs max=9.42ms p(90)=600.78µs p(95)=758.6µs
    iterations.....................: 1594835 53159.826504/s
    vus............................: 20      min=20           max=20
    vus_max........................: 20      min=20           max=20

    NETWORK
    data_received..................: 290 MB  9.7 MB/s
    data_sent......................: 424 MB  14 MB/s




running (0m30.0s), 00/20 VUs, 1594835 complete and 0 interrupted iterations
default ✓ [======================================] 20 VUs  30s

#Forest@main
❯ k6 run -e K6_RPC_URL=http://localhost:2345/rpc/v1 -e K6_METHOD=eth_getLogs tests/single_method.js --duration 30s --vus 20

  █ TOTAL RESULTS

    checks_total.......: 3133036 104432.816078/s
    checks_succeeded...: 100.00% 3133036 out of 3133036
    checks_failed......: 0.00%   0 out of 3133036

    ✓ is status 200
    ✓ is JSON-RPC without error

    HTTP
    http_req_duration..............: avg=321.13µs min=44.41µs med=267.87µs max=6.26ms p(90)=547.4µs  p(95)=699.53µs
      { expected_response:true }...: avg=321.13µs min=44.41µs med=267.87µs max=6.26ms p(90)=547.4µs  p(95)=699.53µs
    http_req_failed................: 0.00%   0 out of 1566518
    http_reqs......................: 1566518 52216.408039/s

    EXECUTION
    iteration_duration.............: avg=378.24µs min=64.97µs med=323.5µs  max=6.45ms p(90)=617.96µs p(95)=782.22µs
    iterations.....................: 1566518 52216.408039/s
    vus............................: 20      min=20           max=20
    vus_max........................: 20      min=20           max=20

    NETWORK
    data_received..................: 285 MB  9.5 MB/s
    data_sent......................: 417 MB  14 MB/s




running (0m30.0s), 00/20 VUs, 1566518 complete and 0 interrupted iterations
default ✓ [======================================] 20 VUs  30s

# Lotus
❯ k6 run -e K6_RPC_URL=http://localhost:1234/rpc/v1 -e K6_METHOD=eth_getLogs tests/single_method.js --duration 30s --vus 20

  █ TOTAL RESULTS

    checks_total.......: 1270    41.013826/s
    checks_succeeded...: 100.00% 1270 out of 1270
    checks_failed......: 0.00%   0 out of 1270

    ✓ is status 200
    ✓ is JSON-RPC without error

    HTTP
    http_req_duration..............: avg=958.99ms min=487.38ms med=728.49ms max=2.52s p(90)=1.77s p(95)=2.11s
      { expected_response:true }...: avg=958.99ms min=487.38ms med=728.49ms max=2.52s p(90)=1.77s p(95)=2.11s
    http_req_failed................: 0.00%  0 out of 635
    http_reqs......................: 635    20.506913/s

    EXECUTION
    iteration_duration.............: avg=959.22ms min=487.54ms med=728.69ms max=2.52s p(90)=1.77s p(95)=2.11s
    iterations.....................: 635    20.506913/s
    vus............................: 20     min=20       max=20
    vus_max........................: 20     min=20       max=20

    NETWORK
    data_received..................: 92 kB  3.0 kB/s
    data_sent......................: 169 kB 5.5 kB/s




running (0m31.0s), 00/20 VUs, 635 complete and 0 interrupted iterations
default ✓ [======================================] 20 VUs  30s

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes #6249

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • New Features

    • Added executed-tipset/message types and loaders with optional event inclusion.
    • Added a method to resolve a tipset’s child sequentially when head is deeper.
  • Bug Fixes

    • Clearer NotFound signaling when child tipsets are missing or mismatched.
  • Refactor

    • Consolidated caching surface by removing separate receipt/event caches.
    • Standardized error payloads to a more efficient string-backed representation.
  • Chores

    • Removed two public size helper utilities and trimmed related tests.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds ChainStore::load_child_tipset; changes Error::NotFound/State to carry Cow<'static, str>; replaces receipt/event cache with ExecutedMessage/ExecutedTipset and load_executed_tipset helpers; updates RPC, filter logic, dev tooling, tests, and removes two get_size helpers.

Changes

Cohort / File(s) Summary
Chain Store & Errors
src/chain/store/chain_store.rs, src/chain/store/errors.rs
Added pub fn load_child_tipset(&self, ts: &Tipset) -> Result<Tipset, Error> to resolve a tipset's child relative to head; changed Error::NotFound and Error::State to hold Cow<'static, str> and generalized Error::state constructor.
State Manager Core & Tests
src/state_manager/mod.rs, src/state_manager/cache.rs, src/state_manager/utils.rs, src/state_manager/tests.rs
Replaced StateOutputValue with StateOutput; introduced ExecutedMessage, ExecutedTipset, and LoadExecutedTipsetOptions; added load_executed_tipset* helpers; removed dedicated receipt/event cache abstractions and adjusted cache usage and tests.
RPC: eth & filter
src/rpc/methods/eth.rs, src/rpc/methods/eth/filter/mod.rs
Refactored RPC and filter code to consume ExecutedTipset / ExecutedMessage (message + receipt + optional events) instead of prior paired structures; adjusted block/receipt/fee-history construction and filter traversal accordingly.
Dev Subcommand
src/dev/subcommands/state_cmd.rs
Replaced tipset-by-height lookup with load_child_tipset for next-tipset resolution and updated StateOutput destructuring to match new fields.
Utilities: get_size
src/utils/get_size/mod.rs
Removed two public vector heap-size helper functions (vec_with_stack_only_item_heap_size_helper, vec_heap_size_helper).
Cargo/TOML
Cargo.toml
Whitespace-only trimming in workspace lints section; no semantic change.

Sequence Diagram(s)

sequenceDiagram
    participant RPC as RPC handler
    participant SM as StateManager
    participant CS as ChainStore
    participant DB as Blockstore/DB

    RPC->>SM: request executed tipset (include_events?)
    SM->>CS: request tipset state / load child tipset (when resolving next)
    CS->>DB: read tipset / headers
    DB-->>CS: return tipset data
    CS-->>SM: return tipset / child tipset
    SM->>SM: execute messages -> build ExecutedMessage(s) (attach events if requested)
    SM-->>RPC: return ExecutedTipset (state_root, executed_messages)
    RPC->>RPC: build Block / receipts / filters from ExecutedTipset
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • LesnyRumcajs
  • akaladarshi
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: optimize collect_events in Eth RPC' is specific and directly related to the main change in the changeset, which refactors the collect_events implementation in the Eth RPC filter module.
Linked Issues check ✅ Passed The PR addresses the core issue #6249 by redesigning event collection to use ExecutedMessage and load_executed_tipset, simplifying the caching logic and improving error handling for missing ranges and overly broad filters.
Out of Scope Changes check ✅ Passed Changes are focused on refactoring the event collection logic and supporting infrastructure. The removal of cache abstractions and addition of ExecutedMessage/ExecutedTipset types directly support optimizing collect_events.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hm/optimize-eth-collect-events
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch hm/optimize-eth-collect-events
📝 Coding Plan
  • Generate coding plan for human review comments

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

@hanabi1224 hanabi1224 added the RPC requires calibnet RPC checks to run on CI label Mar 16, 2026
@hanabi1224 hanabi1224 marked this pull request as ready for review March 16, 2026 15:32
@hanabi1224 hanabi1224 requested a review from a team as a code owner March 16, 2026 15:32
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and akaladarshi and removed request for a team March 16, 2026 15:32
@hanabi1224 hanabi1224 force-pushed the hm/optimize-eth-collect-events branch from 284905f to 485c446 Compare March 16, 2026 15:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/state_manager/mod.rs (1)

92-113: Document or narrow the new executed-tipset API.

ExecutedMessage, ExecutedTipset, LoadExecutedTipsetOptions, StateOutput, and the new loader methods are now public, but they do not describe their semantics, and LoadExecutedTipsetOptions still looks internal-only. Either add rustdoc here or reduce visibility where possible so we do not commit to an unnecessary API surface.

As per coding guidelines, "Document public functions and structs with doc comments".

Also applies to: 463-481

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/state_manager/mod.rs` around lines 92 - 113, The new types
ExecutedMessage, ExecutedTipset, LoadExecutedTipsetOptions, and StateOutput (and
any new loader methods) are exported publicly without documentation or clear
intended semantics; either add concise rustdoc comments describing the purpose,
fields, and expected invariants for each public type and the loader methods, or
reduce their visibility (e.g., make them pub(crate) or private) if they are
intended for internal use only; update the declarations for ExecutedMessage,
ExecutedTipset, LoadExecutedTipsetOptions, StateOutput, and the loader function
signatures to include the chosen visibility and/or add short /// comments
explaining each field (state_root, receipt, events, include_events,
receipt_root, etc.) and the contract of the loader methods so the public API
surface is intentional and documented.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/rpc/methods/eth/filter/mod.rs`:
- Around line 281-349: The event index bookkeeping is inconsistent: unresolved
events increment event_count before matching and matched unresolved events
increment it again, while resolved non-matches never advance it, making
event_idx unstable. Fix by capturing the current event index at the top of the
loop (e.g., let current_event_idx = event_count; then immediately increment
event_count by 1), use current_event_idx when constructing
CollectedEvent.event_idx, and remove the other event_count increments inside the
resolution/match branches (including the branch that currently increments before
continue and the increment after pushing a CollectedEvent); this ensures each
event advances the counter exactly once and event_idx reflects stable event
order (refer to event_count, CollectedEvent.event_idx, skip_event /
SkipEvent::OnUnresolvedAddress, and the loop over events).

In `@src/utils/get_size/mod.rs`:
- Around line 39-46: Add Rust doc comments (using ///) to the two public helpers
vec_with_stack_only_item_heap_size_helper and vec_heap_size_helper: describe
what each function computes (heap bytes used by a Vec's allocation), document
the type parameter and the v parameter (e.g., that T is item type and v is the
vector whose heap allocation is measured), state the return value (usize bytes),
and note any constraints/traits (for vec_heap_size_helper mention that T:
GetSize is required). Keep comments brief and follow examples in the module
(one-line summary plus short param/returns lines or a short example if present
elsewhere).

---

Nitpick comments:
In `@src/state_manager/mod.rs`:
- Around line 92-113: The new types ExecutedMessage, ExecutedTipset,
LoadExecutedTipsetOptions, and StateOutput (and any new loader methods) are
exported publicly without documentation or clear intended semantics; either add
concise rustdoc comments describing the purpose, fields, and expected invariants
for each public type and the loader methods, or reduce their visibility (e.g.,
make them pub(crate) or private) if they are intended for internal use only;
update the declarations for ExecutedMessage, ExecutedTipset,
LoadExecutedTipsetOptions, StateOutput, and the loader function signatures to
include the chosen visibility and/or add short /// comments explaining each
field (state_root, receipt, events, include_events, receipt_root, etc.) and the
contract of the loader methods so the public API surface is intentional and
documented.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 587e6a20-c54d-44d2-a66d-f68bf6783c7f

📥 Commits

Reviewing files that changed from the base of the PR and between 1e0a5c5 and 485c446.

📒 Files selected for processing (10)
  • src/chain/store/chain_store.rs
  • src/chain/store/errors.rs
  • src/dev/subcommands/state_cmd.rs
  • src/rpc/methods/eth.rs
  • src/rpc/methods/eth/filter/mod.rs
  • src/state_manager/cache.rs
  • src/state_manager/mod.rs
  • src/state_manager/tests.rs
  • src/state_manager/utils.rs
  • src/utils/get_size/mod.rs
💤 Files with no reviewable changes (1)
  • src/state_manager/utils.rs

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 85.20408% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.65%. Comparing base (ef963b4) to head (e9f84d1).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/rpc/methods/eth/filter/mod.rs 77.77% 8 Missing and 4 partials ⚠️
src/state_manager/mod.rs 89.65% 5 Missing and 4 partials ⚠️
src/chain/store/errors.rs 0.00% 3 Missing ⚠️
src/rpc/methods/eth.rs 90.62% 0 Missing and 3 partials ⚠️
src/chain/store/chain_store.rs 94.73% 0 Missing and 1 partial ⚠️
src/dev/subcommands/state_cmd.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/state_manager/cache.rs 98.76% <ø> (+8.79%) ⬆️
src/state_manager/utils.rs 79.31% <ø> (ø)
src/utils/get_size/mod.rs 71.42% <ø> (+15.87%) ⬆️
src/chain/store/chain_store.rs 70.40% <94.73%> (+0.96%) ⬆️
src/dev/subcommands/state_cmd.rs 0.00% <0.00%> (ø)
src/chain/store/errors.rs 14.28% <0.00%> (ø)
src/rpc/methods/eth.rs 68.31% <90.62%> (+0.18%) ⬆️
src/state_manager/mod.rs 70.15% <89.65%> (-0.16%) ⬇️
src/rpc/methods/eth/filter/mod.rs 88.48% <77.77%> (+0.44%) ⬆️

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef963b4...e9f84d1. Read the comment docs.

@hanabi1224 hanabi1224 force-pushed the hm/optimize-eth-collect-events branch from 3967263 to 206f271 Compare March 17, 2026 09:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/rpc/methods/eth/filter/mod.rs (2)

303-312: Address resolution fallback is correct but could be more idiomatic.

The nested if let pattern works correctly. For slightly cleaner pattern matching:

♻️ Optional: Use match for clearer control flow
-                    let resolved = if let Ok(resolved) = result {
-                        resolved
-                    } else {
-                        if let SkipEvent::OnUnresolvedAddress = skip_event {
-                            // Skip event
-                            continue;
-                        } else {
-                            id_addr
-                        }
-                    };
+                    let resolved = match (result, skip_event) {
+                        (Ok(resolved), _) => resolved,
+                        (Err(_), SkipEvent::OnUnresolvedAddress) => continue,
+                        (Err(_), SkipEvent::Never) => id_addr,
+                    };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rpc/methods/eth/filter/mod.rs` around lines 303 - 312, Replace the nested
`if let` with a `match` on `result` to make control flow clearer: match on
`result` producing `resolved` for `Ok(resolved)`, and for `Err(_)` check
`skip_event` to either `continue` when `SkipEvent::OnUnresolvedAddress` or fall
back to `id_addr`; update the binding currently named `resolved` accordingly so
callers use the same variable. Target the block handling `result`, `skip_event`,
`SkipEvent::OnUnresolvedAddress`, and `id_addr` in this function.

271-354: Event collection logic looks correct.

The refactored collect_events properly:

  • Loads executed tipset data via the new load_executed_tipset helper
  • Iterates over ExecutedMessage entries with correct destructuring
  • Tracks event_idx with stable, filter-independent incrementing at the start of each event iteration
  • Handles address resolution failures with appropriate context
  • Enforces max_filter_results before pushing

The is_first_event pattern at lines 284-290 is explicit about zero-based indexing intent, though it could be slightly simplified.

♻️ Optional: Simplify event index tracking

The is_first_event flag pattern works but could be replaced with a simpler approach:

-        let mut event_idx = 0;
-        let mut is_first_event = true;
+        let mut event_idx: i64 = -1;
         for (
             msg_idx,
             ExecutedMessage {
                 message, events, ..
             },
         ) in executed_tipset.executed_messages.into_iter().enumerate()
         {
             if let Some(events) = events {
                 for event in events.iter() {
-                    if is_first_event {
-                        // event index should be zero-based.
-                        event_idx = 0;
-                        is_first_event = false;
-                    } else {
-                        event_idx += 1;
-                    }
+                    event_idx += 1;

This achieves the same zero-based result with less branching.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rpc/methods/eth/filter/mod.rs` around lines 271 - 354, The is_first_event
pattern is verbose; simplify event index tracking in collect_events by removing
is_first_event and using a single mut event_idx: initialize let mut event_idx =
0usize; inside the inner loop capture the current index (e.g., let
current_event_idx = event_idx;) then increment event_idx += 1; and use
current_event_idx when constructing CollectedEvent (instead of event_idx).
Update all references to event_idx in that scope accordingly so behavior remains
zero-based and deterministic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/rpc/methods/eth/filter/mod.rs`:
- Around line 303-312: Replace the nested `if let` with a `match` on `result` to
make control flow clearer: match on `result` producing `resolved` for
`Ok(resolved)`, and for `Err(_)` check `skip_event` to either `continue` when
`SkipEvent::OnUnresolvedAddress` or fall back to `id_addr`; update the binding
currently named `resolved` accordingly so callers use the same variable. Target
the block handling `result`, `skip_event`, `SkipEvent::OnUnresolvedAddress`, and
`id_addr` in this function.
- Around line 271-354: The is_first_event pattern is verbose; simplify event
index tracking in collect_events by removing is_first_event and using a single
mut event_idx: initialize let mut event_idx = 0usize; inside the inner loop
capture the current index (e.g., let current_event_idx = event_idx;) then
increment event_idx += 1; and use current_event_idx when constructing
CollectedEvent (instead of event_idx). Update all references to event_idx in
that scope accordingly so behavior remains zero-based and deterministic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d8dfaee3-4825-4f76-8e2f-e468e6258cf3

📥 Commits

Reviewing files that changed from the base of the PR and between c451d50 and 206f271.

📒 Files selected for processing (1)
  • src/rpc/methods/eth/filter/mod.rs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/state_manager/mod.rs`:
- Around line 92-105: The new public types ExecutedMessage, ExecutedTipset, and
LoadExecutedTipsetOptions (and any other public structs/functions introduced
around lines 463-491) need rustdoc comments: add concise /// doc comments above
each pub struct and above each pub field describing purpose and semantics (e.g.,
ExecutedMessage: what ChainMessage, Receipt, and events represent;
ExecutedTipset: meaning of state_root and executed_messages;
LoadExecutedTipsetOptions: meaning of include_events), and add docs for any
newly public functions or methods in that range explaining their behavior,
inputs, and return values so the public API is fully documented per project
guidelines.
- Around line 467-468: The code is silently converting real storage/blockstore
errors into OK cache-miss behavior by calling .ok() on
self.chain_store().load_child_tipset(...) and using unwrap_or(false); update the
hot-paths (references: load_child_tipset, chain_store(),
load_executed_tipset_inner and the other occurrences around the noted lines) to
distinguish NotFound/Absent cases from genuine IO/errors: do not call .ok() or
blanket unwrap_or(false); instead propagate or return the error (or log and
return an Err) so callers (e.g., eth_getLogs paths) can fast-fail on blockstore
failures, or explicitly match the Result to treat only a NotFound/None as cache
miss while surfacing other errors upstream.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e04ccaf2-3752-4b72-a48c-f564e45a4b33

📥 Commits

Reviewing files that changed from the base of the PR and between 206f271 and d49838f.

📒 Files selected for processing (3)
  • src/rpc/methods/eth.rs
  • src/rpc/methods/eth/filter/mod.rs
  • src/state_manager/mod.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/rpc/methods/eth/filter/mod.rs
  • src/rpc/methods/eth.rs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/state_manager/mod.rs (1)

118-124: Add doc comments to StateOutput.

This public struct lacks documentation while the other new structs (ExecutedMessage, ExecutedTipset, LoadExecutedTipsetOptions) all have proper doc comments. Consider adding a brief description of what state_root and receipt_root represent.

📝 Suggested doc comment
+/// Output of tipset state computation.
+///
+/// Contains the resulting state tree root and the receipt root
+/// after executing all messages in a tipset.
 #[derive(Debug, Default, Clone, GetSize)]
 pub struct StateOutput {
     #[get_size(ignore)]
+    /// Root CID of the state tree after message execution.
     pub state_root: Cid,
     #[get_size(ignore)]
+    /// Root CID of the message receipts AMT.
     pub receipt_root: Cid,
 }

As per coding guidelines, **/*.rs: Document public functions and structs with doc comments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/state_manager/mod.rs` around lines 118 - 124, Add a doc comment to the
public struct StateOutput describing its purpose and briefly explaining the
meaning of its fields: mention that StateOutput represents the resulting roots
after execution and clarify that state_root is the CID of the post-execution
actor state tree while receipt_root is the CID of the message receipt root; add
short /// comments above the struct and each field (StateOutput, state_root,
receipt_root) consistent with the style used on
ExecutedMessage/ExecutedTipset/LoadExecutedTipsetOptions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/state_manager/mod.rs`:
- Around line 118-124: Add a doc comment to the public struct StateOutput
describing its purpose and briefly explaining the meaning of its fields: mention
that StateOutput represents the resulting roots after execution and clarify that
state_root is the CID of the post-execution actor state tree while receipt_root
is the CID of the message receipt root; add short /// comments above the struct
and each field (StateOutput, state_root, receipt_root) consistent with the style
used on ExecutedMessage/ExecutedTipset/LoadExecutedTipsetOptions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f1f62422-5729-4a5a-a698-08f2412b8a1d

📥 Commits

Reviewing files that changed from the base of the PR and between d49838f and e9f84d1.

📒 Files selected for processing (2)
  • Cargo.toml
  • src/state_manager/mod.rs
✅ Files skipped from review due to trivial changes (1)
  • Cargo.toml

@hanabi1224 hanabi1224 enabled auto-merge March 17, 2026 23:24
@hanabi1224 hanabi1224 added this pull request to the merge queue Mar 17, 2026
Merged via the queue into main with commit f49f7dc Mar 17, 2026
35 checks passed
@hanabi1224 hanabi1224 deleted the hm/optimize-eth-collect-events branch March 17, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eth_getLogs: slow responses if the range is not present on the node

3 participants