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

Enable enr field in GetPeers and GetPeerById (#8641) #155

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

zilm13
Copy link
Collaborator

@zilm13 zilm13 commented Sep 30, 2024

Cherry-picked from master

* Expose discovery NodeId to DiscoveryPeer and LibP2PPeer (Consensys#38)
* Add DiscoveryPeer.getNodeId()
* Add Eth2Peer.getDiscoveryNodeId() method.
* Refactoring, discovery updated to 24.9.1
---------

Co-authored-by: Anton Nashatyrev <Nashatyrev@users.noreply.github.com>
import java.util.Optional;
import tech.pegasys.teku.networking.eth2.peers.Eth2Peer;

public record Eth2PeerWithEnr(Eth2Peer peer, Optional<String> enr) {}
Copy link
Owner

Choose a reason for hiding this comment

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

As the enr is optional, does it make sense to just add this field to EthPeer?

import org.apache.tuweni.units.bigints.UInt256;
import tech.pegasys.teku.networking.p2p.peer.Peer;

public interface DiscoveryNodeIdExtractor {
UInt256 calculateDiscoveryNodeId(Peer peer);
Optional<UInt256> calculateDiscoveryNodeId(Peer peer);
Copy link
Owner

Choose a reason for hiding this comment

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

For Libp2pPeer the nodeId would always exist. We have no other Peer implementations aside of libp2p. Do we really need to handle hypothetical case of absent NodeId ?

Copy link
Owner

@Nashatyrev Nashatyrev left a comment

Choose a reason for hiding this comment

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

LGTM
just a couple of nits for discussion

@zilm13
Copy link
Collaborator Author

zilm13 commented Oct 1, 2024

Decided to not get too far from master and keep it

@zilm13 zilm13 merged commit ac15202 into Nashatyrev:das Oct 1, 2024
6 checks passed
@zilm13 zilm13 deleted the get-peers-enr branch October 1, 2024 08:40
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.

2 participants