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

feat(gRPC): defining network and peers info response's properly #898

Merged
merged 19 commits into from
Jan 3, 2024

Conversation

kehiy
Copy link
Contributor

@kehiy kehiy commented Jan 2, 2024

Description

With this PR we have our network APIs more well defined. I defined a Network name also as a network API.

Our gRPC methods for network have we have (network and node info), return more detaild responses and they contain data releated to themselves only.

Example response for network info:

{
  "totalSentBytes": 9405,
  "totalReceivedBytes": 1920935,
  "networkName": "pactus-testnet-v2",
  "connectedPeersCount": 27,
  "connectedPeers": [
    {
      "status": 3,
      "moniker": "",
      "agent": "node=pdaemon/node-version=v0.18.4/protocol-version=1/os=linux/arch=arm64",
      "peerId": "ACQIARIg0JSiRevvYC9519IiKV4079EX1JqFPdkMcGtbU7drEJc=",
      "consensusKeys": [
        "tpublic1pjmngf884hnt023sfg2qr0289ytx935jyh70ehr3c2yexcd2haentsh9qz0tk0e6hn46fax98nu50c965syf525u0xsw2uzunew6z8lvjqfkapsqgc7zqmvfdm53twsrsusjady3w0duq0fercrqehpe3avfg2csj"
      ],
      "services": 1,
      "lastBlockHash": "pImH+5u0KnxjhirKjG1cl2JlOiZLPTJ5PK08Hd9djKM=",
      "height": 625793,
      "receivedMessages": 2,
      "invalidMessages": 0,
      "lastSent": "1704287429",
      "lastReceived": "1704287430",
      "sentBytes": {
        "1": "398",
        "2": "22"
      },
      "receivedBytes": {
        "1": "373",
        "2": "26"
      },
      "address": "/ip4/129.153.54.255/udp/21777/quic-v1",
      "direction": "Outbound",
      "protocols": [
        "/floodsub/1.0.0",
        "/ipfs/id/1.0.0",
        "/ipfs/id/push/1.0.0",
        "/libp2p/circuit/relay/0.2.0/stop",
        "/libp2p/dcutr",
        "/pactus-testnet-v2/gossip/v1/kad/1.0.0",
        "/pactus-testnet-v2/stream/v1"
      ],
      "totalSessions": 0,
      "completedSessions": 0
    }
]
}

Node info:

{
  "moniker": "",
  "agent": "node=pactus-daemon/node-version=v0.19.0-beta/protocol-version=1/os=linux/arch=amd64",
  "peerId": "ACQIARIgEkKb9wqNNqkQxi3xLXFOOzvQRtlGS+Yr5NTjpOI0uj8=",
  "startedAt": "1704287428",
  "reachability": "Private",
  "services": [
    1
  ],
  "servicesNames": [
    "NETWORK"
  ],
  "addrs": [],
  "protocols": [
    "/libp2p/circuit/relay/0.2.0/stop",
    "/ipfs/id/1.0.0",
    "/ipfs/id/push/1.0.0",
    "/pactus-testnet-v2/stream/v1",
    "/floodsub/1.0.0"
  ]
}

Related issue(s)

@kehiy kehiy self-assigned this Jan 2, 2024
Copy link

codecov bot commented Jan 2, 2024

Codecov Report

Merging #898 (9f60ab4) into main (ea1ca66) will decrease coverage by 0.10%.
The diff coverage is 81.81%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #898      +/-   ##
==========================================
- Coverage   83.52%   83.42%   -0.10%     
==========================================
  Files         173      173              
  Lines        8787     8815      +28     
==========================================
+ Hits         7339     7354      +15     
- Misses       1098     1108      +10     
- Partials      350      353       +3     

@kehiy kehiy requested a review from b00f January 2, 2024 09:15
Copy link
Contributor

@themantre themantre left a comment

Choose a reason for hiding this comment

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

I think this PR doesn't help much. Explain why we need to add these 3 more APIs to the network?

network/interface.go Show resolved Hide resolved
network/interface.go Outdated Show resolved Hide resolved
network/interface.go Show resolved Hide resolved
@kehiy kehiy changed the title feat(gRPC): defining network and peers info response properly feat(gRPC): defining network and peers info response's properly Jan 2, 2024
version/version.go Outdated Show resolved Hide resolved
www/grpc/proto/network.proto Outdated Show resolved Hide resolved
@kehiy kehiy requested a review from b00f January 3, 2024 10:20
@kehiy kehiy requested a review from b00f January 3, 2024 13:13
@kehiy kehiy requested a review from themantre January 3, 2024 13:13
sync/bundle/message/hello.go Outdated Show resolved Hide resolved
sync/handler_hello_test.go Outdated Show resolved Hide resolved
@b00f b00f merged commit f9be68a into pactus-project:main Jan 3, 2024
12 checks passed
@kehiy kehiy deleted the feature/gRPCNetworkInfo branch January 3, 2024 15:43
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.

grpc: GetPeerInfo and GetNetworkInfo are not well defined
3 participants