Skip to content
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

fix: don't clone blocks during get_successors #3687

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

Conversation

mihailjianu1
Copy link
Contributor

Before: blocks were cloned prior to being serialized and returned to the get_successors caller.

After: an Arc to the block is stored instead, and cloning doesn't happen (serialization does not need ownership).

Block responses can get pretty large (~2MB), and cloning them take a long time. This is part of an effort to make the adapter able to process Testnet4 requests within the 50ms timeout from consensus.

@mihailjianu1 mihailjianu1 changed the title Fix: don't clone blocks during get_successors fix: don't clone blocks during get_successors Jan 30, 2025
@github-actions github-actions bot added the fix label Jan 30, 2025
@mihailjianu1 mihailjianu1 marked this pull request as ready for review January 30, 2025 13:35
@mihailjianu1 mihailjianu1 requested a review from a team as a code owner January 30, 2025 13:35
/// For each block hash, if the corresponding block is stored in the `block_cache`, the cached block is returned.
pub fn get_block(&self, block_hash: &BlockHash) -> Option<&Block> {
self.block_cache.get(block_hash)
/// This method takes a hash block
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// This method takes a hash block
/// This method takes a block hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants