github.com/ethereum-optimism/optimism@v1.7.2/packages/contracts-bedrock/invariant-docs/CrossDomainMessenger.md (about) 1 # `CrossDomainMessenger` Invariants 2 3 ## A call to `relayMessage` should succeed if at least the minimum gas limit can be supplied to the target context, there is enough gas to complete execution of `relayMessage` after the target context's execution is finished, and the target context did not revert. 4 **Test:** [`CrossDomainMessenger.t.sol#L143`](../test/invariants/CrossDomainMessenger.t.sol#L143) 5 6 There are two minimum gas limits here: 7 - The outer min gas limit is for the call from the `OptimismPortal` to the `L1CrossDomainMessenger`, and it can be retrieved by calling the xdm's `baseGas` function with the `message` and inner limit. 8 - The inner min gas limit is for the call from the `L1CrossDomainMessenger` to the target contract. 9 10 ## A call to `relayMessage` should assign the message hash to the `failedMessages` mapping if not enough gas is supplied to forward `minGasLimit` to the target context or if there is not enough gas to complete execution of `relayMessage` after the target context's execution is finished. 11 **Test:** [`CrossDomainMessenger.t.sol#L176`](../test/invariants/CrossDomainMessenger.t.sol#L176) 12 13 There are two minimum gas limits here: 14 - The outer min gas limit is for the call from the `OptimismPortal` to the `L1CrossDomainMessenger`, and it can be retrieved by calling the xdm's `baseGas` function with the `message` and inner limit. 15 - The inner min gas limit is for the call from the `L1CrossDomainMessenger` to the target contract.