Skip to content

Commit

Permalink
refactor: DRY SIGN_BROADCAST_OPTS
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Mar 18, 2024
1 parent 5fbd352 commit d67a83b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ provisionSmartWallet() {
addr="$1"
amount="$2"
echo "funding $addr"
agd tx -bblock bank send "validator" "$addr" "$amount" -y --keyring-backend=test --chain-id="$CHAINID"
# shellcheck disable=SC2086
agd tx bank send "validator" "$addr" "$amount" $SIGN_BROADCAST_OPTS
waitForBlock
echo "provisioning $addr"
agd tx -bblock swingset provision-one my-wallet "$addr" SMART_WALLET --keyring-backend=test --yes --chain-id="$CHAINID" --from="$addr"
# shellcheck disable=SC2086
agd tx swingset provision-one my-wallet "$addr" SMART_WALLET --from="$addr" $SIGN_BROADCAST_OPTS
echo "Waiting for wallet $addr to reach vstorage"
waitForBlock 5
echo "Reading $addr from vstorage"
Expand Down Expand Up @@ -192,7 +194,7 @@ test_not_val() {
# gas=200000 is the default but gas used may be higher or lower. Setting it
# to "auto" makes the proposal executions less brittle.
GAS_ADJUSTMENT=1.2
export SUBMIT_PROPOSAL_OPTS="--keyring-backend=test --chain-id=$CHAINID \
export SIGN_BROADCAST_OPTS="--keyring-backend=test --chain-id=$CHAINID \
--gas=auto --gas-adjustment=$GAS_ADJUSTMENT \
--yes --broadcast-mode block --from validator"

Expand All @@ -202,9 +204,11 @@ voteLatestProposalAndWait() {
proposal=$($binary q gov proposals -o json | jq -r '.proposals | last | if .proposal_id == null then .id else .proposal_id end')
echo "Latest proposal: $proposal"
waitForBlock
$binary tx -bblock gov deposit "$proposal" 50000000ubld --from=validator --chain-id="$CHAINID" --yes --keyring-backend test
# shellcheck disable=SC2086
$binary tx gov deposit "$proposal" 50000000ubld $SIGN_BROADCAST_OPTS
waitForBlock
$binary tx -bblock gov vote "$proposal" yes --from=validator --chain-id="$CHAINID" --yes --keyring-backend test
# shellcheck disable=SC2086
$binary tx gov vote "$proposal" yes $SIGN_BROADCAST_OPTS
waitForBlock

echo "Voted in proposal $proposal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fi
agd tx gov submit-proposal software-upgrade "$UPGRADE_TO" \
--upgrade-height="$height" --upgrade-info="$info" \
--title="Upgrade to ${UPGRADE_TO}" --description="upgrades" \
${SUBMIT_PROPOSAL_OPTS="--missing-env-setup"}
${SIGN_BROADCAST_OPTS="--missing-env-setup"}
waitForBlock

voteLatestProposalAndWait
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi
agd tx gov submit-proposal software-upgrade "$UPGRADE_TO" \
--upgrade-height="$height" --upgrade-info="$info" \
--title="Upgrade to ${UPGRADE_TO}" --description="upgrades" \
${SUBMIT_PROPOSAL_OPTS="--missing-env-setup"}
${SIGN_BROADCAST_OPTS="--missing-env-setup"}
waitForBlock

voteLatestProposalAndWait
Expand Down
3 changes: 2 additions & 1 deletion proposals/16:upgrade-8/use.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ waitForBlock 2
waitForBlock 3
# fund provision pool
stakeamount="20000000${USDC_DENOM}"
agd tx bank send "validator" "agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346" "$stakeamount" -y --keyring-backend=test --chain-id="$CHAINID" -bblock
# shellcheck disable=SC2086
agd tx bank send "validator" "agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346" "$stakeamount" ${SIGN_BROADCAST_OPTS="--missing-env-setup"}
waitForBlock 3

govaccounts=("$GOV1ADDR" "$GOV2ADDR" "$GOV3ADDR")
Expand Down
2 changes: 1 addition & 1 deletion proposals/61:lo-bundle-cost/eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ source /usr/src/upgrade-test-scripts/env_setup.sh

# shellcheck disable=SC2086
agd tx gov submit-proposal param-change lower-bundle-cost.json \
${SUBMIT_PROPOSAL_OPTS="--missing-env-setup"}
${SIGN_BROADCAST_OPTS="--missing-env-setup"}

voteLatestProposalAndWait

0 comments on commit d67a83b

Please sign in to comment.