Live on testnet. These gas heuristics require
fixed_gas_enabled to be set to true in the Exchange module params. This is currently enabled on testnet and will be activated on mainnet via a forthcoming governance params proposal.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: Values assume a transaction containing a single message. Suggested gasWanted is the fixed message gas plus the 120,000 ante allowance.
For a GTB (Good Till Block) limit order, multiply the fixed message gas by
1.1 (GTBOrdersGasMultiplier), then add
the ante allowance. The multiplier applies to the fixed message gas only, including the post-only variant. It does not
apply to market orders or cancellations.
Batch Msg types
Gas for batch message types varies depending on the message content. Additionally, ante_gas scales with the number of orders (it’s estimated that 3000 gas provides for sufficient ante handler headroom).
N is the number of orders.
MsgBatchCreateSpotLimitOrders:tx_gas = 120_000 + N x 183_000(for 3 orders this results in669_000)MsgBatchCancelSpotOrders:tx_gas = 120_000 + N x 68_000MsgBatchCreateDerivativeLimitOrders:tx_gas = 120_000 + N x 213_000MsgBatchCancelDerivativeOrders:tx_gas = 120_000 + N x 83_000MsgBatchCancelBinaryOptionsOrders:tx_gas = 120_000 + N x 83_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)
1_269_000 gas.