Skip to content

Instantly share code, notes, and snippets.

@p-offtermatt
Created December 7, 2023 08:59
Show Gist options
  • Save p-offtermatt/10e128af413fe784f13e1684cd9e8d3e to your computer and use it in GitHub Desktop.
Save p-offtermatt/10e128af413fe784f13e1684cd9e8d3e to your computer and use it in GitHub Desktop.
Utility script to verify that --gas=auto is nondeterministic
#!/bin/bash
# Run the first command
output=$(interchain-security-pd tx staking delegate cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng 500stake --from validatoralice --chain-id provi --home provi/validatoralice --node tcp://7.7.7.4:26658 --keyring-backend test --gas=auto --gas-adjustment=1 --output json -y)
# Extract the txhash from the output
txhash=$(echo "$output" | jq -r '.txhash')
sleep 1
# Check if the txhash is not empty
if [ -n "$txhash" ]; then
# Run the second command
second_output=$(interchain-security-pd q tx --type=hash "$txhash" --home provi/validatoralice --node tcp://7.7.7.4:26658)
# Check if the string "out of gas" appears in the output of the second command
if echo "$second_output" | grep -q "out of gas"; then
echo "The string 'out of gas' was found in the output of the second command."
echo $second_output
else
echo "The string 'out of gas' was not found in the output of the second command."
echo $second_output
fi
else
echo "Failed to extract txhash from the first command output."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment