@@ -124,12 +124,12 @@ func TestSendTip(t *testing.T) {
124124func TestPostHandle (t * testing.T ) {
125125 // Same data for every test case
126126 const (
127- baseDenom = "stake"
128- resolvableDenom = "atom"
127+ baseDenom = "stake"
128+ resolvableDenom = "atom"
129+ expectedConsumedGas = 33339
130+ gasLimit = expectedConsumedGas
129131 )
130132
131- // exact cost of transaction
132- gasLimit := uint64 (27284 )
133133 validFeeAmount := types .DefaultMinBaseGasPrice .MulInt64 (int64 (gasLimit ))
134134 validFeeAmountWithTip := validFeeAmount .Add (math .LegacyNewDec (100 ))
135135 validFee := sdk .NewCoins (sdk .NewCoin (baseDenom , validFeeAmount .TruncateInt ()))
@@ -204,11 +204,12 @@ func TestPostHandle(t *testing.T) {
204204 FeeAmount : validFee ,
205205 }
206206 },
207- RunAnte : true ,
208- RunPost : true ,
209- Simulate : true ,
210- ExpPass : true ,
211- ExpErr : nil ,
207+ RunAnte : true ,
208+ RunPost : true ,
209+ Simulate : true ,
210+ ExpPass : true ,
211+ ExpErr : nil ,
212+ ExpectConsumedGas : expectedConsumedGas ,
212213 },
213214 {
214215 Name : "signer has enough funds, should pass, no tip" ,
@@ -223,11 +224,12 @@ func TestPostHandle(t *testing.T) {
223224 FeeAmount : validFee ,
224225 }
225226 },
226- RunAnte : true ,
227- RunPost : true ,
228- Simulate : false ,
229- ExpPass : true ,
230- ExpErr : nil ,
227+ RunAnte : true ,
228+ RunPost : true ,
229+ Simulate : false ,
230+ ExpPass : true ,
231+ ExpErr : nil ,
232+ ExpectConsumedGas : expectedConsumedGas ,
231233 },
232234 {
233235 Name : "signer has enough funds, should pass with tip" ,
@@ -242,11 +244,12 @@ func TestPostHandle(t *testing.T) {
242244 FeeAmount : validFeeWithTip ,
243245 }
244246 },
245- RunAnte : true ,
246- RunPost : true ,
247- Simulate : false ,
248- ExpPass : true ,
249- ExpErr : nil ,
247+ RunAnte : true ,
248+ RunPost : true ,
249+ Simulate : false ,
250+ ExpPass : true ,
251+ ExpErr : nil ,
252+ ExpectConsumedGas : expectedConsumedGas ,
250253 },
251254 {
252255 Name : "signer has enough funds, should pass with tip - simulate" ,
@@ -261,11 +264,12 @@ func TestPostHandle(t *testing.T) {
261264 FeeAmount : validFeeWithTip ,
262265 }
263266 },
264- RunAnte : true ,
265- RunPost : true ,
266- Simulate : true ,
267- ExpPass : true ,
268- ExpErr : nil ,
267+ RunAnte : true ,
268+ RunPost : true ,
269+ Simulate : true ,
270+ ExpPass : true ,
271+ ExpErr : nil ,
272+ ExpectConsumedGas : expectedConsumedGas ,
269273 },
270274 {
271275 Name : "signer has enough funds, should pass, no tip - resolvable denom" ,
@@ -280,11 +284,12 @@ func TestPostHandle(t *testing.T) {
280284 FeeAmount : validResolvableFee ,
281285 }
282286 },
283- RunAnte : true ,
284- RunPost : true ,
285- Simulate : false ,
286- ExpPass : true ,
287- ExpErr : nil ,
287+ RunAnte : true ,
288+ RunPost : true ,
289+ Simulate : false ,
290+ ExpPass : true ,
291+ ExpErr : nil ,
292+ ExpectConsumedGas : expectedConsumedGas ,
288293 },
289294 {
290295 Name : "signer has enough funds, should pass, no tip - resolvable denom - simulate" ,
@@ -299,11 +304,12 @@ func TestPostHandle(t *testing.T) {
299304 FeeAmount : validResolvableFee ,
300305 }
301306 },
302- RunAnte : true ,
303- RunPost : true ,
304- Simulate : true ,
305- ExpPass : true ,
306- ExpErr : nil ,
307+ RunAnte : true ,
308+ RunPost : true ,
309+ Simulate : true ,
310+ ExpPass : true ,
311+ ExpErr : nil ,
312+ ExpectConsumedGas : expectedConsumedGas ,
307313 },
308314 {
309315 Name : "signer has enough funds, should pass with tip - resolvable denom" ,
@@ -318,11 +324,12 @@ func TestPostHandle(t *testing.T) {
318324 FeeAmount : validResolvableFeeWithTip ,
319325 }
320326 },
321- RunAnte : true ,
322- RunPost : true ,
323- Simulate : false ,
324- ExpPass : true ,
325- ExpErr : nil ,
327+ RunAnte : true ,
328+ RunPost : true ,
329+ Simulate : false ,
330+ ExpPass : true ,
331+ ExpErr : nil ,
332+ ExpectConsumedGas : expectedConsumedGas ,
326333 },
327334 {
328335 Name : "signer has enough funds, should pass with tip - resolvable denom - simulate" ,
@@ -337,11 +344,12 @@ func TestPostHandle(t *testing.T) {
337344 FeeAmount : validResolvableFeeWithTip ,
338345 }
339346 },
340- RunAnte : true ,
341- RunPost : true ,
342- Simulate : true ,
343- ExpPass : true ,
344- ExpErr : nil ,
347+ RunAnte : true ,
348+ RunPost : true ,
349+ Simulate : true ,
350+ ExpPass : true ,
351+ ExpErr : nil ,
352+ ExpectConsumedGas : expectedConsumedGas ,
345353 },
346354 {
347355 Name : "0 gas given should pass in simulate - no fee" ,
@@ -354,11 +362,12 @@ func TestPostHandle(t *testing.T) {
354362 FeeAmount : nil ,
355363 }
356364 },
357- RunAnte : true ,
358- RunPost : false ,
359- Simulate : true ,
360- ExpPass : true ,
361- ExpErr : nil ,
365+ RunAnte : true ,
366+ RunPost : false ,
367+ Simulate : true ,
368+ ExpPass : true ,
369+ ExpErr : nil ,
370+ ExpectConsumedGas : expectedConsumedGas ,
362371 },
363372 {
364373 Name : "0 gas given should pass in simulate - fee" ,
@@ -371,11 +380,12 @@ func TestPostHandle(t *testing.T) {
371380 FeeAmount : validFee ,
372381 }
373382 },
374- RunAnte : true ,
375- RunPost : false ,
376- Simulate : true ,
377- ExpPass : true ,
378- ExpErr : nil ,
383+ RunAnte : true ,
384+ RunPost : false ,
385+ Simulate : true ,
386+ ExpPass : true ,
387+ ExpErr : nil ,
388+ ExpectConsumedGas : expectedConsumedGas ,
379389 },
380390 {
381391 Name : "no fee - fail" ,
0 commit comments