Skip to content

basic version#2076

Open
kelemeno wants to merge 14 commits intokl/anvil-testing-interopfrom
kl/bzzk
Open

basic version#2076
kelemeno wants to merge 14 commits intokl/anvil-testing-interopfrom
kl/bzzk

Conversation

@kelemeno
Copy link
Contributor

What ❔

Why ❔

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3b500eb7d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +17 to +21
function initialize(uint256 _l1ChainId, bytes32 _baseTokenAssetId, address _ntv) external {
L1_CHAIN_ID = _l1ChainId;
BASE_TOKEN_ASSET_ID = _baseTokenAssetId;
_privateNtv = _ntv;
}

Choose a reason for hiding this comment

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

P1 Badge Prevent re-initializing the private asset tracker

initialize is fully unrestricted and can be called repeatedly, so any account can overwrite _privateNtv after deployment; because the inherited bridge-accounting entry points are gated by _nativeTokenVaultAddress(), an attacker can repoint the vault to themselves and then call privileged tracking functions (e.g. finalize/initiate bridging handlers), corrupting balances and migration state on any deployed private stack.

Useful? React with 👍 / 👎.

Comment on lines +74 to +77
L2_TO_L1_MESSENGER_SYSTEM_CONTRACT.sendToL1(
abi.encodePacked(PRIVATE_BUNDLE_IDENTIFIER, keccak256(_interopBundleBytes), _callCount)
);
return bytes32(0);

Choose a reason for hiding this comment

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

P2 Badge Return the real L2->L1 message hash for private bundles

_sendBundleToL1 sends the message but always returns bytes32(0), so InteropBundleSent will emit a zero l2l1MsgHash for every private bundle; downstream tooling and tests that rely on this hash to correlate bundle events with messenger inclusion data cannot do so reliably.

Useful? React with 👍 / 👎.

Comment on lines +65 to +67
) internal override {
// No base-token value collection for private interop.
}

Choose a reason for hiding this comment

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

P2 Badge Enforce msg.value accounting in private sendBundle flow

This override removes _ensureCorrectTotalValue entirely, so private sendBundle accepts arbitrary msg.value without validation or accounting; callers can accidentally lock ETH in the contract (no corresponding fee balance is credited), and existing contract balance can be unintentionally used to fund later indirect-call message values when users underpay.

Useful? React with 👍 / 👎.

@kelemeno kelemeno requested a review from Deniallugo as a code owner March 19, 2026 10:29
@github-actions
Copy link
Contributor

Coverage after merging kl/bzzk into kl/anvil-testing-interop will be

89.83%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
contracts/bridge
   BridgeHelper.sol100%100%100%100%
   BridgedStandardERC20.sol96.25%100%92.31%97.01%231–232
   L1ERC20Bridge.sol97.78%100%100%97.30%267
   L1Nullifier.sol96.12%100%100%95.40%446–447, 450, 476, 729, 732, 734, 750
   UpgradeableBeaconDeployer.sol100%100%100%100%
contracts/bridge/asset-router
   AssetRouterBase.sol98.59%100%100%98.28%132
   L1AssetRouter.sol91.62%100%86.67%92.70%116, 331, 342, 424–425, 444, 602, 613, 627, 632
contracts/bridge/asset-tracker
   AssetTrackerBase.sol93.33%100%88.89%95.24%88
   GWAssetTracker.sol92.11%100%92.50%92.05%135–137, 158, 208–210, 212–214, 219–220, 348–350, 356, 369, 504, 694
   L1AssetTracker.sol91.75%100%100%90.61%113, 131–132, 145, 150, 162, 326, 328–329, 332, 566, 573, 579, 585, 591, 619, 84
   LegacySharedBridgeAddresses.sol100%100%100%100%
contracts/bridge/interfaces
   AssetHandlerModifiers.sol75%100%100%66.67%13
contracts/bridge/ntv
   L1NativeTokenVault.sol98.17%100%100%97.70%191, 193
   NativeTokenVaultBase.sol98.94%100%100%98.73%164, 170
contracts/common
   MessageVerification.sol87.50%100%87.50%87.50%35, 42–43
   ReentrancyGuard.sol100%100%100%100%
contracts/common/l2-helpers
   L2ContractHelper.sol98.11%100%100%97.78%102
   SystemContractsCaller.sol52.50%100%60%51.43%42–43, 45, 47, 49, 51, 64, 67, 70, 73, 76, 81, 87, 89, 91, 94, 96
contracts/common/libraries
   DataEncoding.sol95.90%100%95.83%95.92%193, 283, 301, 307
   DynamicIncrementalMerkle.sol100%100%100%100%
   DynamicIncrementalMerkleMemory.sol98.96%100%100%98.84%196
   FullMerkle.sol98.28%100%100%98.11%109
   FullMerkleMemory.sol93.81%100%100%93.33%114, 131, 149, 163, 194, 90
   Merkle.sol100%100%100%100%
   MessageHashing.sol98.67%100%100%98.46%154
   SemVer.sol100%100%100%100%
   UncheckedMath.sol100%100%100%100%
   UnsafeBytes.sol100%100%100%100%
   ZKSyncOSBytecodeInfo.sol100%100%100%100%
contracts/common/libraries/TransientPrimitives
   TransientPrimitives.sol100%100%100%100%
contracts/core/bridgehub
   BridgehubBase.sol96.86%100%100%96.23%155, 304, 320, 580, 584, 587
   L1Bridgehub.sol91.92%100%100%90.91%137, 218, 293, 297–298, 301, 311, 96
   L2Bridgehub.sol66.67%100%60%68.57%102–103, 111, 113–114, 123, 128–129, 131–132, 75
contracts/core/chain-asset-handler
   ChainAssetHandlerBase.sol85.86%100%92.31%84.88%114, 121–122, 140–142, 191, 194, 203–204, 340, 344, 366
   L1ChainAssetHandler.sol88.07%100%82.35%89.13%182, 271, 273–275, 314, 87–88, 92–93
   L2ChainAssetHandler.sol84.21%100%80%85.71%120, 124, 69, 93
contracts/core/chain-registration
   ChainRegistrationSender.sol89.13%100%100%86.84%104, 127, 47, 94, 98
contracts/core/ctm-deployment
   CTMDeploymentTracker.sol100%100%100%100%
contracts/core/message-root
   L1MessageRoot.sol95.24%100%91.67%96.08%170–171
   L2MessageRoot.sol62.22%100%45.45%67.65%109, 116, 120–121, 42–43, 52–53, 57, 64, 80
   MessageRootBase.sol90%100%94.12%89.16%110, 130, 134, 211, 282, 301, 345, 353–354
contracts/governance
   AccessControlRestriction.sol100%100%100%100%
   ChainAdmin.sol97.87%100%100%97.30%44
   ChainAdminOwnable.sol100%100%100%100%
   Governance.sol100%100%100%100%
   L2ProxyAdminDeployer.sol100%100%100%100%
   PermanentRestriction.sol100%100%100%100%
   ServerNotifier.sol100%100%100%100%
   TransitionaryOwner.sol100%100%100%100%
contracts/governance/restriction
   Restriction.sol100%100%100%100%
   RestrictionValidator.sol100%100%100%100%
contracts/interop
   AttributesDecoder.sol100%100%100%100%
   InteropCenter.sol94.02%100%90.91%94.50%121–122, 143, 187–188, 627, 710–712, 717–718, 720
   InteropDataEncoding.sol100%100%100%100%
   InteropHandler.sol79.25%100%80.95%78.99%279, 281, 383, 405, 410, 483, 496, 503–504, 507–508, 511, 516, 520, 524, 526–527, 530–531, 533, 535, 542–543, 547, 551–553, 555, 67
   L2InteropRootStorage.sol0%100%0%0%20–22, 41, 46, 52–53, 58, 60–62, 71, 73–74, 76–77, 81–82, 86, 88
   L2MessageVerification.sol100%100%100%100%
   PrivateInteropCenter.sol0%100%0%0%100, 28, 35, 37–38, 40–41, 43–46, 51–52, 55–56, 59–60, 64–65, 69, 81, 86–89, 92, 96–97
   PrivateInteropHandler.sol0%100%0%0%20–23, 26–27, 30–31, 35–37, 43–45
   ShadowAccount.sol0%100%0%0%100–101, 104, 59–61, 63–65, 76, 81–82, 84–85, 88–93, 95, 98
contracts/l2-system
   BaseTokenHolder.sol100%100%100%100%
   L2BaseTokenBase.sol100%100%100%100%
contracts/l2-system/era
   L2BaseTokenEra.sol100%100%100%100%
contracts/l2-system/zksync-os
   L1MessageGasLib.sol100%100%100%100%
   L1MessengerZKOS.sol94.12%100%100%92.86%29
   L2BaseTokenZKOS.sol100%100%100%100%
   SystemContext.sol100%100%100%100%
   ZKOSContractDeployer.sol0%100%0%0%15–17, 23, 29, 33–34
contracts/l2-upgrades
   L2ComplexUpgrader.sol0%100%0%0%23–25, 39, 44, 46, 56, 62–63, 70, 79–81, 84, 86–87
   L2GenesisForceDeploymentsHelper.sol93.83%100%100%93.29%120, 153, 199, 201, 205, 207–208, 238, 244, 463
   L2GenesisUpgrade.sol0%100%0%0%30, 37, 39–40, 43, 47–50, 53, 55, 63
   L2V30TestnetSystemProxiesUpgrade.sol0%100%0%0%101, 107, 30, 35–36, 38, 49, 55, 60, 64, 69, 74, 79, 84, 89, 94
   L2V31Upgrade.sol0%100%0%0%17–18, 23, 26
   

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant