@@ -56,14 +56,14 @@ func initRecurseContract(t *testing.T) (contract sdk.AccAddress, ctx sdk.Context
56
56
57
57
func TestGasCostOnQuery (t * testing.T ) {
58
58
const (
59
- GasNoWork uint64 = 63_987 + 6
60
- GasNoWorkDiscounted uint64 = 5_968
61
- // Note: about 100 SDK gas (10k CosmWasm gas) for each round of sha256
62
- GasWork50 uint64 = 64_234 + 6 // this is a little shy of 50k gas - to keep an eye on the limit
63
- GasWork50Discounted uint64 = 6_207
64
-
65
- GasReturnUnhashed uint64 = 89 + 10
66
- GasReturnHashed uint64 = 86 + 10
59
+ GasNoWork uint64 = 63_993
60
+ GasWork50 uint64 = 64_240
61
+ // should be discounted exactly by the difference between normal instance cost and discounted instance cost
62
+ GasNoWorkDiscounted uint64 = GasNoWork - ( types . DefaultInstanceCost - types . DefaultInstanceCostDiscount )
63
+ GasWork50Discounted uint64 = GasWork50 - ( types . DefaultInstanceCost - types . DefaultInstanceCostDiscount )
64
+
65
+ GasReturnUnhashed uint64 = 74
66
+ GasReturnHashed uint64 = 63
67
67
)
68
68
69
69
cases := map [string ]struct {
@@ -214,12 +214,16 @@ func TestLimitRecursiveQueryGas(t *testing.T) {
214
214
215
215
const (
216
216
// Note: about 100 SDK gas (10k CosmWasm gas) for each round of sha256
217
- GasWork2k uint64 = 76_817 + 5 // = SetupContractCost + x // we have 6x gas used in cpu than in the instance
217
+ GasWork2k uint64 = 76_822 // = SetupContractCost + x // we have 6x gas used in cpu than in the instance
218
218
219
- GasWork2kDiscounted uint64 = 18_264 + 432 + 10
219
+ // should be discounted exactly by the difference between normal instance cost and discounted instance cost
220
+ GasWork2kDiscounted uint64 = GasWork2k - (types .DefaultInstanceCost - types .DefaultInstanceCostDiscount )
220
221
221
222
// This is overhead for calling into a sub-contract
222
- GasReturnHashed uint64 = 48 + 132
223
+ GasReturnHashed uint64 = 64
224
+
225
+ // lots of additional gas for long error message
226
+ GasError uint64 = 3408
223
227
)
224
228
225
229
cases := map [string ]struct {
@@ -268,8 +272,8 @@ func TestLimitRecursiveQueryGas(t *testing.T) {
268
272
},
269
273
expectQueriesFromContract : 10 ,
270
274
expectOutOfGas : false ,
271
- expectError : "query wasm contract failed" , // Error we get from the contract instance doing the failing query, not wasmd
272
- expectedGas : GasWork2k + GasReturnHashed + 9 * (GasWork2kDiscounted + GasReturnHashed ) + 3279 + 13 , // lots of additional gas for long error message
275
+ expectError : "query wasm contract failed" , // Error we get from the contract instance doing the failing query, not wasmd
276
+ expectedGas : GasWork2k + GasReturnHashed + 9 * (GasWork2kDiscounted + GasReturnHashed ) + GasError ,
273
277
},
274
278
}
275
279
0 commit comments