background
logo

Security Audit Report for Morph Emerald upgrade

项目简介

The target of this audit is the code repositories ([1], [2]) of Morph Emerald upgrade.

The Morph Emerald upgrade introduces alternative fee transactions (i.e., AltFeeTx), enabling native multi-token gas payments on the Morph L2 chain. This upgrade allows users to pay gas fees using registered ERC-20 tokens. Specifically, this feature is enabled through the introduction of the L2TokenRegistry contract and corresponding modifications to the Geth codebase. The L2TokenRegistry contract allows managers to register fee tokens and update their associated parameters (e.g., token scale and exchange rate). On the Geth side, the project defines the AltFeeTx transaction type with two key parameters (i.e., FeeTokenID and FeeLimit) and implements the corresponding handling logic, including transaction creation, fee calculation, and fee transfer. Notably, the token information used during transaction processing is fetched directly from the L2TokenRegistry contract. In addition, the Emerald upgrade synchronizes recent Ethereum mainnet updates by introducing new precompiles and opcodes (e.g., CLZ).

Please refer to the report for the detailed audit scope.

Our audit methodology employs automated vulnerability scans, manual verification, and business logic analysis to uncover potential security issues coupled with gas and code quality optimization recommendations.

In summary, we have found that the codebase contains 1 high-risk issues that require prompt attention. In addition, we have identified other non-critical issues as well as security suggestions that should be considered. The Morph Emerald upgrade team has addressed these issues promptly. It is important to note that our audit covers only the final reported versions of the codebase. Any subsequent updates would require a re-evaluation.

关键发现

我们在该智能合约中共发现 4 个潜在问题,另有 7 条建议与 4 条说明,明细如下:

高风险:1
中风险:1
低风险:2
建议:7
说明:4
ID Severity Description Status
1 High Incorrect access control logic in the modifier onlyAllowed Fixed
2 Medium Inconsistent updates of the price ratio and token scale Fixed
3 Low Lack of the value assignment for FeeLimit in the CallArgs construction Fixed
4 Low The misleading return value of the function getTokenInfo() Fixed
5 - Revise the unused function Filter() Confirmed
6 - Remove redundant code Fixed
7 - Add non-zero checks Fixed
8 - Revise the improper error in the function calculateTokenAmount() Fixed
9 - Revise typos and improper annotations Fixed
10 - Unify the existence checks for the balance slot Fixed
11 - Use different custom errors for different revert conditions Fixed
12 - Ensure the correctness of fee tokens -
13 - Potential centralization risks -
14 - Openzeppelin upgrade migration risks -
15 - Correct handling of the fee tokens in the contract L2TxFeeVault -

更多细节见审计报告

迈出走向安全的第一步

立即联系我们,获取 BlockSec 的专业代码审计服务,在协议上线之前把安全性提上来!