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

Polkachu's live_peers API v2 is back! #684

Open
andy108369 opened this issue Nov 20, 2023 · 1 comment
Open

Polkachu's live_peers API v2 is back! #684

andy108369 opened this issue Nov 20, 2023 · 1 comment

Comments

@andy108369
Copy link
Contributor

andy108369 commented Nov 20, 2023

As per Polkachu:

It is better than the old implementation. It only provides up to 5 random live peers plus a polkachu internal one. It is less likely to cause performance issues for nodes in the long run.

https://polkachu.com/docs/index.html#v2-public-GETapi-v2-chains--network--live_peers

$ curl -s "https://polkachu.com/api/v2/chains/akash/live_peers" | jq -r .
{
  "network": "akash",
  "polkachu_peer": "[email protected]:12856",
  "live_peers": [
    "[email protected]:16656",
    "[email protected]:26656",
    "[email protected]:26656",
    "[email protected]:26656",
    "[email protected]:26656"
  ]
}

Hint: curl -s "https://polkachu.com/api/v2/chains/akash/live_peers" | jq -r '[.polkachu_peer, .live_peers[]] | @csv' | tr -d '"'

I think we should do the following:

  1. rename P2P_POLKACHU to P2P_POLKACHU_SEEDS
  2. introduce P2P_POLKACHU_PERSISTENT_PEERS (which would be getting 5 random live peers plus a polkachu internal one via https://polkachu.com/api/v2/chains/<CHAIN>/live_peers call)

Also need to think what to do with P2P_PERSISTENT_PEERS which come via CHAIN_JSON. There are plenty of them typically and less maintained.
I'd say one should P2P_PERSISTENT_PEERS=0 (disable them) when using P2P_POLKACHU_PERSISTENT_PEERS=1 or have some switch to allow the combo.

Should also filter the duplicates. They often slip through.

@andy108369
Copy link
Contributor Author

andy108369 commented Nov 20, 2023

I am currently running my node with these settings for the state-sync to work and have avoid adding bunch of p2p persistent peers which come through CHAIN_JSON by default (when P2P_PERSISTENT_PEERS isn't set to 0 and CHAIN_JSON is present with the p2p persistent peers in it):

      - STATESYNC_POLKACHU=1
      - P2P_POLKACHU=1
      # Discourage the use of p2p persistent peers (coming via CHAIN_JSON), to encourage the usage of p2p seeds instead.
      - P2P_PERSISTENT_PEERS=0
      # have to add Polkachu State-Sync Peer for Akash https://polkachu.com/live_peers/akash for the state-sync to work
      - AKASH_P2P_PERSISTENT_PEERS=d1e47b071859497089c944dc082e920403484c1a@65.108.128.201:12856

But even then this might fail:

INF Error reconnecting to peer. Trying again addr={"id":"d1e47b071859497089c944dc082e920403484c1a","ip":"65.108.128.201","port":12856} err="auth failure: secret conn failed: EOF" module=p2p tries=0

Whereas, state-sync works again when specifying more peers:

      # curl -s "https://polkachu.com/api/v2/chains/akash/live_peers" | jq -r '[.polkachu_peer, .live_peers[]] | @csv' | tr -d '"'
      - AKASH_P2P_PERSISTENT_PEERS=d1e47b071859497089c944dc082e920403484c1a@65.108.128.201:12856,[email protected]:26656,[email protected]:26656,[email protected]:12856,[email protected]:26696,[email protected]:1506
INF Fetching snapshot chunk chunk=18 format=1 height=13764000 module=statesync total=34
...
INF Fetching snapshot chunk chunk=33 format=1 height=13764000 module=statesync total=34

Could probably also leverage the pre-seeded address book:

      - ADDRBOOK_URL=https://snapshots.polkachu.com/addrbook/akash/addrbook.json

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

No branches or pull requests

1 participant