Skip to content

Conversation

Raid5594
Copy link
Collaborator

What ❔

Adds a bash script to verify contracts on L1, provided with the deployment logs.

Why ❔

When we deploy new contracts with deployment scripts, logs are generated, however the process is pretty manual, so this PR automates it via the scripts that covers da-contracts and l1-contracts folder.
However, it is easily extendable to more directories, in necessary.

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

Coverage after merging ra/add-script-for-l1-contract-verification into draft-v29 will be

84.13%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
contracts/bridge
   BridgeHelper.sol85.71%100%100%85%31, 36, 41
   BridgedStandardERC20.sol82.14%100%92.31%80.28%120–121, 126–127, 139–140, 164, 205, 212, 219, 229–230, 63, 91
   L1ERC20Bridge.sol94%100%100%93.02%189, 208, 270
   L1Nullifier.sol83.33%100%86.21%82.89%114, 128–130, 160, 221, 224, 234, 237, 247, 250, 418–420, 424–425, 452, 518, 602, 614, 652, 654, 698, 710, 713, 715, 728, 741–742, 746–747, 767
contracts/bridge/asset-router
   AssetRouterBase.sol95.45%100%100%94.44%59, 87
   L1AssetRouter.sol88.33%100%88.89%88.24%208, 246, 262, 349, 360, 391, 430–431, 445, 476, 548, 60, 637, 648, 662, 667, 76, 84
contracts/bridge/interfaces
   AssetHandlerModifiers.sol75%100%100%66.67%13
contracts/bridge/ntv
   L1NativeTokenVault.sol84.82%100%88.24%84.21%144–150, 152, 220–221, 223, 234, 236, 240, 66
   NativeTokenVault.sol89.50%100%92%89.10%102, 234, 239, 256, 274, 279, 295, 314, 322, 488, 503, 531, 564–565, 569–570, 74
contracts/bridgehub
   Bridgehub.sol83.39%100%84.78%83.15%115, 123, 128–130, 137, 165–166, 182, 227–228, 236, 239, 248, 258, 271, 286, 315, 339, 342, 401, 417, 448, 528, 610, 708, 712, 716–717, 736, 739, 790, 793, 796, 831, 835, 838, 873–874, 878–879, 887–888, 892–893
   CTMDeploymentTracker.sol73.47%100%81.82%71.05%106, 110, 114, 139, 143–144, 32, 40, 65, 78–79
   ChainAssetHandler.sol77.94%100%80%77.59%125, 139, 142, 152, 197, 245–246, 250–251, 55, 62–63, 71
   L2MessageVerification.sol100%100%100%100%
   MessageRoot.sol94.87%100%100%93.85%102, 136, 183, 193
contracts/common
   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.sol0%100%0%0%102, 114, 122–125, 128, 135–139, 141–142, 32–34, 37, 44–45, 47, 49, 51, 53, 66, 69, 72, 75, 78, 83, 89, 91, 93, 96, 98
contracts/common/libraries
   DataEncoding.sol85.11%100%100%81.58%109–110, 117–118, 163, 177, 45
   DynamicIncrementalMerkle.sol73.91%100%80%73.17%66–70, 72–74, 76–78
   FullMerkle.sol100%100%100%100%
   Merkle.sol98.15%100%100%97.96%83
   MessageHashing.sol95.16%100%100%94.64%113, 77, 94
   SemVer.sol100%100%100%100%
   UncheckedMath.sol100%100%100%100%
   UnsafeBytes.sol100%100%100%100%
contracts/governance
   AccessControlRestriction.sol100%100%100%100%
   ChainAdmin.sol97.87%100%100%97.30%39
   ChainAdminOwnable.sol44.83%100%40%45.83%28, 38–40, 46–48, 57, 66, 77–79, 81
   Governance.sol100%100%100%100%
   L2ProxyAdminDeployer.sol0%100%0%0%16–18, 20
   PermanentRestriction.sol88.80%100%100%87.39%103, 110–111, 199–200, 203–204, 207, 209–210, 239, 287, 309, 340
   ServerNotifier.sol93.10%100%100%90.91%55, 65
   TransitionaryOwner.sol0%100%0%0%16–17, 21–23
contracts/governance/restriction
   Restriction.sol100%100%100%100%
   RestrictionValidator.sol100%100%100%100%
contracts/state-transition
   AccessControlEnumerablePerChainAddressUpgradeable.sol98.15%100%100%97.67%179
   ChainTypeManager.sol86.07%100%84.62%86.42%111, 123, 129, 137–138, 248–251, 264–267, 282, 412, 474, 502, 509, 536, 584, 592–593
   ValidatorTimelock.sol89.25%100%77.78%92%120, 140, 163, 273, 292, 97
contracts/state-transition/chain-deps
   DiamondInit.sol92.68%100%100%92.50%50, 54, 58
   DiamondProxy.sol100%100%100%100%
   GatewayCTMDeployer.sol0%100%0%0%166–167, 170, 172–174, 176, 178, 180, 188, 190, 192, 194, 196–197, 203, 215, 223, 226–227, 229, 235, 239–240, 248, 253–255, 262, 267–269, 282–285, 299, 304–309, 313, 326, 332, 334, 336–337, 341, 343–345, 353, 358, 362–363, 369, 375, 381, 388, 398, 404, 406, 416, 424, 438, 443, 448
contracts/state-transition/chain-deps/facets
   Admin.sol81.78%100%88%81%153–154, 171, 174, 178, 185–187, 190, 192, 195, 199–200, 204, 300, 303, 312, 315, 325, 332, 352, 366, 369, 376, 389, 392–393, 395–396, 398–399, 401, 404, 435, 439, 460, 466, 51
   Executor.sol88.22%100%100%87.04%133, 147, 154–156, 183,

@@ -0,0 +1,182 @@
#!/usr/bin/env bash
set -euo pipefail
Copy link
Collaborator

Choose a reason for hiding this comment

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

TBH I dislike when we have files that are hard to review manually, most of our codebase/scripts are in TypeScript. Considering that logs are generated inside l1-contracts repo and l1-contracts repo already have ts files, I would prefer it to be a ts script, than a bash one

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.

2 participants