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(p2p): add command to show p2p status #837

Closed
wants to merge 5 commits into from

Conversation

srene
Copy link
Contributor

@srene srene commented May 9, 2024

PR Standards

Opening a pull request should be able to meet the following requirements


Close #798

<-- Briefly describe the content of this pull request -->

For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@srene srene self-assigned this May 9, 2024
@srene srene requested a review from a team as a code owner May 9, 2024 13:35
Comment on lines 101 to 105
duration, err := strconv.ParseInt(status["Duration"].(string), 10, 64)
if err != nil {
fmt.Println("Error parsing connection duration:", err)
}
fmt.Printf("Peer %d Id:%s Multiaddress:%s Duration:%s\n", i, info["id"], peer["remote_ip"], time.Duration(duration))
Copy link
Contributor

Choose a reason for hiding this comment

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

what unit is the duration in ?

Copy link
Contributor

Choose a reason for hiding this comment

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

please clarify and comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

im not sure what you mean. the units are shown in the duration displayed. i added comments in the code for clarification.
i also updated the code to order peers by oldest connection and get the id also from rpc.

}

// ShowNodeIDCmd dumps node's ID to the standard output.
var ShowP2PInfoCmd = &cobra.Command{
Copy link
Contributor

Choose a reason for hiding this comment

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

if all it does is calling rpc.NetInfo than the implementation is redundant

it should be implemented on the rollapp/RDK similar to

func getNodeStatus(clientCtx client.Context) (*coretypes.ResultStatus, error) {
	node, err := clientCtx.GetNode()
	if err != nil {
		return &coretypes.ResultStatus{}, err
	}

	return node.Status(context.Background())
}

but just calling node.NetInfo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it. implemented in the rdk in dymensionxyz/dymension-rdk#420

@srene srene linked an issue May 13, 2024 that may be closed by this pull request
@srene
Copy link
Contributor Author

srene commented May 13, 2024

closing pr, since logic has been moved to rdk in dymensionxyz/dymension-rdk#420

@srene srene closed this May 13, 2024
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.

add commands to check p2p connectivity status
3 participants