-
Notifications
You must be signed in to change notification settings - Fork 7
feat: handle DoS node by sending block #475
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
base: main
Are you sure you want to change the base?
Conversation
frisitano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Added a few comments inline. Can you add some test cases, please?
I'm also wondering if we can simplify the logic a bit. The idea would be that if we have a connection with a peer over scroll-wire, then we should only gossip on scroll-wire. If we don't have a scroll-wire connection, then we use eth-wire. I think this should allow us to consolidate the block cache per peer into a single cache.
frisitano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addeed some comments inline.
|
I'm planing to build a |
Problem
Malicious peers can DoS the node by sending old blocks.
Solution
Two-layer defense:
if block_number <= finalized_height { penalize(peer); // Immediately reject}// Cache recent blocks per peerif peer_already_sent_this_block { penalize(peer); // DoS detected }Fixes #307