Files
pezkuwi-subxt/docker/scripts/inject_bootnodes.sh
T
Squirrel 8d44f9bcae rename polkadot-collator to polkadot-parachain (#1241)
* rename polkadot-collator to polkadot-parachain

Not every node has to be a collator.

* Update README.md

Co-authored-by: Chevdor <chevdor@users.noreply.github.com>

* rename docker file

* Update .github/workflows/extrinsic-ordering-check-from-bin.yml

Co-authored-by: Chevdor <chevdor@users.noreply.github.com>

* Versioning scheme that tracks polkadot relay chain

but allows for patch releases by having a 0 at the end.
(`-patch1` patch naming schemes were discussed but they
were judged to cause downstream packagers pain.)

* update name

* update lock file

Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
2022-05-13 13:02:52 +00:00

51 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# this script runs the polkadot-parachain after fetching
# appropriate bootnode IDs
#
# this is _not_ a general-purpose script; it is closely tied to the
# root docker-compose.yml
set -e -o pipefail
ctpc="/usr/bin/polkadot-parachain"
if [ ! -x "$ctpc" ]; then
echo "FATAL: $ctpc does not exist or is not executable"
exit 1
fi
# name the variable with the incoming args so it isn't overwritten later by function calls
args=( "$@" )
alice="172.28.1.1"
bob="172.28.1.2"
p2p_port="30333"
rpc_port="9933"
get_id () {
node="$1"
/wait-for-it.sh "$node:$rpc_port" -t 10 -s -- \
curl -sS \
-H 'Content-Type: application/json' \
--data '{"id":1,"jsonrpc":"2.0","method":"system_networkState"}' \
"$node:$rpc_port" |\
jq -r '.result.peerId'
}
bootnode () {
node="$1"
id=$(get_id "$node")
if [ -z "$id" ]; then
echo >&2 "failed to get id for $node"
exit 1
fi
echo "/ip4/$node/tcp/$p2p_port/p2p/$id"
}
args+=( "--" "--bootnodes=$(bootnode "$alice")" "--bootnodes=$(bootnode "$bob")" )
set -x
"$ctpc" "${args[@]}"