node icon indicating copy to clipboard operation
node copied to clipboard

Research optimal values for the inbound execution gas limit

Open lumtis opened this issue 4 months ago • 0 comments

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 MsgVoteInbound Cosmos message that executes the inbound after the last vote
    • 7M is currently used
  • EVM gas limit: used during the MsgVoteInbound execution for the Gateway depositAndCall internal 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 depositAndCall will influence the consumed gas of the Cosmos tx but not on a equivalent basis. (1.5M consumed gas in depositAndCall will not consume 1.5M gas in MsgVoteInbound, it will actually consume more)
  • Out-of-gas error in the MsgVoteInbound blocks 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 depositAndCall will make the deposit fail and trigger a revert, this out-of-gas will not block MsgVoteInbound from 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 MsgVoteInbound and have stuck CCTXs because of this. Cosmos gas limit should be increased alongside the EVM gas limit
  • 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

lumtis avatar Sep 04 '25 07:09 lumtis