Assessment reports>Y2K Finance>Discussion>LayerZero configuration

LayerZero configuration

We recommend implementing a set of functions that enable the configuration of a generic LayerZero user application in both the ZapFrom and ZapDest contracts.

// @notice set the send() LayerZero messaging library version to _version
// @param _version - new messaging library version
function setSendVersion(uint16 _version) external override onlyOwner {
    lzEndpoint.setSendVersion(_version);
}

// @notice set the lzReceive() LayerZero messaging library version to _version
// @param _version - new messaging library version
function setReceiveVersion(uint16 _version) external override onlyOwner {
    lzEndpoint.setReceiveVersion(_version);
}

// @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload
// @param _srcChainId - the chainId of the source chain
// @param _srcAddress - the contract address of the source contract at the source chain
function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {
    lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);

function getConfig(
    uint16 _version,
    uint16 _chainId,
    address,
    uint _configType
) external view returns (bytes memory) {
    return lzEndpoint.getConfig(_version, _chainId, address(this), _configType);
}

// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
// @param _chainId - the chainId for the pending config change
// @param _configType - type of configuration. every messaging library has its own convention.
// @param _config - configuration in the bytes. can encode arbitrary content.
function setConfig(
    uint16 _version,
    uint16 _chainId,
    uint _configType,
    bytes calldata _config
) external override onlyOwner {
    lzEndpoint.setConfig(_version, _chainId, _configType, _config);
}

This issue has been acknowledged by Y2K Finance, and fixes were implemented in the following commits:

Zellic © 2024Back to top ↑