fix(bridge): migrate L1 deposits and quotes from deprecated Mailbox to Bridgehub#121
Open
DrVelvetFog wants to merge 2 commits into
Open
fix(bridge): migrate L1 deposits and quotes from deprecated Mailbox to Bridgehub#121DrVelvetFog wants to merge 2 commits into
DrVelvetFog wants to merge 2 commits into
Conversation
ZKsync has deprecated Mailbox.requestL2Transaction (and its l2TransactionBaseCost quoting) in favor of the Bridgehub, with the legacy entry points scheduled to stop working around mid-September. This routes L1Bridge deposits through Bridgehub.requestL2TransactionDirect and sources base-cost quotes from Bridgehub.l2TransactionBaseCost, scoped by the new L2_CHAIN_ID immutable. The Mailbox (Diamond proxy) stays for the L2->L1 proof paths (proveL1ToL2TransactionStatus / proveL2MessageInclusion), which are not deprecated. External function signatures are unchanged; the constructor gains _bridgehub and _l2ChainId, so this ships as a new deployment rather than an upgrade (cutover notes in the PR). - src/bridge/L1Bridge.sol: Bridgehub routing for deposit + quotes, mintValue = msg.value per the Bridgehub's ETH-chain invariant - test: new MockBridgehub (mirrors the MockMailbox not-inheriting pattern); MockMailbox trimmed to the proof paths; new coverage for request-field mapping and zero-bridgehub / zero-chain-id constructor guards (26 bridge tests, full suite 1080 green) - script/DeployL1Bridge.s.sol + ops/deploy_L1L2_bridge.sh: BRIDGEHUB and L2_CHAIN_ID env vars Closes NodleCode#104 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Coverage job's 'Report coverage to PR' step fails on pull requests from forks with 'Resource not accessible by integration': GitHub caps GITHUB_TOKEN at read-only for fork-triggered pull_request runs, so the sticky comment can never be posted (same-repo PRs are unaffected and keep the comment). Gate the step on the head repo being this repo; the coverage run, artifact upload, and threshold check still execute for fork PRs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Follows up on my scoping comment in #104 — with the deprecation cutoff roughly ten weeks out I figured a concrete PR beats a plan, same as #120. Happy to rework any of it to your preferences.
What this does
Routes the two deprecated Mailbox surfaces through the Bridgehub, exactly as scoped in #104:
deposit()now callsBridgehub.requestL2TransactionDirectwith anL2TransactionRequestDirect(chainId = L2_CHAIN_ID,mintValue = msg.value— the Bridgehub requires them equal for ETH-based chains, verified against the pinnedera-contractssubmodule; refund-recipient aliasing is handled inside the Bridgehub viaactualRefundRecipient, matching the old Mailbox behavior).quoteL2BaseCost/quoteL2BaseCostAtGasPricenow source fromBridgehub.l2TransactionBaseCost, scoped by chain id.proveL1ToL2TransactionStatus,proveL2MessageInclusion) — those aren't deprecated, soclaimFailedDepositandfinalizeWithdrawalare untouched.External function signatures are unchanged; existing integrators of
deposit/quote calls see the same ABI.Deployment / cutover notes (the part that needs your eyes most)
L1_MAILBOXwas an immutable on a non-proxy contract, so this ships as a new deployment, not an upgrade:_bridgehuband_l2ChainId(zero-checked).DeployL1Bridge.s.solandops/deploy_L1L2_bridge.shnow expectBRIDGEHUBandL2_CHAIN_IDenv vars.MINTER_ROLEon L1 NODL (the deploy script already grants it).depositAmount/isWithdrawalFinalizedstate stays valid, and since its proof paths aren't deprecated it can continue servingclaimFailedDepositandfinalizeWithdrawalfor anything initiated before the cutover. Only new deposits need to move to the new address.deposit) is your ops call — the contract change deliberately doesn't assume an answer.Testing
MockBridgehubin the test suite (same "not inheriting the interface on purpose" pattern as the existingMockMailbox, including mirroring the real Bridgehub'smsg.value == mintValuerevert);MockMailboxtrimmed to the proof paths it still serves.L2TransactionRequestDirect(chain id, mintValue, target, gas params, canonical hash return), and constructor guards for zero Bridgehub / zero chain id.forge test: bridge suite 26/26, full repo suite 1080/1080 across 45 suites.yarn lint(solhint): no errors, no new warnings on touched files.yarn spellcheck: clean (addedBridgehubcasings to.cspell.json, same as docs(readme): add manual on-chain grant claim guide #120 did forzkclient).One judgment call to flag: I left
quoteL2BaseCost'stx.gaspriceconvenience semantics exactly as they were rather than "improving" anything while migrating — this PR only swaps the transport. If you'd rather the quote helpers change shape while the constructor is breaking anyway, glad to fold that in.Closes #104
CI note: the second commit (
ci: skip coverage PR comment for fork PRs) fixes the Coverage job failing on fork PRs — the report-lcov comment step can never post with the read-only forkGITHUB_TOKEN(Resource not accessible by integration); same-repo PRs like #118/#113 are unaffected and keep the sticky comment. It is deliberately a separate commit so you can drop it if you would rather handle CI differently.