LayerZero Endpoint
Messages in LayerZero are sent and received by LayerZero Endpoints, which handle message transmission, verification, and receipt; these endpoints consist of two components: a collection of versioned messaging libraries, and a proxy to route messages to the correct library version. When a message arrives at an endpoint, the endpoint selects the User Application configured library version to handle the message. The endpoint keeps all message states across versions and this allows libraries to be easily upgraded for fixes or optimizations.
Messaging Library Versioning
UAs can specify a particular messaging library version to tightly control messaging behaviors, or alternatively specify DEFAULT_VERSION
to take advantage of library auto-upgrade. Note that the library versions on the send()
and lzReceive()
sides must be the same for an INFLIGHT
message to be delivered. Ultra-Light Node is the V1 of messaging libraries.
interface ILayerZeroEndpoint.sol
// @notice set the send() LayerZero messaging library version to _version
// @param _version - new messaging library version
function setSendVersion(uint16 _version) external;
// @notice set the lzReceive() LayerZero messaging library version to _version
// @param _version - new messaging library version
function setReceiveVersion(uint16 _version) external;
// @notice get the send() LayerZero messaging library version
// @param _userApplication - the contract address of the user application
function getSendVersion(address _userApplication) external view returns (uint16);
// @notice get the lzReceive() LayerZero messaging library version
// @param _userApplication - the contract address of the user application
function getReceiveVersion(address _userApplication) external view returns (uint16)