@@ -124,12 +124,13 @@ 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 = 31690
130+ gasLimit = expectedConsumedGas
129131 )
130132
131133 // exact cost of transaction
132- gasLimit := uint64 (25635 )
133134 validFeeAmount := types .DefaultMinBaseGasPrice .MulInt64 (int64 (gasLimit ))
134135 validFeeAmountWithTip := validFeeAmount .Add (math .LegacyNewDec (100 ))
135136 validFee := sdk .NewCoins (sdk .NewCoin (baseDenom , validFeeAmount .TruncateInt ()))
@@ -204,11 +205,12 @@ func TestPostHandle(t *testing.T) {
204205 FeeAmount : validFee ,
205206 }
206207 },
207- RunAnte : true ,
208- RunPost : true ,
209- Simulate : true ,
210- ExpPass : true ,
211- ExpErr : nil ,
208+ RunAnte : true ,
209+ RunPost : true ,
210+ Simulate : true ,
211+ ExpPass : true ,
212+ ExpErr : nil ,
213+ ExpectConsumedGas : expectedConsumedGas ,
212214 },
213215 {
214216 Name : "signer has enough funds, should pass, no tip" ,
@@ -223,11 +225,12 @@ func TestPostHandle(t *testing.T) {
223225 FeeAmount : validFee ,
224226 }
225227 },
226- RunAnte : true ,
227- RunPost : true ,
228- Simulate : false ,
229- ExpPass : true ,
230- ExpErr : nil ,
228+ RunAnte : true ,
229+ RunPost : true ,
230+ Simulate : false ,
231+ ExpPass : true ,
232+ ExpErr : nil ,
233+ ExpectConsumedGas : expectedConsumedGas ,
231234 },
232235 {
233236 Name : "signer has enough funds, should pass with tip" ,
@@ -242,11 +245,12 @@ func TestPostHandle(t *testing.T) {
242245 FeeAmount : validFeeWithTip ,
243246 }
244247 },
245- RunAnte : true ,
246- RunPost : true ,
247- Simulate : false ,
248- ExpPass : true ,
249- ExpErr : nil ,
248+ RunAnte : true ,
249+ RunPost : true ,
250+ Simulate : false ,
251+ ExpPass : true ,
252+ ExpErr : nil ,
253+ ExpectConsumedGas : expectedConsumedGas ,
250254 },
251255 {
252256 Name : "signer has enough funds, should pass with tip - simulate" ,
@@ -261,11 +265,12 @@ func TestPostHandle(t *testing.T) {
261265 FeeAmount : validFeeWithTip ,
262266 }
263267 },
264- RunAnte : true ,
265- RunPost : true ,
266- Simulate : true ,
267- ExpPass : true ,
268- ExpErr : nil ,
268+ RunAnte : true ,
269+ RunPost : true ,
270+ Simulate : true ,
271+ ExpPass : true ,
272+ ExpErr : nil ,
273+ ExpectConsumedGas : expectedConsumedGas ,
269274 },
270275 {
271276 Name : "signer has enough funds, should pass, no tip - resolvable denom" ,
@@ -280,11 +285,12 @@ func TestPostHandle(t *testing.T) {
280285 FeeAmount : validResolvableFee ,
281286 }
282287 },
283- RunAnte : true ,
284- RunPost : true ,
285- Simulate : false ,
286- ExpPass : true ,
287- ExpErr : nil ,
288+ RunAnte : true ,
289+ RunPost : true ,
290+ Simulate : false ,
291+ ExpPass : true ,
292+ ExpErr : nil ,
293+ ExpectConsumedGas : expectedConsumedGas ,
288294 },
289295 {
290296 Name : "signer has enough funds, should pass, no tip - resolvable denom - simulate" ,
@@ -299,11 +305,12 @@ func TestPostHandle(t *testing.T) {
299305 FeeAmount : validResolvableFee ,
300306 }
301307 },
302- RunAnte : true ,
303- RunPost : true ,
304- Simulate : true ,
305- ExpPass : true ,
306- ExpErr : nil ,
308+ RunAnte : true ,
309+ RunPost : true ,
310+ Simulate : true ,
311+ ExpPass : true ,
312+ ExpErr : nil ,
313+ ExpectConsumedGas : expectedConsumedGas ,
307314 },
308315 {
309316 Name : "signer has enough funds, should pass with tip - resolvable denom" ,
@@ -318,11 +325,12 @@ func TestPostHandle(t *testing.T) {
318325 FeeAmount : validResolvableFeeWithTip ,
319326 }
320327 },
321- RunAnte : true ,
322- RunPost : true ,
323- Simulate : false ,
324- ExpPass : true ,
325- ExpErr : nil ,
328+ RunAnte : true ,
329+ RunPost : true ,
330+ Simulate : false ,
331+ ExpPass : true ,
332+ ExpErr : nil ,
333+ ExpectConsumedGas : expectedConsumedGas ,
326334 },
327335 {
328336 Name : "signer has enough funds, should pass with tip - resolvable denom - simulate" ,
@@ -337,11 +345,12 @@ func TestPostHandle(t *testing.T) {
337345 FeeAmount : validResolvableFeeWithTip ,
338346 }
339347 },
340- RunAnte : true ,
341- RunPost : true ,
342- Simulate : true ,
343- ExpPass : true ,
344- ExpErr : nil ,
348+ RunAnte : true ,
349+ RunPost : true ,
350+ Simulate : true ,
351+ ExpPass : true ,
352+ ExpErr : nil ,
353+ ExpectConsumedGas : expectedConsumedGas ,
345354 },
346355 {
347356 Name : "0 gas given should pass in simulate - no fee" ,
@@ -354,11 +363,12 @@ func TestPostHandle(t *testing.T) {
354363 FeeAmount : nil ,
355364 }
356365 },
357- RunAnte : true ,
358- RunPost : false ,
359- Simulate : true ,
360- ExpPass : true ,
361- ExpErr : nil ,
366+ RunAnte : true ,
367+ RunPost : false ,
368+ Simulate : true ,
369+ ExpPass : true ,
370+ ExpErr : nil ,
371+ ExpectConsumedGas : expectedConsumedGas ,
362372 },
363373 {
364374 Name : "0 gas given should pass in simulate - fee" ,
@@ -371,11 +381,12 @@ func TestPostHandle(t *testing.T) {
371381 FeeAmount : validFee ,
372382 }
373383 },
374- RunAnte : true ,
375- RunPost : false ,
376- Simulate : true ,
377- ExpPass : true ,
378- ExpErr : nil ,
384+ RunAnte : true ,
385+ RunPost : false ,
386+ Simulate : true ,
387+ ExpPass : true ,
388+ ExpErr : nil ,
389+ ExpectConsumedGas : expectedConsumedGas ,
379390 },
380391 {
381392 Name : "no fee - fail" ,
0 commit comments