node
node copied to clipboard
Research optimal values for the inbound execution gas limit
Research optimal values.
In the context of cross-chain transactions processing there are different notions and usages for gas and gas limit. This document tries to clarify the different usage.
There are two distinct gas limit used when a DepositAndCall CCTX is observed:
- Cosmos gas limit: used for the
MsgVoteInboundCosmos message that executes the inbound after the last vote- 7M is currently used
- EVM gas limit: used during the
MsgVoteInboundexecution for the GatewaydepositAndCallinternal evm function- 1.5M is currently used
IMPORTANT
- Cosmos and EVM gas limit are different, the way the consumption is calculated is different, the consumed gas in the
depositAndCallwill influence the consumed gas of the Cosmos tx but not on a equivalent basis. (1.5M consumed gas indepositAndCallwill not consume 1.5M gas inMsgVoteInbound, it will actually consume more) - Out-of-gas error in the
MsgVoteInboundblocks completely the CCTX, because vote can’t be finalized, it can’t even be reverted, funds are stuck in the tss/custody until a fix or the used gas limit is increased - Out-of-gas error in
depositAndCallwill make the deposit fail and trigger a revert, this out-of-gas will not blockMsgVoteInboundfrom executing, it is sandboxed inside the message execution
PROBLEM
- EVM gas limit too low reduce DevEx by limiting what can be executed in cctx calls. Calls consuming too much gas reverts
- Increasing EVM gas limit:
- Allow devs to consume more gas for the
MsgVoteInbound, which can contribute to network congestion (requires triggering a lot of deposits) - If the EVM gas limit is increased too much, it can reach a point where it is possible to have a out-of-gas issue for
MsgVoteInboundand have stuck CCTXs because of this. Cosmos gas limit should be increased alongside the EVM gas limit
- Allow devs to consume more gas for the
- Increasing Cosmos gas limit:
- Increase possibility of congestion because more gas are consumed in the blocks where inbounds are executed. In Cosmos gas, a part of the gas limit is consumed independently of the tx execution and consumption (unlike EVM)
A good balance should be fine to have good gas limit for devs, avoid stuck CCTXs and reduce gas used in Cosmos blocks