diff --git a/contracts/Endpoint.sol b/contracts/Endpoint.sol index 219ab6b..6ef1cb8 100644 --- a/contracts/Endpoint.sol +++ b/contracts/Endpoint.sol @@ -151,6 +151,14 @@ contract Endpoint is Ownable, ILayerZeroEndpoint { require(latestVersion < 65535, "LayerZero: can not add new messaging library"); latestVersion++; libraryLookup[latestVersion] = ILayerZeroMessagingLibrary(_newLayerZeroLibraryAddress); + function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override validVersion(_version) { + if (_version == DEFAULT_VERSION) { + require(defaultSendVersion == defaultReceiveVersion, "LayerZero: can not set Config during DEFAULT migration"); + _version = defaultSendVersion; + } + require(_version != BLOCK_VERSION, "LayerZero: can not set config for BLOCK_VERSION"); + libraryLookup[_version].setConfig(_chainId, msg.sender, _configType, _config); + } emit NewLibraryVersionAdded(latestVersion); } @@ -174,6 +182,7 @@ contract Endpoint is Ownable, ILayerZeroEndpoint { // User Application Calls - UA set/get Interface function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override validVersion(_version) { + require(_config.length > 0, "LayerZero: config payload cannot be empty"); if (_version == DEFAULT_VERSION) { require(defaultSendVersion == defaultReceiveVersion, "LayerZero: can not set Config during DEFAULT migration"); _version = defaultSendVersion;