devnet: deterministic Solana accounts and lockup generator

This commit is contained in:
Leo 2020-11-10 22:53:36 +01:00
parent cc1dcf0867
commit 86fdfa859b
5 changed files with 24 additions and 21 deletions

View File

@ -1,13 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="send-lockups.sh" type="ShConfigurationType">
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/scripts/send-lockups.sh" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/bash" />
<option name="INTERPRETER_OPTIONS" value="" />
<method v="2" />
</configuration>
</component>

4
scripts/send-solana-lockups.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
set -e
kubectl exec -it solana-devnet-0 -c setup ./lockups.sh

View File

@ -31,11 +31,11 @@ retry cli airdrop solana-devnet:9900
retry cli create-bridge "$bridge_address" "$initial_guardian" retry cli create-bridge "$bridge_address" "$initial_guardian"
# Create a new SPL token (at a random address) # Create a new SPL token (at a random address)
token=$(cli create-token | grep 'Creating token' | awk '{ print $3 }') token=$(cli create-token --seed=29934 | grep 'Creating token' | awk '{ print $3 }')
echo "Created token $token" echo "Created token $token"
# Create token account # Create token account
account=$(cli create-account "$token" | grep 'Creating account' | awk '{ print $3 }') account=$(cli create-account --seed=38489 "$token" | grep 'Creating account' | awk '{ print $3 }')
echo "Created token account $account" echo "Created token account $account"
# Mint new tokens owned by our CLI account # Mint new tokens owned by our CLI account
@ -49,9 +49,5 @@ echo "Created wrapped token $token"
wrapped_account=$(cli create-account --seed=934893 "$wrapped_token" | grep 'Creating account' | awk '{ print $3 }') wrapped_account=$(cli create-account --seed=934893 "$wrapped_token" | grep 'Creating account' | awk '{ print $3 }')
echo "Created wrapped token account $wrapped_account" echo "Created wrapped token account $wrapped_account"
# Do lock transactions # Keep the container alive for interactive CLI usage
while : ; do sleep infinity
# Uncomment for simulated debugging transactions
#cli lock "$bridge_address" "$account" "$token" 10 "$chain_id_ethereum" "$RANDOM" "$recipient_address"
sleep 5
done

16
solana/lockups.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Generate test lockups on Solana to be executed on Ethereum
# Constants (hardcoded)
bridge_address=Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o
recipient_address=90F8bf6A479f320ead074411a4B0e7944Ea8c9C1
chain_id_ethereum=2
# Generated by devnet_setup.sh with seed
account=3C3m4tjTy4nSMkkYdqCDSiCWEgpDa6whvprvABdFGBiW
token=6qRhs8oAuZYLd4zzaNnQHqdRyknrQQWDWQhALEN8UA7M
while : ; do
cli lock "$bridge_address" "$account" "$token" 1000000000 "$chain_id_ethereum" "$RANDOM" "$recipient_address"
sleep 5
done