Skip to content

Conversation

@peterargue
Copy link
Contributor

This PR adds a simple cache for the response from GetBlockByNumber, which can be heavy when there are a lot of tx in a block

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 6, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch peter/soft-finality-blockbynumber-cache

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.

@peterargue peterargue changed the title Implement the RPCBlockHeaderSubscriber for indexing finalized results Add cache for get blocks by number Dec 6, 2025
return handleError[*ethTypes.Block](err, l, b.collector)
}

_ = b.blockByNumberCache.Add(height, apiBlock)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that GetBlockByHash, does pretty much the exact same DB calls, we could possibly improve that one too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea. now that we're not in a rush to get something out, I think we should take a more wholistic approach to caching based on our findings from the load test

Copy link
Collaborator

@m-Peter m-Peter left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

4 participants