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

move the check for is_height_processed forward #7855

Merged
merged 5 commits into from
Oct 20, 2022

Conversation

mzhangmzz
Copy link
Contributor

Move the check for is_height_processed before process_block_header. Previously, this check happens after, which means, the node will re-process the block header (which takes a few ms) and re-broadcast an invalid block before drops it. In the case when there are many invalid blocks circulating in the network, this can cause the node to be too busy,

@mzhangmzz mzhangmzz requested a review from a team as a code owner October 17, 2022 21:21
@@ -2121,6 +2121,7 @@ fn test_sync_hash_validity() {
}

/// Only process one block per height
#[ignore]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we fix this test? (or create another test that would verify that we will not forward a block in such scenario)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to fix this test in another PR, where I will move all the process block related code in client actor to client, but that's a bigger change and I want to separate it

@@ -1412,6 +1412,20 @@ impl ClientActor {
debug!(target: "client", tail_height = tail, "Dropping a block that is too far behind.");
return;
}
// drop the block if a) it is not requested, b) we already processed this height, c) it is not building on top of current head
Copy link
Contributor

Choose a reason for hiding this comment

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

please also mention, that we have to do this check ASAP - as the non-requested block means that we can get spammed.

@near-bulldozer near-bulldozer bot merged commit 7492431 into master Oct 20, 2022
@near-bulldozer near-bulldozer bot deleted the is_height_processed branch October 20, 2022 15:00
nikurt pushed a commit that referenced this pull request Oct 25, 2022
Move the check for is_height_processed before process_block_header. Previously, this check happens after, which means, the node will re-process the block header (which takes a few ms) and re-broadcast an invalid block before drops it. In the case when there are many invalid blocks circulating in the network, this can cause the node to be too busy,
nikurt pushed a commit that referenced this pull request Nov 7, 2022
Move the check for is_height_processed before process_block_header. Previously, this check happens after, which means, the node will re-process the block header (which takes a few ms) and re-broadcast an invalid block before drops it. In the case when there are many invalid blocks circulating in the network, this can cause the node to be too busy,
nikurt pushed a commit that referenced this pull request Nov 9, 2022
Move the check for is_height_processed before process_block_header. Previously, this check happens after, which means, the node will re-process the block header (which takes a few ms) and re-broadcast an invalid block before drops it. In the case when there are many invalid blocks circulating in the network, this can cause the node to be too busy,
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