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

fix: utilize p2p.ExternalAddress properly for dialing #3581

Merged
merged 12 commits into from
Feb 7, 2025

Conversation

zivkovicmilos
Copy link
Member

@zivkovicmilos zivkovicmilos commented Jan 22, 2025

Description

This PR fixes a bug with the Transport bind address, where the bound address was taking in a wrong param, as part of an oversight.

It also adds context on the newly introduced checks.

The PR also fixes an issue with the redial mechanism for persistent peers, where peers wouldn't be redialed more than once.

@zivkovicmilos zivkovicmilos added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Jan 22, 2025
@zivkovicmilos zivkovicmilos self-assigned this Jan 22, 2025
@github-actions github-actions bot added the 📦 🌐 tendermint v2 Issues or PRs tm2 related label Jan 22, 2025
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Jan 22, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

No automated checks match this pull request.

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Jan 22, 2025
This reverts commit 29d5e0c.
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 70.79646% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tm2/pkg/p2p/switch.go 56.75% 16 Missing ⚠️
tm2/pkg/bft/node/node.go 44.44% 12 Missing and 3 partials ⚠️
tm2/pkg/internal/p2p/p2p.go 85.71% 1 Missing ⚠️
tm2/pkg/p2p/discovery/discovery.go 94.44% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@zivkovicmilos zivkovicmilos added the don't merge Please don't merge this functionality temporarily label Jan 22, 2025
@zivkovicmilos
Copy link
Member Author

Waiting on fix confirmation by @sw360cab and @mazzy89 before moving forward with the PR 🫡

@zivkovicmilos zivkovicmilos marked this pull request as ready for review January 22, 2025 14:40
@sw360cab
Copy link
Contributor

sw360cab commented Feb 6, 2025

Successfully tested with the following scenario:

  • 3 nodes: Node A, B , C
  • Node A is routable on the internet, has a bootnode Node C
  • Node B is routable on the internet, has a bootnode Node C
  • Node C is routable on the internet
  • Node C is the only validator, to make it simple

The following configuration pattern have been used, for all the nodes:

  • p2p.peer_exchange=true
  • p2p.external_address=<PUBLIC_IP>:<public_PORT>, address advertised / gossip on the network
  • p2p.laddr=tcp://0.0.0.0:26656, which address an port the p2p service is binding to

Following the topology + configuration

Node A

  • Node A: Sentry / Non-val
    ip-10-0-0-150.eu-west-1.compute.internal
    34.240.222.122:30656
  external_address = "34.240.222.122:30656"

  laddr = "tcp://0.0.0.0:26656"

  persistent_peers = ""

  pex = true

  private_peer_ids = ""

  # Node C
  seeds = "[email protected]:30658"

Node B

  • Node B: Sentry / Non-val
    ip-10-0-0-149.eu-west-1.compute.internal
    3.252.191.197:30657
  external_address = "3.252.191.197:30657"

  laddr = "tcp://0.0.0.0:26656"

  persistent_peers = ""

  pex = true

  private_peer_ids = ""

  # Node C
  seeds = "[email protected]:30658"

Node C

  • Node C: Validator
    ip-10-0-1-150.eu-west-1.compute.internal
    34.255.178.108:30658
  external_address = "34.255.178.108:30658"

  laddr = "tcp://0.0.0.0:26656"

  persistent_peers = ""

  pex = true

  private_peer_ids = ""

  seeds = ""

The output from a non-validator node, shows that p2p networking is fully up and running

2025-02-05T17:09:35.740Z DEBUG Received bytes {"module": "p2p", "peer": "[email protected]:64680", "chID": 32, "msgBytes": "0A122F746D2E486173566F74654D657373616765120508E82C1801"}
2025-02-05T17:09:35.740Z DEBUG Receive {"module": "consensus", "src": "Peer{MConn{10.0.0.149:64680} g1s0x78pl3c2xv2n7hp33lh4jkyqvhg5hlx6huh7 in}", "chId": 32, "msg": "[HasVote VI:0 V:{2868/00/1}]"}
2025-02-05T17:09:35.740Z DEBUG setHasVote {"module": "consensus", "peerH/R": "2868/0", "H/R": "2868/0", "type": 1, "index": 0}
2025-02-05T17:09:35.740Z DEBUG Read PacketMsg {"module": "p2p", "peer": "[email protected]:64680", "conn": "MConn{10.0.0.149:64680}", "packet": "PacketMsg{20:0A182F746D2E4E657756616C6964426C6F636B4D657373616765123008E82C1A24080212208D568A2E418FBBAAA58D1F4E65E86EAA4419A1DD6C3B602FFBF22F1CA4CC571822050802120100 T:1}"}
2025-02-05T17:09:35.740Z DEBUG Received bytes {"module": "p2p", "peer": "[email protected]:64680", "chID": 32, "msgBytes": "0A182F746D2E4E657756616C6964426C6F636B4D657373616765123008E82C1A24080212208D568A2E418FBBAAA58D1F4E65E86EAA4419A1DD6C3B602FFBF22F1CA4CC571822050802120100"}
2025-02-05T17:09:35.740Z DEBUG Receive {"module": "consensus", "src": "Peer{MConn{10.0.0.149:64680} g1s0x78pl3c2xv2n7hp33lh4jkyqvhg5hlx6huh7 in}", "chId": 32, "msg": "[ValidBlockMessage H:2868 R:0 BP:1:8D568A2E418F BA:BA{1:_} IsCommit:false]"}
2025-02-05T17:09:35.740Z DEBUG Read PacketMsg {"module": "p2p", "peer": "[email protected]:64680", "conn": "MConn{10.0.0.149:64680}", "packet": "PacketMsg{20:0A172F746D2E4E6577526F756E64537465704D657373616765120508E82C1804 T:1}"}
2025-02-05T17:09:35.740Z DEBUG Received bytes {"module": "p2p", "peer": "[email protected]:64680", "chID": 32, "msgBytes": "0A172F746D2E4E6577526F756E64537465704D657373616765120508E82C1804"}

Also the internal RPC interface on each of the 3 nodes show 2 other peers connected

/gnoroot # curl -s http://127.0.0.1:26657/net_info | head
{
  "jsonrpc": "2.0",
  "id": "",
  "result": {
    "listening": true,
    "listeners": [
      "Listener(@34.240.222.122:30656)"
    ],
    "n_peers": "2",
    "peers": [
      {
        "node_info": {
  ...

@zivkovicmilos zivkovicmilos removed the don't merge Please don't merge this functionality temporarily label Feb 7, 2025
@zivkovicmilos zivkovicmilos merged commit 47395b1 into master Feb 7, 2025
65 checks passed
@zivkovicmilos zivkovicmilos deleted the dev/zivkovicmilos/listen-bind branch February 7, 2025 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Development

Successfully merging this pull request may close these issues.

4 participants