Merge pull request #4 from certusone/wormhole-runner-improvements

Make wormhole.sh script more robust
This commit is contained in:
Dev 2022-07-05 12:02:58 -05:00 committed by GitHub
commit aed89c7f2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 72 deletions

View File

@ -2,11 +2,11 @@
# Start EVM Chain 0
npx pm2 stop evm0
npx pm2 start 'ganache -p 8545 -m "myth like bonus scare over problem client lizard pioneer submit female collect" --block-time 1' --name evm0
npx pm2 start 'npx ganache -p 8545 -m "myth like bonus scare over problem client lizard pioneer submit female collect" --block-time 1' --name evm0
# Start EVM Chain 1
npx pm2 stop evm1
npx pm2 start 'ganache -p 8546 -m "myth like bonus scare over problem client lizard pioneer submit female collect" --block-time 1' --name evm1
npx pm2 start 'npx ganache -p 8546 -m "myth like bonus scare over problem client lizard pioneer submit female collect" --block-time 1' --name evm1
#Install Wormhole Eth Dependencies
cd wormhole/ethereum

View File

@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Run Guardiand
set -euo pipefail
GUARDIAND_FLAGS=
HOST=
TERRAD_HOST=
if [ "$(uname -m)" = "arm64" ]; then
GUARDIAND_FLAGS="-p 7070:7070 -p 7071:7071 -p 7073:7073 --platform linux/amd64"
HOST="host.docker.internal"
TERRAD_HOST="host.docker.internal"
else
GUARDIAND_FLAGS="--network host"
TERRAD_HOST="terra-terrad"
fi
function cleanup {
docker kill guardiand 2>/dev/null || true
docker rm guardiand 2>/dev/null || true
}
trap cleanup EXIT
docker run -d --name guardiand $GUARDIAND_FLAGS --hostname guardian-0 --cap-add=IPC_LOCK --entrypoint /guardiand guardian node \
--unsafeDevMode --guardianKey /tmp/bridge.key --publicRPC "[::]:7070" --publicWeb "[::]:7071" --adminSocket /tmp/admin.sock --dataDir /tmp/data \
--ethRPC ws://$HOST:8545 \
--ethContract "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550" \
--bscRPC ws://$HOST:8546 \
--bscContract "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550" \
--polygonRPC ws://$HOST:8545 \
--avalancheRPC ws://$HOST:8545 \
--auroraRPC ws://$HOST:8545 \
--fantomRPC ws://$HOST:8545 \
--oasisRPC ws://$HOST:8545 \
--karuraRPC ws://$HOST:8545 \
--acalaRPC ws://$HOST:8545 \
--klaytnRPC ws://$HOST:8545 \
--celoRPC ws://$HOST:8545 \
--moonbeamRPC ws://$HOST:8545 \
--neonRPC ws://$HOST:8545 \
--terraWS ws://$HOST:8545 \
--terra2WS ws://$HOST:8545 \
--terraLCD https://$TERRAD_HOST:1317 \
--terra2LCD http://$HOST:1317 \
--terraContract terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5 \
--terra2Contract terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5 \
--solanaContract Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o \
--solanaWS ws://$HOST:8900 \
--solanaRPC http://$HOST:8899 \
--algorandIndexerRPC ws://$HOST:8545 \
--algorandIndexerToken "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
--algorandAlgodToken "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
--algorandAlgodRPC https://$HOST:4001 \
--algorandAppID "4"
docker logs guardiand -f

72
projects/wormhole-local-validator/wormhole.sh Normal file → Executable file
View File

