Message Receiver Adapters

The receiver adapter uses the ERC-2771 standard to forward the message to MultiBridgeMessageReceiver .

IMessageReceiverAdapter

The IMessageReceiverAdapter interface extends the MessageExecutor interface defined below. It defines the following additional functions.

updateSenderAdapter

Updates the address of the corresponding IMessageSenderAdapter contract for this bridge on the source chain.

function updateSenderAdapter(address _senderAdapter) external

name

This function returns the name of the message bridge.

function name() external view returns (string memory);

The interface defines the following event:

SenderAdapterUpdated

Emitted when the sender adapter address is updated through the updateSenderAdapter() function.

event SenderAdapterUpdated(address indexed oldSenderAdapter, address indexed newSenderAdapter);

MessageExecutor

The interface defines the following event:

MessageIdExecuted

This event is emitted when a message or message batch has been executed.

event MessageIdExecuted(uint256 indexed fromChainId, bytes32 indexed messageId);

The interface defines the following error types.

MessageIdAlreadyExecuted

Is thrown if a messageId has already been executed.

error MessageIdAlreadyExecuted(bytes32 messageId);

MessageFailure

Is thrown if the execution of an individual message fails.

error MessageFailure(bytes32 messageId, bytes errorData);

MessageBatchFailure

Is thrown if the execution of a batch of messages fails. (not currently used)

error MessageBatchFailure(bytes32 messageId, uint256 messageIndex, bytes errorData);

Most importantly

MessageExecutor MUST append the ABI-packed (messageId, fromChainId, from) to the calldata for each message being executed. This allows the receiver of the message to verify the cross-chain sender and the chain that the message is coming from.

  • to.call(abi.encodePacked(data, messageId, fromChainId, from));

The contract which the executor calls (to) MUST be ExecutorAware. The ExecutorAware contract allows contracts on a receiving chain to execute messages from an origin chain. These messages are sent by the MessageDispatcher contract which live on the origin chain. The MessageExecutor contract on the receiving chain executes these messages and then forward them to an ExecutorAware contract on the receiving chain.

Last updated