duality-labs / duality

Apache License 2.0
10 stars 5 forks source link

make p2p sync checking easier #426

Closed dib542 closed 1 year ago

dib542 commented 1 year ago

This PR is intended to make it easier to test that our p2p sync functionality (eg. peer p2p.testnet-1.duality.xyz:26656) on our devnet/testnet/mainnet nodes is working as expected.

Using the following docker commands you should be able to create a local node that attempts to catch up to the p2p full node:

# build image
docker build -t duality-labs/duality:latest .
# test image with p2p port open
# pass through the environment variables as needed
docker run -it --rm -p 26656:26656 \
  -e RPC_ADDRESS=https://rpc.testnet-1.duality.xyz \
  -e CHAIN_ID=duality-rehearsal-1 \
  -e PERSISTENT_PEER=75546756a3d3189594ebce101700605c1e956053@p2p.testnet-1.duality.xyz:26656 \
  duality-labs/duality:latest

Make sure that your project is built from the same point as the chain is expecting. eg. for duality-rehearsal-1 the expected binary will be built from v0.2.2: https://github.com/duality-labs/duality/releases/tag/v0.2.2

if the chain ID and persistent peer address are set correctly for the given RPC address then you should be able to see in the outputted logs (after about 15 seconds) that the full node starts syncing all the events and state from block 0.

Here is an example of what this looks like. The logs move output the synced block messages rapidly from this point onwards

Screenshot 2023-07-03 at 10 18 23 am
dib542 commented 1 year ago

checked locally after merge commits: example usage still functions as intended ✅