-
Notifications
You must be signed in to change notification settings - Fork 279
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: add /peers API endpoint to torii #5235
base: main
Are you sure you want to change the base?
Conversation
@@ -137,13 +151,6 @@ impl Torii { | |||
let metrics_reporter = self.metrics_reporter.clone(); | |||
move || core::future::ready(routing::handle_metrics(&metrics_reporter)) | |||
}), | |||
) | |||
.route( | |||
uri::API_VERSION, |
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 don't see a reason why this should be guarded behind telemetry. I'm willing to restore though
d7ff3ac
to
d3478d5
Compare
Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
d3478d5
to
a20bc53
Compare
pub struct World { | ||
/// Iroha on-chain parameters. | ||
pub(crate) parameters: Cell<Parameters>, | ||
/// Identifications of discovered trusted peers. | ||
pub(crate) trusted_peers_ids: Cell<PeersIds>, | ||
/// Identifications of discovered peers. | ||
pub(crate) peers: Cell<Peers>, |
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.
Yes, I think "trusted peers" here was actually a misnomer:
- trusted peers ... bootstrapping peers to establish the genesis network Separate notions of trusted peers and validators set #1227
- peers in topology ... currently recognized peers on chain that can join consensus, regardless of connected or not
- connected peers in p2p ... peers that this peer actually has communication channels with
Well, in fact, the What do you think? |
I noticed this. While I agree that introducing a new endpoint is not as nice, my thinking was that |
Mmm, I think we could advise users to use sub-routing at all times. If they don't, well, they'll get a large piece of JSON. Still, even thousands of pubkey strings isn't that enormous, and happens in big production environments. If someone works with a really huge network, they would be probably knowledgeable of sub-routing feature. In addition, it could be useful to not just add |
May I then suggest that |
Code-wise - looking good. Design-wise - also not a fan of additional endpoints.
How about |
Context
Ever since #5117 clients have lost the ability to find about other nodes in the network except for the node they are connecting to. This is because
FindPeers
doesn't return address anymore, just peers's public key. We can't return data that is not on chain in this query so I've implemented anothertorii
endpointSolution
/peers
Alternatives
I see that we have
/status
and/metrics
. I'm not sure why we have both since, from what I can see,/status
is a superset of `/metrics. Considering this, I can make it so that peers are returned on one of those endpoints instead of adding a new point. I implemented this functionality on a separate endpoint because: