L-07: add missing input validations in Migrator and Mailbox#2121
Open
valera-grinenko-ai wants to merge 1 commit intomatter-labs:draft-v31from
Open
L-07: add missing input validations in Migrator and Mailbox#2121valera-grinenko-ai wants to merge 1 commit intomatter-labs:draft-v31from
valera-grinenko-ai wants to merge 1 commit intomatter-labs:draft-v31from
Conversation
1. In Migrator.forwardedBridgeMint, validate that isPermanentRollup cannot be reverted from true to false. A mismatch would indicate a malicious or faulty settlement layer. 2. In Mailbox.requestL2TransactionToGatewayMailboxWithBalanceChange, enforce _expirationTimestamp == 0 as documented in IMailboxImpl. The parameter is deprecated and all callers already pass 0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
StanislavBreadless
left a comment
There was a problem hiding this comment.
the following finding is missing:
In InteropCenter, the [forwardTransactionOnGatewayWithBalanceChange](https://github.com/matter-labs/era-contracts/blob/4271d0a37d64c43697781fa272d53e6b9c9f401c/l1-contracts/contracts/interop/InteropCenter.sol#L567) function [overwrites](https://github.com/matter-labs/era-contracts/blob/4271d0a37d64c43697781fa272d53e6b9c9f401c/l1-contracts/contracts/interop/InteropCenter.sol#L578) the balanceChange.baseTokenAssetId parameter with the value stored within the Bridgehub contract, without checking that the provided value is the expected one.
IMO we should not overwrite the value there at all. We may at best validate. This is an artifact from the time where mailbox did not populate this value.
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
Fixed
isPermanentRollupcannot be reverted fromtruetofalse— a mismatch would indicate a malicious or faulty settlement layer_expirationTimestamp == 0as documented in IMailboxImpl ("Deprecated, always 0"). All callers already pass 0Not fixed (intentional)
baseTokenAssetIdoverwrite at line 578 IS the safety mechanism — it ensures the correct on-chain value is always used regardless of caller input. Adding a pre-check (requirethat caller value matches) would defeat this purpose and could break legitimate flows where the caller hasn't determined the correct value yetTest plan
forge buildpassesforwardedBridgeMintreverts when trying to setisPermanentRollupfromtruetofalserequestL2TransactionToGatewayMailboxWithBalanceChangereverts with non-zero_expirationTimestamp🤖 Generated with Claude Code