gasWanted values for specific Exchange messages. Values were obtained heuristically
by observing gas consumption during MsgServer execution for a transaction containing a single Msg type. Conceptually,
for any transaction the following formula applies:
ante_gas is the gas consumed during AnteHandler and the subsequent sum of msg_gas is gas consumed
by MsgServer of each particular msg (highest observed ante_gas is 120_000).
With fixed_gas_enabled set to true in Exchange params, the following values can be used as gasWanted in order to
ensure a transaction does not run out of gas:
Note: It is assumed that the transaction contains a single message`.
If the order in question is also a GTB (Good-Till-Block) order, an amount of gas equal to 10% of the above values should be added on top.
Batch Msg types
Gas for batch message types varies based on the content of the message itself. Additionally,
ante_gas scales with the
number of orders (noticeably around 3000 added gas, included in this formula).:
N - is the number of orders
MsgBatchCreateSpotLimitOrders:tx_gas = 120_000 + N x 103_000(e.g. for 3 orders you get329_000)MsgBatchCancelSpotOrders:tx_gas = 120_000 + N x 68_000MsgBatchCreateDerivativeLimitOrders:tx_gas = 120_000 + N x 123_000MsgBatchCancelDerivativeOrders:tx_gas = 120_000 + N x 73_000MsgBatchCancelBinaryOptionsOrders:tx_gas = 120_000 + N x 123_000
- cancel 3 spot orders in market A
- create 2 derivative orders in market B
- create 1 binary-options post-only order in market C
- cancel all orders in spot markets X and Y (2 orders in X and 2 orders in Y)
955_000 gas.