Skip to content

Latest commit

 

History

History
119 lines (77 loc) · 10.2 KB

0xNazgul-Q.md

File metadata and controls

119 lines (77 loc) · 10.2 KB

[NAZ-L1] Missing Zero-address Validation

Severity: Low Context: DiamondInit.sol#L26-L28, Governance.sol#L15, Governance.sol#L45

Description: Lack of zero-address validation on address parameters may lead to transaction reverts, waste gas, require resubmission of transactions and may even force contract redeployments in certain cases within the protocol.

Recommendation: Consider adding explicit zero-address validation on input parameters of address type.

[NAZ-L2] Missing Events In Initialize Functions

Severity: Low Context: DiamondInit.sol#L25, L1ERC20Bridge.sol#L71, L1EthBridge.sol#L56

Description: None of the initialize functions emit emit init-specific events. They all however have the initializer modifier (from Initializable) so that they can be called only once. Off-chain monitoring of calls to these critical functions is not possible.

Recommendation: It is recommended to emit events in your initialization functions.

[NAZ-N1] Code Contains Empty Blocks

Severity: Informational Context: DiamondInit.sol#L15, L2StandardERC20.sol#L39

Description: It's best practice that when there is an empty block, to add a comment in the block explaining why it's empty.

Recommendation: Consider adding /* Comment on why */ to the empty blocks.

[NAZ-N2] Function && Variable Naming Convention

Severity Informational Context: Base.sol#L12, L2StandardERC20.sol#L29

Description: The linked variables do not conform to the standard naming convention of Solidity whereby functions and variable names(local and state) utilize the mixedCase format unless variables are declared as constant in which case they utilize the UPPER_CASE_WITH_UNDERSCORES format. Private variables and functions should lead with an _underscore.

Recommendation: Consider naming conventions utilized by the linked statements are adjusted to reflect the correct type of declaration according to the Solidity style guide.

[NAZ-N3] Code Structure Deviates From Best-Practice

Severity: Informational Context: Executor.sol#L152, Mailbox.sol#L89, Diamond.sol#L16, PriorityQueue.sol#L54, L1ERC20Bridge.sol#L179, L1EThBridge.sol#L132, AllowList.sol#L37, ReentrancyGuard.sol#L65, L2ERC20Bridge.sol#L87, L2StandardERC20.sol#L18

Description: The best-practice layout for a contract should follow the following order: state variables, events, modifiers, constructor and functions. Function ordering helps readers identify which functions they can call and find constructor and fallback functions easier. Functions should be grouped according to their visibility and ordered as: constructor, receive function (if exists), fallback function (if exists), external, public, internal, private. Functions should then further be ordered with view functions coming after the non-view labeled ones.

Recommendation: Consider adopting recommended best-practice for code structure and layout.

[NAZ-N4] Unindexed Event Parameters

Severity Informational Context: IExecutor.sol#L85, IMailbox.sol#L95, Diamond.sol#L16

Description: Parameters of certain events are expected to be indexed so that they’re included in the block’s bloom filter for faster access. Failure to do so might confuse off-chain tooling looking for such indexed events.

Recommendation: Consider adding the indexed keyword to event parameters that should include it.

[NAZ-N5] Use Underscores for Number Literals

Severity: Informational Context:

Description: There are multiple occasions where certain numbers have been hardcoded, either in variables or in the code itself. Large numbers can become hard to read.

Recommendation: Consider using underscores for number literals to improve its readability.

[NAZ-N6] TODOs Left In The Code

Severity: Informational Context: Config.sol#L28, Mailbox.sol#L94, Mailbox.sol#L127, Mailbox.sol#L169

Description: There should never be any TODOs in the code when deploying.

Recommendation: Consider finishing the TODOs before deploying.

[NAZ-N7] Spelling Errors

Severity: Informational Context: Storage.sol#L36 (addreses => addresses), Executor.sol#L264 (recurisive => recursive), Executor.sol#L289 (recurisive => recursive), Executor.sol#L296-L297 (recurisive => recursive), Executor.sol#L264 (recurisive => recursive), Executor.sol#L300-L301 (recurisive => recursive), Executor.sol#L304-L305 (recurisive => recursive), Executor.sol#L357 (Auxilary => Auxiliary), Executor.sol#L376 (Auxilary => Auxiliary), Diamond.sol#L63 (dellegate => delegate), Diamond.sol#L64 (delegete => delegate), IExecutor.sol#L58 (recurisive => recursive), L2StandardERC20.sol#L19 (refference => reference), L1ERC20Bridge.sol#L42 (decimls => decimals)

Description: Spelling errors in comments can cause confusion to both users and developers.

Recommendation: Consider checking all misspellings to ensure they are corrected.

[NAZ-N8] Floating Pragma

Severity: Informational Context: All Contracts

Description: Contracts should be deployed with the same compiler version and flags that they have been tested with thoroughly. Locking the pragma helps to ensure that contracts do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively.

Recommendation: Consider locking the pragma version.

[NAZ-N9] Older Version Pragma

Severity: Informational Context: All Contracts

Description: Using very old versions of Solidity prevents benefits of bug fixes and newer security checks. Using the latest versions might make contracts susceptible to undiscovered compiler bugs.

Recommendation: Consider using the most recent version.