N-10: remove unused constant and modifiers#2126
Open
valera-grinenko-ai wants to merge 1 commit intomatter-labs:draft-v31from
Open
N-10: remove unused constant and modifiers#2126valera-grinenko-ai wants to merge 1 commit intomatter-labs:draft-v31from
valera-grinenko-ai wants to merge 1 commit intomatter-labs:draft-v31from
Conversation
- Remove unused INTEROP_BALANCE_CHANGE_VERSION constant from IAssetTrackerBase.sol (zero references in codebase) - Remove unused onlyCallFromBootloaderOrInteropHandler and onlyCallFromInteropCenterOrNTV modifiers from SystemContractBase.sol (zero references in codebase), along with their now-unused imports - Move _sendL1ToGatewayMigrationDataToL1 from AssetTrackerBase to L2AssetTracker (its only caller) - Move _sendGatewayToL1MigrationDataToL1 from AssetTrackerBase to GWAssetTracker (its only caller) - Clean up now-unused imports in AssetTrackerBase receive() in BaseTokenHolder is NOT removed: it is used on ZK OS chains during L2BaseTokenZKOS.initL2() which sends ETH via Address.sendValue. The audit claim only considered the Era path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
028d939 to
ad73597
Compare
Collaborator
StanislavBreadless
left a comment
There was a problem hiding this comment.
The following is missing:
The [SAVED_TOTAL_SUPPLY](https://github.com/matter-labs/era-contracts/blob/4271d0a37d64c43697781fa272d53e6b9c9f401c/l1-contracts/contracts/bridge/asset-tracker/IAssetTrackerBase.sol#L10) struct is defined within the base contract's interface while it is only used within the L2AssetTracker contract. Additionally, there seems to be no actual need for this struct since the [bool isSaved](https://github.com/matter-labs/era-contracts/blob/84e5c59386b6b324d6547c9ad551e43f9a22fc93/l1-contracts/contracts/bridge/asset-tracker/IAssetTrackerBase.sol#L11) field is never used, since [isAssetRegistered](https://github.com/matter-labs/era-contracts/blob/4271d0a37d64c43697781fa272d53e6b9c9f401c/l1-contracts/contracts/bridge/asset-tracker/IAssetTrackerBase.sol#L24) is used for all the checks instead.
And this one:
In _finalizeBridgeBurn, [_recordMigrationToSL](https://github.com/matter-labs/era-contracts/blob/4271d0a37d64c43697781fa272d53e6b9c9f401c/l1-contracts/contracts/core/chain-asset-handler/ChainAssetHandlerBase.sol#L254) is conditionally called only when block.chainId equals L1, but this check is redundant since _recordMigrationToSL is only implemented in L1ChainAssetHandler.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addressed
INTEROP_BALANCE_CHANGE_VERSIONconstant fromIAssetTrackerBase.sol(zero references in codebase)onlyCallFromBootloaderOrInteropHandlerandonlyCallFromInteropCenterOrNTVmodifiers fromSystemContractBase.sol(zero references), along with their now-unused imports_sendL1ToGatewayMigrationDataToL1fromAssetTrackerBasetoL2AssetTracker(its only caller)_sendGatewayToL1MigrationDataToL1fromAssetTrackerBasetoGWAssetTracker(its only caller)AssetTrackerBaseSkipped
SAVED_TOTAL_SUPPLY/isSavedfield: actively used inL2AssetTracker.sol:119— audit claim is incorrectFinalizeDepositParams,IBridgehubBase,MigrationConfirmationData): claims don't hold for current code — these symbols are either directly used in contract bodies or no longer presentreceive()inBaseTokenHolder: used on ZK OS chains duringL2BaseTokenZKOS.initL2()which sends ETH viaAddress.sendValue— audit only considered the Era path where balance is set via storage_finalizeBridgeBurn: defense-in-depth; theblock.chainid == _l1ChainId()guard makes the L1-only intent explicit at the call site even though_recordMigrationToSLis only implemented on L1Test plan
forge buildpasses for both l1-contracts and system-contracts🤖 Generated with Claude Code