-
Notifications
You must be signed in to change notification settings - Fork 908
imp(rpc): increase performance of eth_headerByHash #2856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe recent changes to the codebase involve significant updates to the Ethereum backend functionality. Key modifications include enhancements to the Changes
Possibly related PRs
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional comments not posted (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @fedekunze!!
Left a few comments
Also, unit tests are failing, looking into these...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- rpc/backend/backend_suite_test.go (1 hunks)
- rpc/backend/blocks_test.go (18 hunks)
- rpc/backend/client_test.go (2 hunks)
Additional context used
GitHub Check: Run golangci-lint
rpc/backend/client_test.go
[failure] 264-264:
unused-parameter: parameter 'tx' seems to be unused, consider removing or renaming it as _ (revive)
Additional comments not posted (6)
rpc/backend/backend_suite_test.go (1)
81-82
: LGTM!The changes to the
SetupTest
function look good. The addition ofWithClient(mocks.NewClient(suite.T()))
enhances the test suite's ability to simulate client interactions during tests by setting up a mock client. The removal of the previous line that setsuite.backend.clientCtx.Client
to a new mock client indicates a shift in how the client context is managed within the test setup. These changes streamline the client configuration process and ensure that the test suite uses the appropriate mock implementations for its operations.rpc/backend/client_test.go (3)
261-277
: LGTM!The function correctly sets up a mock response for testing the
HeaderByHash
RPC method.Tools
GitHub Check: Run golangci-lint
[failure] 264-264:
unused-parameter: parameter 'tx' seems to be unused, consider removing or renaming it as _ (revive)
279-282
: LGTM!The function correctly sets up a mock error response for testing the
HeaderByHash
RPC method.
284-287
: LGTM!The function correctly sets up a mock response for testing the
HeaderByHash
RPC method when the header is not found.rpc/backend/blocks_test.go (2)
676-677
: Approve the refactoring to use a mocked client.The change to use a mocked client for retrieving block results is a good refactoring that improves the test isolation and control over the test environment. The overall logic flow remains intact.
Line range hint
717-727
: Approve the change to use specific header mocking methods.The change to use
RegisterHeaderByHashError
andRegisterHeaderByHash
methods for mocking the client responses is a good refactoring that improves the specificity of the mocks. The overall logic flow and test cases remain the same.
https://github.com/Mergifyio backport rama/release-v20 |
✅ Backports have been created
|
* imp(rpc): increase performance of eth_headerByHash * c++ * update unit tests * address review comments --------- Co-authored-by: tom <tomasguerraalda@hotmail.com> (cherry picked from commit 1f0432f)
…2870) * imp(rpc): increase performance of eth_headerByHash (#2856) * imp(rpc): increase performance of eth_headerByHash * c++ * update unit tests * address review comments --------- Co-authored-by: tom <tomasguerraalda@hotmail.com> (cherry picked from commit 1f0432f) * update chlog --------- Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: tom <tomasguerraalda@hotmail.com>
Description
CometRPC now supports querying the Header by hash, improving perf since we no longer need to query the entire block.
Other minor improvements were included
Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
Reviewers Checklist
All items are required.
Please add a note if the item is not applicable
and please add your handle next to the items reviewed
if you only reviewed selected items.
I have...
Unreleased
section inCHANGELOG.md
Summary by CodeRabbit
Summary by CodeRabbit
New Features
GetPendingTransactions
method to accurately fetch the chain ID from the backend.Bug Fixes
Refactor
GetTransactionLogs
method for improved efficiency.Style