Avoid Gas Meter Panic
We take a constant transaction fee, but the gas meter is still used. The transaction 12262A11B20471E25F7B8A5B296BAAF016FD838C12027C644BD21E34BF4D9462
was sent with insufficient gas and caused the following panic:
3:40PM ERR app/x/thorchain/handler.go:32 > panic msg={"coins":[{"amount":"1","asset":"THOR.RUNE"}],"memo":"UNBOND:thor169fahg7x70vkv909h06c2mspphrzqgy7g6prr4:91110700000000","signer":"thor1732r3v75ttepl4022mfllph3zfljcpgsnfzqn3"}
goroutine 12053 [running]:
gitlab.com/thorchain/thornode/x/thorchain.NewExternalHandler.func1.1()
/app/x/thorchain/handler.go:31 +0x9e
panic({0x221b6e0, 0xc037703560})
/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/cosmos/cosmos-sdk/store/types.(*basicGasMeter).ConsumeGas(0xc02c2b5780?, 0xc0295e8f60?, {0x2470e80?, 0x60?})
/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.1/store/types/gas.go:99 +0x75
github.com/cosmos/cosmos-sdk/store/gaskv.(*Store).Get(0xc036aa0720, {0xc0295e8f60, 0x52, 0x60})
/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.1/store/gaskv/store.go:42 +0xb1
gitlab.com/thorchain/thornode/x/thorchain/keeper/v1.KVStore.getVault({{0x2b8f770, 0xc0012ba350}, {0x2ba24d0, 0xc000295080}, {{0x2b6a970, 0xc0013222e0}, {0x2b8f7
70, 0xc0012ba350}, {{0x2b8f770, 0xc0012ba350}, ...}, ...}, ...}, ...)
/app/x/thorchain/keeper/v1/keeper_vault.go:29 +0x10d
gitlab.com/thorchain/thornode/x/thorchain/keeper/v1.KVStore.GetVault({{0x2b8f770, 0xc0012ba350}, {0x2ba24d0, 0xc000295080}, {{0x2b6a970, 0xc0013222e0}
The panic is recovered and the transaction just fails, but it would be preferable to error cleanly. The apparent options for approach would be:
- Check the gas in ante handler
- Check the gas in validate
- Use the infinite gas meter everywhere (unsure on side effects)
I think @akrokr is closest to this behavior, any thoughts or preference?