How to handle and verify incoming interchain messages with Hyperlane’s Mailbox contract
Mailbox.process()
.
This function takes as parameters the message to deliver, as well as arbitrary metadata that can be specified by the relayer.
The Mailbox
will pass the message and metadata to the recipient’s Interchain Security Module (ISM) for verification. If the ISM successfully verifies the message, the Mailbox
delivers the message to the recipient by calling recipient.handle()
.
Message.sol
for more details on Hyperlane message encodingMailbox
contract when a message is received.
origin
: Domain of origin chainsender
: Address of sender on origin chain as bytes32messageBody
: Raw bytes content of message bodybytes32
for compatibility with virtual machines that are addressed differently. The following utility is provided in the TypeCasts
library for convenience.handle
function should be restricted to the Mailbox address if the contract should only accept calls from interchain messages.
The following utility is provided in the MailboxClient
library for convenience.
handle
.
defaultIsm
function.