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

feat: add another distance check #3501

Merged
merged 1 commit into from
Jul 2, 2023

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Jun 30, 2023

while we're downloading via tree, we're still receiving new payloads and FCU, so the sync target and the finalized block and hence the distance from local to head constantly moves, and can eventually exceed the targeted 1 epoch.

this adds another check to also lookup if we have the latest finalized block buffered so we can check the distance here again.

This prevents the scenario where we receive a future finalized block the NewPayload and therefore never have to download the finalized block if the FCU is updated.

@mattsse mattsse added C-perf A change motivated by improving speed, memory usage or disk footprint A-consensus Related to the consensus engine labels Jun 30, 2023
@codecov
Copy link

codecov bot commented Jun 30, 2023

Codecov Report

Merging #3501 (fc48f50) into main (b225b47) will increase coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

Impacted Files Coverage Δ
crates/blockchain-tree/src/blockchain_tree.rs 82.26% <0.00%> (ø)
crates/blockchain-tree/src/shareable.rs 38.52% <0.00%> (-2.00%) ⬇️
crates/consensus/beacon/src/engine/mod.rs 77.76% <0.00%> (-0.53%) ⬇️
crates/interfaces/src/blockchain_tree/mod.rs 31.57% <ø> (ø)
crates/storage/provider/src/providers/mod.rs 8.44% <0.00%> (-0.12%) ⬇️

... and 8 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.26% <0.00%> (+0.01%) ⬆️
unit-tests 64.22% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 23.05% <ø> (ø)
blockchain tree 81.42% <0.00%> (-0.27%) ⬇️
pipeline 87.88% <ø> (ø)
storage (db) 73.89% <0.00%> (-0.05%) ⬇️
trie 95.64% <ø> (ø)
txpool 51.82% <ø> (+0.64%) ⬆️
networking 77.91% <ø> (+0.01%) ⬆️
rpc 58.09% <ø> (-0.05%) ⬇️
consensus 62.58% <0.00%> (-0.20%) ⬇️
revm 35.07% <ø> (ø)
payload builder 6.83% <ø> (ø)
primitives 88.70% <ø> (+0.02%) ⬆️

Comment on lines +112 to +119
fn buffered_block_by_hash(&self, block_hash: BlockHash) -> Option<SealedBlock> {
self.tree.read().get_buffered_block(&block_hash).map(|b| b.block.clone())
}

fn buffered_header_by_hash(&self, block_hash: BlockHash) -> Option<SealedHeader> {
self.tree.read().get_buffered_block(&block_hash).map(|b| b.header.clone())
}

Copy link
Member

Choose a reason for hiding this comment

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

Nit I'd make this return reference instead of cloning

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not possible unfortunately because can't borrow past read lock

Copy link
Member

Choose a reason for hiding this comment

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

ah yikes - good point

@gakonst gakonst merged commit e0d5735 into main Jul 2, 2023
@gakonst gakonst deleted the matt/add-another-distance-check-for-finalized branch July 2, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Related to the consensus engine C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants