fix(perf): cache resolve_to_deterministic_address result#6928
fix(perf): cache resolve_to_deterministic_address result#6928hanabi1224 merged 1 commit intomainfrom
Conversation
WalkthroughThe changes implement caching for deterministic address resolution to improve Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
450edd6 to
3016c68
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/rpc/methods/eth/filter/mod.rs (1)
324-331: Consider adding trace-level logging for failed address resolutions.The
.ok()pattern silently discards resolution errors. While this is acceptable for performance, adding a trace log would help with debugging without impacting hot paths:Suggested improvement
let r = ctx .state_manager .resolve_to_deterministic_address(id_addr, tipset) .await - .ok(); + .inspect_err(|e| tracing::trace!("failed to resolve emitter {emitter}: {e:#}")) + .ok(); resolved_id_addrs.insert(emitter, r);This would help diagnose issues when events are unexpectedly skipped without affecting normal performance.
🤖 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 324 - 331, The code silently drops errors by calling .ok() on the result of ctx.state_manager.resolve_to_deterministic_address(id_addr, tipset).await; change this to match the Result so failures emit a trace-level log (e.g., using trace! or ctx.logger.trace) including the emitter, id_addr and the error, and then insert None into resolved_id_addrs as before; keep the hot path behavior (still treating failures as None) but add the trace log in the Err branch to aid debugging in resolve_to_deterministic_address handling.
🤖 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 324-331: The code silently drops errors by calling .ok() on the
result of ctx.state_manager.resolve_to_deterministic_address(id_addr,
tipset).await; change this to match the Result so failures emit a trace-level
log (e.g., using trace! or ctx.logger.trace) including the emitter, id_addr and
the error, and then insert None into resolved_id_addrs as before; keep the hot
path behavior (still treating failures as None) but add the trace log in the Err
branch to aid debugging in resolve_to_deterministic_address handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: dd42f9e6-234e-4318-b0c0-78f27a9662ae
📒 Files selected for processing (2)
src/rpc/methods/eth/filter/mod.rssrc/state_manager/mod.rs
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 11 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes #6879
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit