-
Notifications
You must be signed in to change notification settings - Fork 184
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
Bootnode Registry #2337
base: main
Are you sure you want to change the base?
Bootnode Registry #2337
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2337 +/- ##
==========================================
+ Coverage 74.49% 74.88% +0.38%
==========================================
Files 110 109 -1
Lines 11771 11852 +81
==========================================
+ Hits 8769 8875 +106
+ Misses 2324 2291 -33
- Partials 678 686 +8 ☔ View full report in Codecov by Sentry. |
386833b
to
695290d
Compare
…rvices initialization
695290d
to
09367b3
Compare
p2p/p2p.go
Outdated
var peerIDBytes []byte | ||
for it.Seek(prefix); it.Valid(); it.Next() { | ||
peerIDBytes := it.Key()[len(prefix):] | ||
peerID, err := peer.IDFromBytes(peerIDBytes) | ||
peerIDBytes = it.Key() | ||
if !bytes.HasPrefix(peerIDBytes, prefix) { | ||
break | ||
} | ||
peerID, err := peer.IDFromBytes(peerIDBytes[len(prefix):]) |
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.
Why is this change needed? The db iterator should give keys which match the prefix, so we don't need to do the prefix check again.
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.
We need to do this, without this prefix check the peer storage won't work. db iterator gives keys that don't match the prefix
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 see the bug now. The NewIterator
should create an iterator with lower bound specified. Let me create a PR real quick.
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.
Please check this:
#2357
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 the name If I understand correctly, there are some peers registered on the L1 smart contract. So we listen to those and adjust the peerstore accordingly. If I'm not wrong, these peers should be bootnodes, so Also, not sure if this has been discussed before, who is allowed to add/remove the peers on L1? |
This pull request introduces significant changes to the
l1
package, primarily focusing on integrating the IP Address Registry functionality. The most important changes include adding the IP Address Registry ABI, updating theEthSubscriber
to handle IP address events, and modifying theClient
to subscribe to these events and forward them to the P2P layer.IP Address Registry Integration:
l1/abi/ip_address_registry.json
: Added the ABI for the IP Address Registry contract, defining functions, errors, and events related to IP address management.l1/eth_subscriber.go
: Updated theEthSubscriber
struct to include the IP Address Registry and its filterer. Added methods to watch for IP address additions and removals, and to get the list of IP addresses. [1] [2] [3]l1/l1.go
: Added methods to theClient
to subscribe to IP address events and forward them to the P2P layer. Modified theClient
constructor to accept a channel for forwarding these events. [1] [2] [3] [4] [5] [6] [7] [8]