Skip to content

chore: improve eth_getLogs #2991

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

chore: improve eth_getLogs #2991

wants to merge 1 commit into from

Conversation

mfrankovi
Copy link
Contributor

No description provided.

@mfrankovi mfrankovi marked this pull request as draft March 14, 2025 16:37
@mfrankovi mfrankovi requested review from kstdl and MatusKysel March 17, 2025 14:22
@mfrankovi mfrankovi marked this pull request as ready for review March 26, 2025 12:40
@mfrankovi mfrankovi changed the base branch from master to develop April 28, 2025 11:00
@MatusKysel MatusKysel requested a review from Copilot April 28, 2025 13:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the implementation and usage of the eth_getLogs functionality by refactoring transaction retrieval logic and updating cache access patterns.

  • Refactored DbStorage::getTransaction to delegate transaction extraction to a new helper method.
  • Updated LogFilter to use the new transaction lookup and revised the block receipt matching logic.
  • Modified consensus components (FinalChain and cache) to support the new transaction API and caching patterns.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libraries/core_libs/storage/src/storage.cpp Refactored transaction retrieval for non-system transactions by extracting logic into a helper method.
libraries/core_libs/storage/include/storage/storage.hpp Added declaration for the new const helper method for transaction retrieval.
libraries/core_libs/network/rpc/eth/LogFilter.cpp Updated log matching to use the new transaction lookup and altered receipt processing logic.
libraries/core_libs/consensus/include/final_chain/final_chain.hpp Introduced a new transaction method in FinalChain that first checks the cache then falls back to DbStorage.
libraries/core_libs/consensus/include/final_chain/cache.hpp Changed the cache getter to return an optional value, then used it in the existing get method.
Comments suppressed due to low confidence (2)

libraries/core_libs/network/rpc/eth/LogFilter.cpp:133

  • [nitpick] Consider renaming 'ret_block' to a more descriptive name (e.g., 'indexed_log_entries') to clarify its purpose when storing pairs of transaction index and log entries.
std::vector<std::pair<uint64_t, LocalisedLogEntry>> ret_block;

libraries/core_libs/network/rpc/eth/LogFilter.cpp:132

  • The original equality check 'block_receipts->size() == hashes->size()' was removed. Confirm that this change is intentional since a mismatch in sizes between receipts and transaction hashes could lead to alignment issues.
if (block_receipts && block_receipts->size()) {

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.

3 participants