Skip to content

L-07: add missing input validations in Migrator and Mailbox#2121

Open
valera-grinenko-ai wants to merge 1 commit intomatter-labs:draft-v31from
valera-grinenko-ai:pr/L-07-missing-input-validation
Open

L-07: add missing input validations in Migrator and Mailbox#2121
valera-grinenko-ai wants to merge 1 commit intomatter-labs:draft-v31from
valera-grinenko-ai:pr/L-07-missing-input-validation

Conversation

@valera-grinenko-ai
Copy link
Copy Markdown

@valera-grinenko-ai valera-grinenko-ai commented Apr 7, 2026

Summary

Fixed

  • Migrator.forwardedBridgeMint: validates that isPermanentRollup cannot be reverted from true to false — a mismatch would indicate a malicious or faulty settlement layer
  • Mailbox.requestL2TransactionToGatewayMailboxWithBalanceChange: enforces _expirationTimestamp == 0 as documented in IMailboxImpl ("Deprecated, always 0"). All callers already pass 0

Not fixed (intentional)

  • InteropCenter.forwardTransactionOnGatewayWithBalanceChange: the baseTokenAssetId overwrite 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 (require that caller value matches) would defeat this purpose and could break legitimate flows where the caller hasn't determined the correct value yet

Test plan

  • Verify forge build passes
  • Confirm forwardedBridgeMint reverts when trying to set isPermanentRollup from true to false
  • Confirm requestL2TransactionToGatewayMailboxWithBalanceChange reverts with non-zero _expirationTimestamp
  • Confirm normal migration flows are unaffected

🤖 Generated with Claude Code

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>
Copy link
Copy Markdown
Collaborator

@StanislavBreadless StanislavBreadless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants