Omniscia Evergon Labs Audit
LZChainidMapping Manual Review Findings
LZChainidMapping Manual Review Findings
LZC-01M: Potentially Unsupported LayerZero EIDs
| Type | Severity | Location |
|---|---|---|
| Standard Conformity | ![]() | LZChainidMapping.sol:L10, L42 |
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:
6/**7 * @title LZChainidMapping8 * @notice Contract to manage mappings between chain id and LZ eid for cross-chain communication9 * @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-contracts11 */12abstract contract LZChainidMapping is Ownable {13 /// @dev Error thrown when chain id does not have a set LZ eid14 error UnknownChainByChainid(uint32 chainId);15
16 /// @dev Error thrown when LZ eid does not have a registered chain id17 error UnknownChainByEID(uint32 eid);18
19 /// @dev Error thrown when chain id or LZ eid is zero20 error WrongChainIdentifier();21
22 /// @dev Error thrown when chain id or LZ eid are already registered23 error ChainMappingAlreadyExists();24
25 /// @notice Event emitted when a chain id and LZ eid are registered26 event ChainMappingAdded(uint32 chainId, uint32 eid);27
28 /// @notice Event emitted when a chain id and LZ eid are removed29 event ChainMappingRemoved(uint32 chainId);30
31 /// @dev Mapping of chain id to LZ eid32 mapping(uint32 chainId => uint32 eid) private _c2e;33
34 /// @dev Mapping of LZ eid to chain id35 mapping(uint32 eid => uint32 chainId) private _e2c;36
37 /**38 * @notice Adds a chain id and LZ eid mapping39 * @param chainId Chain id to map40 * @param eid LZ eid to map41 */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.
