Skip to content

Commit

Permalink
Add log message checking as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystal Lemire committed Oct 19, 2023
1 parent a3c7100 commit 80da9a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions protocol/app/ante/gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func TestSubmitTxnWithGas(t *testing.T) {
tests := map[string]struct {
gasFee sdk.Coins
responseCode uint32
logMessage string
}{
"Success - 5 cents usdc gas fee": {
gasFee: constants.TestFeeCoins_5Cents,
Expand All @@ -156,13 +157,17 @@ func TestSubmitTxnWithGas(t *testing.T) {
"Failure: 0 gas fee": {
gasFee: sdk.Coins{},
responseCode: sdkerrors.ErrInsufficientFee.ABCICode(),
logMessage: "insufficient fees; got: required: 25000000000000000adv4tnt," +
"25000ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5: insufficient fee",
},
"Failure: unsupported gas fee denom": {
gasFee: sdk.Coins{
// 1BTC, which is not supported as a gas fee denom, and should be plenty to cover gas.
sdk.NewCoin(constants.BtcUsd.Denom, sdkmath.NewInt(100_000_000)),
},
responseCode: sdkerrors.ErrInsufficientFee.ABCICode(),
logMessage: "insufficient fees; got: 100000000btc-denom required: 25000000000000000adv4tnt," +
"25000ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5: insufficient fee",
},
}
for name, tc := range tests {
Expand Down Expand Up @@ -199,6 +204,9 @@ func TestSubmitTxnWithGas(t *testing.T) {
// Sanity check that gas was used.
require.Greater(t, checkTx.GasUsed, int64(0))
require.Equal(t, tc.responseCode, checkTx.Code)
if tc.responseCode != errors.SuccessABCICode {
require.Equal(t, tc.logMessage, checkTx.Log)
}
})
}
}

0 comments on commit 80da9a1

Please sign in to comment.