Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Enable slither for l2 contracts #1201

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open

Conversation

dnkolegov
Copy link
Collaborator

@dnkolegov dnkolegov commented Jan 15, 2025

What ❔

This PR enables the slither static analyzer for L2 contracts and also resolves the issues it has found.
It is configured to catch high-severity issues only.
It doesn't check Verifier.sol contract.

Why ❔

To find "low-hanging fruits" bugs and known vulnerabilities.

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.

@dnkolegov dnkolegov changed the title Enable slither for l2 contracts [wip] Enable slither for l2 contracts Jan 15, 2025
Copy link

Coverage after merging denis/dev-l2-slither into dev will be

83.03%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
contracts/bridge
   BridgeHelper.sol76%40%100%84.21%29, 31, 34, 36, 39, 41
   BridgedStandardERC20.sol74.68%25%92.31%77.59%120–121, 126–127, 139–140, 163–164, 205, 205, 212, 212, 219, 219, 230, 62–63, 90–91
   L1ERC20Bridge.sol89.58%66.67%100%91.43%188–189, 207–208, 269
   L1Nullifier.sol77.97%54.76%86.21%82.69%115–116, 131, 131–132, 161–162, 222–223, 225–226, 235–236, 238–239, 248–249, 251–252, 418, 420–421, 421–422, 425–426, 426–427, 453–454, 519–520, 611–612, 649–652, 708, 711, 713, 726, 740, 745, 764–765
contracts/bridge/asset-router
   AssetRouterBase.sol90.24%60%100%92.86%58–59, 86–87
   L1AssetRouter.sol84.66%62.50%88.89%89.23%208–209, 245–247, 258, 260, 263, 361, 391–392, 435–437, 450–451, 553–554, 59–60, 654, 673, 75–76, 83–84
contracts/bridge/interfaces
   AssetHandlerModifiers.sol50%0%100%50%12–13
contracts/bridge/ntv
   L1NativeTokenVault.sol79.34%62.07%87.50%84.21%141, 144–145, 145, 145–147, 147, 147–149, 149, 149–150, 152, 207, 218, 220, 220, 220–221, 223, 236
   NativeTokenVault.sol83.87%59.38%92%88.37%101–102, 230–231, 235–236, 252–253, 270–271, 275–276, 290, 292, 310–311, 318–319, 483, 485, 499–500, 527–528, 562, 567, 73–74
contracts/bridgehub
   Bridgehub.sol77.65%39.29%93.18%83.75%115–116, 123–124, 130–131, 137, 137–138, 167, 182–183, 227–228, 230–231, 239–240, 249–250, 262–263, 277–278, 306–307, 330–331, 333–334, 399–400, 415–416, 446–447, 526–527, 608–609, 717–718, 722–723, 725–726, 730, 730–731, 735–736, 738–739, 778–779, 781–782, 796–797, 842–843, 845–846, 848–849, 883–884, 887–888, 890–891, 926, 931
   CTMDeploymentTracker.sol62.79%0%90%69.23%122–123, 128, 31–32, 39–40, 62–63, 89–90, 93–94, 97–98
   MessageRoot.sol88.89%40%100%91.89%121–122, 67–68, 88–89
contracts/chain-registrar
   ChainRegistrar.sol0%0%0%0%104, 113–115, 141, 155, 155–156, 159, 162, 162–163, 166, 169, 169–170, 172, 172–173, 177, 183–184, 191–192, 192–193, 196–200, 200–201, 204, 211
contracts/common
   ReentrancyGuard.sol90%66.67%100%92.86%78–79
contracts/common/libraries
   DataEncoding.sol78.26%50%100%81.48%110, 118, 143, 156, 163, 172, 174, 177, 43, 45
   DynamicIncrementalMerkle.sol74.42%100%80%72.22%67–70, 72–74, 76–78
   FullMerkle.sol100%100%100%100%
   L2ContractHelper.sol58.49%0%75%67.57%100–101, 106–107, 110–111, 125, 127, 127–128, 132, 132–133, 141, 71–72, 77–78, 81–82
   Merkle.sol96.43%85.71%100%97.73%81–82
   MessageHashing.sol100%100%100%100%
   SemVer.sol100%100%100%100%
   SystemContractsCaller.sol0%0%0%0%114, 122–125, 135–138, 138–139, 141, 141–142, 33, 33–34, 37, 45, 47, 49, 51, 53, 66, 66, 66, 69, 72, 75, 78, 89, 91, 93, 96, 98
   UncheckedMath.sol100%100%100%100%
   UnsafeBytes.sol100%100%100%100%
contracts/governance
   AccessControlRestriction.sol100%100%100%100%
   ChainAdmin.sol95.24%80%100%96.30%38–39
   ChainAdminOwnable.sol39.29%0%40%47.37%27–28, 39–40, 47–48, 56–57, 63, 66, 78, 78–79, 81
   Governance.sol98.15%94.74%100%98.55%45–46
   L2ProxyAdminDeployer.sol0%100%0%0%17–18, 20
   PermanentRestriction.sol83.45%67.86%100%85.57%103–104, 111, 111–112, 200, 200–201, 204, 204–205, 208, 210, 210–211, 240, 242, 289–290, 311–312, 342–343
   TransitionaryOwner.sol0%100%0%0%17, 22–23
contracts/governance/restriction
   Restriction.sol100%100%100%100%
   RestrictionValidator.sol100%100%100%100%
contracts/state-transition
   ChainTypeManager.sol72.12%22.22%71.43%80.36%147–148, 150–151, 153–154, 156–157, 212–213, 243–244, 268, 292, 311, 318, 325, 333, 340, 348, 355, 371, 373, 434–435, 462–463, 469–470, 496–497, 544–545, 79, 94–95
   TestnetVerifier.sol77.78%66.67%100%75%16, 28
   ValidatorTimelock.sol92.06%71.43%100%93.02%186–187, 202, 78–79
   Verifier.sol89.90%40%96.30%90.93%1674–1675, 287–302, 305–308, 311–318, 321–328, 331–332, 335–336, 339, 383–384, 394–395, 405–406, 416–417, 427–428, 443–444, 453, 453–454, 905–906
contracts/state-transition/chain-deps
   DiamondInit.sol80.43%50%100%88.24%39–40, 42–43, 45–46, 48–49, 73
   DiamondProxy.sol92.31%75%100%100%19, 30
   GatewayCTMDeployer.sol0%0%0%0%156, 161–163, 165, 167, 169, 177, 179–180, 182–183, 185, 205, 208–209, 211, 217, 221–222,

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