Omniscia Dapp Radar Audit

LzApp Code Style Findings

LzApp Code Style Findings

LAP-01C: Inefficient mapping Lookups

TypeSeverityLocation
Gas OptimizationLzApp.sol:L26, L35, L38

Description:

The linked statements perform key-based lookup operations on mapping declarations from storage multiple times for the same key redundantly.

Example:

contracts/LZ/LzApp.sol
26require(_srcAddress.length == trustedRemoteLookup[_srcChainId].length && keccak256(_srcAddress) == keccak256(trustedRemoteLookup[_srcChainId]), "LzReceiver: invalid source sending contract");

Recommendation:

As the lookups internally perform an expensive keccak256 operation, we advise the lookups to be cached wherever possible to a single local declaration that either holds the value of the mapping in case of primitive types or holds a storage pointer to the struct contained.

Alleviation:

The Dapp Radar team considered this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.

LAP-02C: Inexistent Error Message

TypeSeverityLocation
Code StyleLzApp.sol:L24

Description:

The linked require check has no error message explicitly defined.

Example:

contracts/LZ/LzApp.sol
24require(_msgSender() == address(lzEndpoint));

Recommendation:

We advise one to be set so to increase the legibility of the codebase and aid in validating the require check's condition.

Alleviation:

The Dapp Radar team considered this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.