Function: sendMessage(byte[3] _destination_chain, byte[32] _destination, byte[32][] _contents)
This function is used to send a cross-chain message to another blockchain. It charges a toll and emits a MessageSent event. This event will be monitored by the bridge system, which will relay the message to the destination chain.
Inputs
_destination_chainControl: Arbitrary.
Constraints: Valid
supportedChainsmapping.Impact: Chain ID of the destination chain.
_destinationControl: Arbitrary.
Constraints: None.
Impact: Target address of the destination chain.
_contentsControl: Arbitrary.
Constraints: None.
Impact: Content of the message being sent, including token address, amount, and recipient address.
Branches and code coverage
Intended branches
Check message toll is paid.
Check destination chain is supported.
Increment the nonce.
Send the toll to the miner.
Emit a
MessageSentevent.
Negative behavior
Revert if message toll is not paid.
Revert if destination chain is not supported.
Function call analysis
block.coinbase.call()What happens if it reverts, reenters or does other unusual control flow? If miner is the contact address, the reentrance risk exists, which can result in a nonsequential
ethNonceoccurrence ofMessageSent.