Skip to content

Conversation

varun-doshi
Copy link
Contributor

Fixes #251

Changes:

  • Introduces a blocks_seen: LruCache<(B256, Signature)> in ScrollNetworkManager which is responsible to caching (block_hash, signature) pair
  • Checks for duplicate incoming (block_hash, sig) in 2 places:
    • on_scroll_wire_event
    • handle_eth_wire_block
  • If it is a duplicate block ,it will not process that further.
  • If it not a duplicate block, it will add cache to two places: blocks_seen and per peer cache. Then will continue to process that block
  • Note: currently cache size for block_seen is set to 100 which is same as that of the peer cache(will update this as advised)

To-do:

  • punish peers who send duplicate blocks

@varun-doshi
Copy link
Contributor Author

@jonastheis the PR is ready for review. Will proceed on peer punishment based on your advice

Copy link
Contributor

@jonastheis jonastheis left a comment

Choose a reason for hiding this comment

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

I think we can skip peer penalization for now as it is also not done in reth. We might also keep the same LRU size. We can always adjust later.

Then there's mainly linter errors and merge conflicts to address + some comments

@jonastheis
Copy link
Contributor

@varun-doshi what's the status with this PR?

@varun-doshi
Copy link
Contributor Author

@varun-doshi what's the status with this PR?

Apologies for the delay
I have made the corrections

@frisitano frisitano self-requested a review September 4, 2025 08:21
Copy link
Contributor

@jonastheis jonastheis left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Collaborator

@frisitano frisitano left a comment

Choose a reason for hiding this comment

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

lgtm

@frisitano frisitano merged commit a8b95a3 into scroll-tech:main Sep 8, 2025
13 checks passed
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.

[Network] Avoid processing the same (block, signature) tuple multiple times
3 participants