-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(discv5): add crate for interfacing reth network and sigp/discv5 #7336
Conversation
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.
I'm still a bit confused by the downgrade logic, why do we have to include discv4 in this discv5 logic? It seems to make everything more complex, and I'm not sure what the benefit is
crates/net/discv5/src/config.rs
Outdated
/// L1 CL | ||
const ETH2: &'static [u8] = b"eth2"; | ||
/// Optimism | ||
const OPSTACK: &'static [u8] = b"opstack"; |
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.
so opstack actually includes this key in enrs?
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.
some yeah, for example
2024-03-22T11:29:19.139714Z TRACE net::discovery::discv5: discovered peer on opstack fork_id=None enr=Enr { id: Some("v4"), seq: 1708293705211, NodeId: 0x8aa3a341cc388b03310b4b13f641722dd2bf0d6a992c1a9bf984489674ef4876, signature: "98ac9fdef036164e4566b84efea47b3f6944f96d8bbef0026830d27346f4253e4731288dddbe4af11dfd5481cfcb6ebc71a56c83dd931a547e7da0a1b75b6a21", IpV4 UDP Socket: Some(78.153.130.198:9222), IpV6 UDP Socket: None, IpV4 TCP Socket: Some(78.153.130.198:9222), IpV6 TCP Socket: None, Other Pairs: [("opstack", "85f1dbda0300"), ("secp256k1", "a1031b9dda693d646e1dabff64e3140c65afeb9c16c6847d40ce8f8936e6b347d496")] }
2024-03-22T11:29:19.140715Z TRACE net::swarm: adding new peer to network peer_id="0x1b9d…4d41" socket_addr=78.153.130.198:9222 fork_id=None
not 100% sure if its fork id, or smthg else?
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.
hmmm, yeah probably a forkid / forkhash
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.
but maybe only for base?
Co-authored-by: Dan Cline <[email protected]>
Co-authored-by: Dan Cline <[email protected]>
blocked by #7328, missing |
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.
few more nits
because I copied a module from sigp/discv5, because I didn't want to invent smthg new to test the code, i wanted to use code that is used in production and is heavily audited. it's just a dev dep so I'm hoping it doesn't disturb you.
related to the point above, if libraries would just make functions public, code would seldom have to be copy pasted. I'm relecetuant to restrict visibility since I don't know in what way users may want to use reth, and want it to be as fun as possible for them. an inaccessible function doesn't spark joy.
yes, but they only get sent when the preceding query finishes if not spawned on separate threads. I can poll the futures concurrently on the same thread if you prefer. |
let's remove the |
alright sure, how do I do this with our type (need to re-write the copied sigp module so I can run the test)? let a = U256::from(self.hash.as_slice()); |
let's use |
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.
I think this is a great standalone service and this should give us everything we need for reth-network
lgtm, pending @Rjected
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.
LGTM! this should unblock a lot of things
…aradigmxyz#7336) Co-authored-by: Dan Cline <[email protected]> Co-authored-by: Matthias Seitz <[email protected]>
…aradigmxyz#7336) Co-authored-by: Dan Cline <[email protected]> Co-authored-by: Matthias Seitz <[email protected]>
HandleDiscovery
.