Skip to content

Conversation

kelemeno
Copy link
Contributor

@kelemeno kelemeno commented May 22, 2025

What ❔

Note: from V30 onwards, the Anvil debug options are integrated in draft branches, they should be removed before going to audit.

Anvil branch: #1625

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.

@kelemeno kelemeno changed the base branch from draft-v29 to draft-v30 June 20, 2025 08:42
Copy link
Collaborator

@nikitastupin-matterlabs nikitastupin-matterlabs left a comment

Choose a reason for hiding this comment

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

Some initial comments including 2 Critical access control vulnerabilities (if confirmed). #1552 is also a part of this. I'm going to continue tomorrow.

@kelemeno
Copy link
Contributor Author

kelemeno commented Jul 25, 2025

todo: add library to initiate token bridging, maybe @0xValera

Copy link
Collaborator

@nikitastupin-matterlabs nikitastupin-matterlabs left a comment

Choose a reason for hiding this comment

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

Leaving high-level review related to AssetTracker and #1544

@kelemeno
Copy link
Contributor Author

kelemeno commented Aug 18, 2025

#1544 (comment)

a reminder is that EN will have to check this value for correctness (not a blocker for audit, but a thing to remember)

uint256 msgCount = 0;
uint256 logsLength = _processLogsInputs.logs.length;
bytes32 baseTokenAssetId = _bridgehub().baseTokenAssetId(_processLogsInputs.chainId);
for (uint256 logCount = 0; logCount < logsLength; ++logCount) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

A malicious user can spam with L2 to L1 user logs thus preventing the chain from finalizing on the GW because this loop runs out of gas (due to the number of logs). A way to mitigate this is to limit the number of user logs per batch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Conceptually, each chain batch can fit into a gw batch, since the batches are the same size. We need to make sure there is no txs gas limit, that is true.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The cost profile at the moment is a bit different. Chains' logs typically dont need to get published in full to L1, but they do cause storage slot changes inside GWAT that do need to get published on L1...

kelemeno and others added 29 commits October 7, 2025 08:45
…kl-medium-interop

Additional comments for kl medium interop
delete received interop messages
Co-authored-by: 0xValera <[email protected]>
Co-authored-by: Stanislav Breadless <[email protected]>
Copy link

github-actions bot commented Oct 8, 2025

Coverage after merging kl/medium-interop into draft-v30 will be

78.30%

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.37%261
   L1Nullifier.sol88.27%100%86.67%88.55%128–129, 181, 190, 414–415, 418, 444, 629, 631, 675, 687, 690, 692, 705, 718–719, 723–724
contracts/bridge/asset-router
   AssetRouterBase.sol98.55%100%100%98.25%122
   L1AssetRouter.sol92.07%100%89.66%92.59%102, 314, 325, 407–408, 428, 586, 597, 611, 616
contracts/bridge/asset-tracker
   AssetTrackerBase.sol67.57%100%63.64%69.23%105–106, 69–70, 79–80, 96–97
   GWAssetTracker.sol26.39%100%36.11%24.89%111–113, 115–117, 123, 127, 130–131, 134–135, 138–139, 142–143, 150–151, 207, 210–211, 214, 216–220, 222, 224, 226–230, 232–233, 235–236, 238–248, 250, 252, 254, 256–258, 263–264, 266–267, 271, 273–274, 280, 287–290, 292–293, 295, 297–301, 303–304, 308–312, 318–319, 322–323, 327, 332, 334, 337, 339–340, 342, 344, 346–347, 349–350, 354–355, 358–359, 362, 364–365, 368, 374, 376, 378, 380–381, 384, 389–391, 393–394, 398, 400–406, 413–414, 423, 425, 427, 431, 441, 447–448, 450, 452–454, 456, 464, 470, 472–473, 475–477, 486–487, 489, 495, 499, 503, 509–510, 514, 520–522, 533–536, 623–624, 675, 678, 76–78, 83–85, 90–92
   L1AssetTracker.sol72.37%100%70.83%72.66%111–113, 116–119, 121–122, 125–126, 132–134, 191, 195–199, 246, 368–371, 424, 45–46, 57–58, 61–62, 72–74
   LegacySharedBridgeAddresses.sol0%100%0%0%23, 26, 29, 32, 36–41, 43