@ -1,68 +1,6 @@
#!/usr/bin/env bash
# Run Guardiand
if [ $(uname -m) = "arm64" ]; then
docker run -d --name guardiand -p 7070:7070 -p 7071:7071 -p 7073:7073 --platform linux/amd64 --hostname guardian-0 --cap-add=IPC_LOCK --entrypoint /guardiand guardian node \
--unsafeDevMode --guardianKey /tmp/bridge.key --publicRPC "[::]:7070" --publicWeb "[::]:7071" --adminSocket /tmp/admin.sock --dataDir /tmp/data \
--ethRPC ws://host.docker.internal:8545 \
--ethContract "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550" \
--bscRPC ws://host.docker.internal:8546 \
--bscContract "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550" \
--polygonRPC ws://host.docker.internal:8545 \
--avalancheRPC ws://host.docker.internal:8545 \
--auroraRPC ws://host.docker.internal:8545 \
--fantomRPC ws://host.docker.internal:8545 \
--oasisRPC ws://host.docker.internal:8545 \
--karuraRPC ws://host.docker.internal:8545 \
--acalaRPC ws://host.docker.internal:8545 \
--klaytnRPC ws://host.docker.internal:8545 \
--celoRPC ws://host.docker.internal:8545 \
--moonbeamRPC ws://host.docker.internal:8545 \
--neonRPC ws://host.docker.internal:8545 \
--terraWS ws://host.docker.internal:8545 \
--terra2WS ws://host.docker.internal:8545 \
--terraLCD https://host.docker.internal:1317 \
--terra2LCD http://host.docker.internal:1317 \
--terraContract terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5 \
--terra2Contract terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5 \
--solanaContract Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o \
--solanaWS ws://host.docker.internal:8900 \
--solanaRPC http://host.docker.internal:8899 \
--algorandIndexerRPC ws://host.docker.internal:8545 \
--algorandIndexerToken "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
--algorandAlgodToken "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
--algorandAlgodRPC https://host.docker.internal:4001 \
--algorandAppID "4"
else
docker run -d --name guardiand --network host --hostname guardian-0 --cap-add=IPC_LOCK --entrypoint /guardiand guardian node \
--unsafeDevMode --guardianKey /tmp/bridge.key --publicRPC "[::]:7070" --publicWeb "[::]:7071" --adminSocket /tmp/admin.sock --dataDir /tmp/data \
--ethRPC ws://localhost:8545 \
--ethContract "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550" \
--bscRPC ws://localhost:8546 \
--bscContract "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550" \
--polygonRPC ws://localhost:8545 \
--avalancheRPC ws://localhost:8545 \
--auroraRPC ws://localhost:8545 \
--fantomRPC ws://localhost:8545 \
--oasisRPC ws://localhost:8545 \
--karuraRPC ws://localhost:8545 \
--acalaRPC ws://localhost:8545 \
--klaytnRPC ws://localhost:8545 \
--celoRPC ws://localhost:8545 \
--moonbeamRPC ws://localhost:8545 \
--neonRPC ws://localhost:8545 \
--terraWS ws://localhost:8545 \
--terra2WS ws://localhost:8545 \
--terraLCD https://terra-terrad:1317 \
--terra2LCD http://localhost:1317 \
--terraContract terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5 \
--terra2Contract terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5 \
--solanaContract Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o \
--solanaWS ws://localhost:8900 \
--solanaRPC http://localhost:8899 \
--algorandIndexerRPC ws://localhost:8545 \
--algorandIndexerToken "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
--algorandAlgodToken "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
--algorandAlgodRPC https://localhost:4001 \
--algorandAppID "4"
fi
echo "Guardiand Running! To look at logs: \"docker logs guardiand -f\""
# Start guardiand
npx pm2 stop guardiand
npx pm2 start './guardiand.sh' --name guardiand

View File

@ -2,7 +2,7 @@
The Wormhole Local Validator is available [here](https://github.com/certusone/xdapp-book/tree/main/projects/wormhole-local-validator). It contains the wormhole local validator, along with code to spin up EVM and Solana local validators, and deployment code to add Wormhole contracts to those new chains.
## Dependencies
You will also need Docker; you can get either [Docker Desktop](https://docs.docker.com/get-docker/) if you're developing on your computer or if you're in a headless vm, install [Docker Engine](https://docs.docker.com/engine/). Make sure to have Docker running before you run any of the following commands.
You will also need Docker; you can get either [Docker Desktop](https://docs.docker.com/get-docker/) if you're developing on your computer or if you're in a headless VM, install [Docker Engine](https://docs.docker.com/engine/). Make sure to have Docker running before you run any of the following commands.
To run EVM chains you will need [Ganache](https://github.com/trufflesuite/ganache#command-line-use).
To run Solana chains you will need [Solana](https://docs.solana.com/cli/install-solana-cli-tools) installed.
@ -17,10 +17,10 @@ They'll use the standard Wormhole test mnemonic (`myth like bonus scare over pro
TODO: Add emitter registrations for token bridge.
## Run Wormhole
After you have the dependencies installed and the chains running, you can run Womrhole.
After you have the dependencies installed and the chains running, you can run Wormhole.
Simply run `npm run wormhole` and wait while the Wormhole Guardian builds a docker image. The first time you run this command, it might take a while (up to 550 seconds on a modern laptop!). After the image is built however, it'll be relatively fast to bring it up and down.
### FAQ & Common Problems
- Anvil isn't working
While we reccomend Foundry's Forge tool for compling and deploying code elsewhere in these docs, we *do not* at this time reccomend using anvil for guardiand; this is because guardiand is spec'd against go-ethereum, and anvil is out of spec for how it reports block headers (non left padding to normalize length), which means go-ethereum freaks out and can't read anvil headers.
While we recommend Foundry's Forge tool for compiling and deploying code elsewhere in these docs, we *do not* at this time recommend using anvil for guardiand; this is because guardiand is spec'd against go-ethereum, and anvil is out of spec for how it reports block headers (non left padding to normalize length), which means go-ethereum freaks out and can't read anvil headers.