Skip to content

Commit

Permalink
Fix local test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Nov 13, 2023
1 parent 6f8c0a9 commit c5f5881
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion contrib/local/01-accounts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -o errexit -o nounset -o pipefail

BASE_ACCOUNT=$(wasmd keys show validator -a --keyring-backend=test)
wasmd q account "$BASE_ACCOUNT" -o json | jq
wasmd q auth account "$BASE_ACCOUNT" -o json | jq

echo "## Add new account"
wasmd keys add fred --keyring-backend=test
Expand Down
15 changes: 8 additions & 7 deletions contrib/local/02-contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/keeper/testdata/hackatom.wasm" \
--from validator --gas 1500000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test)
sleep 6
RESP=$(wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json)
CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value')
CODE_HASH=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_checksum").value')
CODE_ID=$(echo "$RESP" | jq -r '.events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value')
CODE_HASH=$(echo "$RESP" | jq -r '.events[]| select(.type=="store_code").attributes[]| select(.key=="code_checksum").value')
echo "* Code id: $CODE_ID"
echo "* Code checksum: $CODE_HASH"

echo "* Download code"
TMPDIR=$(mktemp -t wasmdXXXXXX)
wasmd q wasm code "$CODE_ID" "$TMPDIR"
rm -f "$TMPDIR"
TMPDIR=$(mktemp -d -t wasmdXXXXXX)
wasmd q wasm code "$CODE_ID" "$TMPDIR/delme.wasm"
rm -f "$TMPDIR/delme.wasm"
echo "-----------------------"
echo "## List code"
wasmd query wasm list-code --node=http://localhost:26657 -o json | jq
Expand Down Expand Up @@ -81,10 +81,11 @@ echo "-----------------------"
echo "## Migrate contract"
echo "### Upload new code"
RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/keeper/testdata/burner.wasm" \
--from validator --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test)
--from validator --gas 1100000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test)
sleep 6
RESP=$(wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json)
BURNER_CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value')
BURNER_CODE_ID=$(echo "$RESP" | jq -r '.events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value')

echo "### Migrate to code id: $BURNER_CODE_ID"

DEST_ACCOUNT=$(wasmd keys show fred -a --keyring-backend=test)
Expand Down

0 comments on commit c5f5881

Please sign in to comment.