contracts/bridge/interfaces
   AssetHandlerModifiers.sol75%100%100%66.67%13
contracts/bridge/ntv
   L1NativeTokenVault.sol73.58%100%77.27%72.62%100–102, 149, 153–155, 178–184, 186, 253–254, 256, 267, 269, 273, 91–92
   NativeTokenVaultBase.sol89.33%100%85.71%90%107, 112, 116–117, 150–153, 155–156, 158, 571–572, 576–577
   UpgradeableBeaconDeployer.sol0%100%0%0%15–16, 18, 20–21
contracts/bridgehub
   BridgehubBase.sol74.06%100%76.32%73.56%134–136, 144, 152, 157–159, 166, 184, 222–223, 229–230, 239, 252–254, 256–257, 259, 261, 293, 296, 315, 331, 362, 400–401, 508, 512, 516–517, 536, 539, 595, 599, 602, 637–638, 642–643, 651–652, 656–657
   CTMDeploymentTracker.sol73.47%100%81.82%71.05%107, 111, 115, 140, 144–145, 33, 41, 66, 79–80
   ChainAssetHandlerBase.sol56.38%100%46.15%58.02%104–106, 111–113, 124–126, 132–135, 138–139, 188, 191, 203–204, 258, 275, 337, 341, 343, 345–346, 355–356, 360–361, 83, 90–91, 99
   ChainRegistrationSender.sol88.24%100%100%85.19%41, 85, 89, 95
   L1Bridgehub.sol89.42%100%92.31%89.01%100, 217, 292, 296–297, 300, 310, 66–67, 87
   L1ChainAssetHandler.sol81.25%100%75%83.33%42–43, 58–59
   L1MessageRoot.sol60.98%100%85.71%55.88%51–52, 56–58, 61–62, 67–68, 74, 76, 80–81, 96–97
   L2Bridgehub.sol47.83%100%40%50%105–106, 114, 116–117, 126, 131–132, 134–135, 47, 49–52, 78, 91–92
   L2ChainAssetHandler.sol73.53%100%66.67%76%47–48, 67–68, 74, 98
   L2MessageRoot.sol75.51%100%72.73%76.32%103, 49–50, 53, 60, 65–66, 90–91
   MessageRootBase.sol82.58%100%95%80.36%120–122, 124, 126–127, 129, 133, 139–141, 149, 166, 176, 181, 186, 188–189, 246, 262, 335, 364
contracts/common
   MessageVerification.sol94.12%100%87.50%96.15%142
   ReentrancyGuard.sol95%100%100%94.12%79
contracts/common/l2-helpers
   L2ContractHelper.sol84.91%100%100%82.22%102, 108, 112, 129, 134, 73, 79, 83
   SystemContractsCaller.sol52.50%100%60%51.43%44–45, 47, 49, 51, 53, 66, 69, 72, 75, 78, 83, 89, 91, 93, 96, 98
contracts/common/libraries
   DataEncoding.sol84.21%100%88.24%83.33%112–113, 120–121, 166, 180, 208, 216–217, 228, 242, 253, 48
   DynamicIncrementalMerkle.sol81.03%100%85.71%80.39%143–146, 148–151, 153–154
   DynamicIncrementalMerkleMemory.sol98.96%100%100%98.84%196
   FullMerkle.sol100%100%100%100%
   FullMerkleMemory.sol85.86%100%100%84.78%114, 131, 149, 163, 89–98
   Merkle.sol98.15%100%100%97.96%83
   MessageHashing.sol96%100%100%95.38%118, 135, 154
   

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.

5 participants