Unordered Messages

Send unordered messages

By default Earlybird endpoint sends messages in an ordered fashion. Ordered messages have nonces and those with lower nonces are delivered before those with higher nonces, in order. This is useful for some applications but there are also other use cases that do not need ordered messages. If your application is one of those, you can pass information that tells the protocol to send a message in an unordered fashion.

Deciding between ordered vs unordered messages is done on a per-message basis as part of the _additionalParams supplied to the protocol via when you call the sendMessage function. Here is a code example:

bool isOrderedMsg = false;
bytes memory additionalParams = abi.encode(
    defaultFeeToken, 
    isOrderedMsg,
    destinationGas    
);

IEndpointFunctionsForApps(endpoint).sendMessage{value: totalNativeTokenFee}(
    // supply the destination chain ID,
    // supply the encoded destionation address _dst,
    // supply the payload,
    additionalParams // the additionalParams with the isOrderedMsg set to false
);

Also, it is important to note that although the messages are unordered, the protocol guarantees that the messages are delivered to the destination at most once and there will never be duplicate deliveries of the same message.

Last updated