solana/tilt: run registrations in parallel (#1826)
Doing so reduces the time it takes to do the registrations from ~90s to ~9s, a 10x improvement.
This commit is contained in:
parent
0e643cdb50
commit
3b8683f18e
|
@ -9,7 +9,12 @@ RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/certs/ca-certifi
|
||||||
# Add bridge contract sources
|
# Add bridge contract sources
|
||||||
WORKDIR /usr/src/bridge
|
WORKDIR /usr/src/bridge
|
||||||
|
|
||||||
COPY . .
|
COPY bridge bridge
|
||||||
|
COPY modules modules
|
||||||
|
COPY migration migration
|
||||||
|
COPY Cargo.toml Cargo.toml
|
||||||
|
COPY Cargo.lock Cargo.lock
|
||||||
|
COPY solitaire solitaire
|
||||||
|
|
||||||
ENV RUST_LOG="solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=trace,solana_bpf_loader=debug,solana_rbpf=debug"
|
ENV RUST_LOG="solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=trace,solana_bpf_loader=debug,solana_rbpf=debug"
|
||||||
ENV RUST_BACKTRACE=1
|
ENV RUST_BACKTRACE=1
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This script configures the devnet for test transfers with hardcoded addresses.
|
# This script configures the devnet for test transfers with hardcoded addresses.
|
||||||
set -xu
|
set -eu
|
||||||
|
|
||||||
|
# kick off building worm in the background, and remember the process PID so we
|
||||||
|
# can wait on it later
|
||||||
|
make -C /usr/src/clients/js install &
|
||||||
|
worm_build_pid=$!
|
||||||
|
|
||||||
# Configure CLI (works the same as upstream Solana CLI)
|
# Configure CLI (works the same as upstream Solana CLI)
|
||||||
mkdir -p ~/.config/solana/cli
|
mkdir -p ~/.config/solana/cli
|
||||||
|
@ -92,22 +97,34 @@ retry token-bridge-client create-bridge "$token_bridge_address" "$bridge_address
|
||||||
# Initialize the NFT bridge
|
# Initialize the NFT bridge
|
||||||
retry token-bridge-client create-bridge "$nft_bridge_address" "$bridge_address"
|
retry token-bridge-client create-bridge "$nft_bridge_address" "$bridge_address"
|
||||||
|
|
||||||
# pass the chain registration VAAs sourced from .env to the client's execute-governance command:
|
echo "Waiting for worm to finish building"
|
||||||
pushd /usr/src/clients/js
|
wait $worm_build_pid
|
||||||
make install
|
|
||||||
|
|
||||||
# next we get all the registration VAAs from the environment
|
# next we get all the registration VAAs from the environment
|
||||||
# if a new VAA is added, this will automatically pick it up
|
# if a new VAA is added, this will automatically pick it up
|
||||||
VAAS=$(set | grep "REGISTER_.*_VAA" | grep -v SOL | cut -d '=' -f1)
|
VAAS=$(set | grep "REGISTER_.*_VAA" | grep -v SOL | cut -d '=' -f1)
|
||||||
|
|
||||||
|
# reset the builtin SECONDS timer (it's incremented once a second).
|
||||||
|
SECONDS=0
|
||||||
|
|
||||||
# use 'worm' to submit each registration VAA
|
# use 'worm' to submit each registration VAA
|
||||||
|
echo "Running chain registrations in parallel"
|
||||||
|
# we'll send the registration calls in parallel, but we want to wait on them at
|
||||||
|
# the end, so we collect the PIDs
|
||||||
|
registration_pids=()
|
||||||
for VAA in $VAAS
|
for VAA in $VAAS
|
||||||
do
|
do
|
||||||
VAA=${!VAA}
|
VAA=${!VAA}
|
||||||
worm submit $VAA --chain solana --network devnet
|
worm submit $VAA --chain solana --network devnet &
|
||||||
|
registration_pids+=( $! )
|
||||||
done
|
done
|
||||||
echo "Registrations successful."
|
|
||||||
popd
|
# wait on registration calls
|
||||||
|
for pid in "${registration_pids[@]}"; do
|
||||||
|
wait $pid
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Registrations successfully completed in $SECONDS seconds."
|
||||||
|
|
||||||
# Let k8s startup probe succeed
|
# Let k8s startup probe succeed
|
||||||
nc -k -l -p 2000
|
nc -k -l -p 2000
|
||||||
|
|
Loading…
Reference in New Issue