Omniscia Evergon Labs Audit

LZChainidMapping Manual Review Findings

LZChainidMapping Manual Review Findings

LZC-01M: Potentially Unsupported LayerZero EIDs

Description:

The LZChainidMapping::addChainMapping is meant to associate a chain ID with its EID and vice-versa, however, the resource referenced for the LayerZero EID list contains EIDs that are greater than type(uint32).max and would thus not be supported in the system.

Impact:

The severity of this exhibit will be re-assessed once a remediative action has been carried out by the Evergon Labs team.

Example:

contracts/utils/LZChainidMapping.sol
6/**
7 * @title LZChainidMapping
8 * @notice Contract to manage mappings between chain id and LZ eid for cross-chain communication
9 * @dev See chain id list on https://chainlist.org/
10 * See LZ eid list on https://docs.layerzero.network/v2/developers/evm/technical-reference/deployed-contracts
11 */
12abstract contract LZChainidMapping is Ownable {
13 /// @dev Error thrown when chain id does not have a set LZ eid
14 error UnknownChainByChainid(uint32 chainId);
15
16 /// @dev Error thrown when LZ eid does not have a registered chain id
17 error UnknownChainByEID(uint32 eid);
18
19 /// @dev Error thrown when chain id or LZ eid is zero
20 error WrongChainIdentifier();
21
22 /// @dev Error thrown when chain id or LZ eid are already registered
23 error ChainMappingAlreadyExists();
24
25 /// @notice Event emitted when a chain id and LZ eid are registered
26 event ChainMappingAdded(uint32 chainId, uint32 eid);
27
28 /// @notice Event emitted when a chain id and LZ eid are removed
29 event ChainMappingRemoved(uint32 chainId);
30
31 /// @dev Mapping of chain id to LZ eid
32 mapping(uint32 chainId => uint32 eid) private _c2e;
33
34 /// @dev Mapping of LZ eid to chain id
35 mapping(uint32 eid => uint32 chainId) private _e2c;
36
37 /**
38 * @notice Adds a chain id and LZ eid mapping
39 * @param chainId Chain id to map
40 * @param eid LZ eid to map
41 */
42 function addChainMapping(uint32 chainId, uint32 eid) external onlyOwner {
43 if (chainId == 0 || eid == 0) revert WrongChainIdentifier();
44 if (_c2e[chainId] != 0 || _e2c[eid] != 0) revert ChainMappingAlreadyExists();
45 _c2e[chainId] = eid;
46 _e2c[eid] = chainId;
47 emit ChainMappingAdded(chainId, eid);
48 }

Recommendation:

We advise the Evergon Labs team to confirm that those EIDs are explicitly not supported, and to properly document this caveat in the codebase of the LZChainidMapping.

Alternatively, we advise the data type associated with EIDs to be increased, ensuring that all types of EIDs are supported.

Alleviation (c6b23c23d8bcd8cce85049ad959cbd711a37126b):

After discussing with the Evergon Labs team, we concluded that the EID we observed have since been removed from the LayerZero website and as such this finding is inapplicable.