You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WasmVM Gas - currently 1 Cosmos Gas = 140_000 WasmVM Gas
The test case TestLimitRecursiveQueryGas runs the following scenario:
Translate WasmD Gas to WasmVM Gas and set the limit for the Query call,
Run WasmVM to perform and finish a recursive Query call, return the amount of WasmVM gas used,
Translate the returned WasmVM Gas back to WasmD Gas and subtract it from the gas limit assigned for the whole operation,
Check in WasmD if there is no gas left - panic in such case.
When we updated WasmVM to v2.2 the gas fee calculations in WasmVM has changed. We encountered the following scenario:
Translate WasmD Gas to WasmVM Gas and set the limit for the Query call,
Run WasmVM to perform and finish a recursive Query call, return the amount of WasmVM Gas used. This step returned VmError::GasDepletion error.
In the second case if we artificially increase the gas limit set for the Query operation of 1 WasmD Gas or 116_370 WasmVM Gas, the test behave the same way as in the first case i.e. the WasmVM finishes the operation and WasmD panics when theres 0 gas left.
WasmD panics when it has 0 WasmD Gas left, regardless of the fact that there was enough gas to run the whole procedure for WasmVM. In the first case WasmVM finished and returned 23_630 WasmVM Gas. After translation WasmD is left with 23_630 WasmVM Gas / 140_000 = 0.214285714 WasmD Gas. This is rounded down to 0, that's why we get panic from WasmD and not the error from WasmVM.
It seems to me that getting VmError::GasDepletion should be the only valid way to raise the RanOutOfGas panic in WasmD.
The text was updated successfully, but these errors were encountered:
We have two types of gas:
WasmD Gas
- the unit that is used inWasmD
,WasmVM Gas
- currently1 Cosmos Gas
=140_000 WasmVM Gas
The test case
TestLimitRecursiveQueryGas
runs the following scenario:WasmD Gas
toWasmVM Gas
and set the limit for the Query call,WasmVM gas
used,WasmVM Gas
back toWasmD Gas
and subtract it from the gas limit assigned for the whole operation,When we updated WasmVM to
v2.2
the gas fee calculations in WasmVM has changed. We encountered the following scenario:WasmD Gas
toWasmVM Gas
and set the limit for the Query call,WasmVM Gas
used. This step returnedVmError::GasDepletion
error.In the second case if we artificially increase the gas limit set for the Query operation of
1 WasmD Gas
or116_370 WasmVM Gas
, the test behave the same way as in the first case i.e. the WasmVM finishes the operation and WasmD panics when theres0
gas left.WasmD panics when it has
0 WasmD Gas
left, regardless of the fact that there was enough gas to run the whole procedure for WasmVM. In the first case WasmVM finished and returned23_630 WasmVM Gas
. After translation WasmD is left with23_630 WasmVM Gas / 140_000 = 0.214285714 WasmD Gas
. This is rounded down to0
, that's why we get panic from WasmD and not the error from WasmVM.It seems to me that getting
VmError::GasDepletion
should be the only valid way to raise theRanOutOfGas
panic in WasmD.The text was updated successfully, but these errors were encountered: