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

feat(contracts): Merkle Tree library for priority queue migration #506

Closed
wants to merge 15 commits into from

Conversation

ly0va
Copy link
Member

@ly0va ly0va commented Jun 4, 2024

What ❔

Incremental Merkle Tree library (modified version of OZ's) and an item range inclusion check method.

Why ❔

Preparation for priority queue migration.

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.

/**
* @dev Collection of functions related to array types.
*/
library Arrays {
Copy link
Member

Choose a reason for hiding this comment

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

Why copy, not import?

Copy link
Contributor

Choose a reason for hiding this comment

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

because it is OZ 5, this relates to our discussion

Copy link

Coverage after merging lyova-merkle-priority-queue into dev will be

80.22%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
contracts/bridge
   L1ERC20Bridge.sol81.82%80%75%84.62%62, 70, 70, 70–72
   L1SharedBridge.sol81.45%75.83%79.41%85.98%102, 111, 117, 117, 117, 129–133, 147, 154, 165–166, 176, 176, 176–180, 180, 180–181, 186–188, 188, 188–191, 191, 191–192, 204, 213, 213, 213, 346–347, 463, 469, 484, 493, 510, 593, 599, 654, 827, 832, 96
contracts/bridgehub
   Bridgehub.sol81.97%60.53%89.47%92.31%133–134, 136, 140–141, 143, 249–250, 296–297, 303, 303, 303–304, 326, 330, 361, 366, 50, 72
contracts/common
   ReentrancyGuard.sol100%100%100%100%
contracts/common/libraries
   L2ContractHelper.sol53.57%30%50%71.43%25, 28–29, 42–43, 43, 43, 45, 45, 45, 52
   SemVer.sol100%100%100%100%
   UncheckedMath.sol100%100%100%100%
   UnsafeBytes.sol100%100%100%100%
contracts/common/libraries/openzeppelin
   Arrays.sol3.65%0%11.76%3.19%110, 110, 110, 113, 115, 117–118, 118, 118, 121–122, 126–128, 138, 148, 157, 175, 181, 188, 197, 206, 224–225, 227, 227, 227–228, 231–232, 236, 236, 236–237, 239, 244, 244, 244–245, 247, 260–261, 263, 263, 263–264, 267–268, 272, 272, 272, 275, 278, 282, 294–295, 297, 297, 297–298, 301–302, 306, 306, 306–307, 311, 316, 323–324, 326, 326, 326–327, 33, 330–331, 335, 335, 335, 338, 34, 341, 345, 352–353, 355, 355, 355–356, 359–360, 364, 364, 364–365, 369, 374, 383, 386, 388, 41, 411, 414, 416, 42, 426, 437, 448, 60–61, 68–69, 87–88, 95–96
   Hashes.sol66.67%100%66.67%66.67%15
   IncrementalMerkle.sol94.12%75%100%96.30%120–121
   SlotDerivation.sol28.57%100%50%20%102, 114, 126, 141, 157, 46, 78, 90
contracts/governance
   Governance.sol91.67%93.75%95%89.29%44, 44, 44, 46, 48–49, 51–52
contracts/state-transition
   StateTransitionManager.sol63.40%57.69%50%69.47%103–107, 113, 144–146, 150, 191, 193–194, 199–200, 200, 200, 202–204, 206–207, 241, 261, 275, 280, 285, 290, 295, 300, 305, 372, 372, 372, 374, 437, 91, 91, 91, 98
   TestnetVerifier.sol40%25%50%50%16, 16, 16, 28, 32
   ValidatorTimelock.sol93.75%100%94.74%91.43%61–63
   Verifier.sol83.33%100%66.67%100%
contracts/state-transition/chain-deps
   DiamondInit.sol88%70%100%100%32–36, 60
   DiamondProxy.sol70.59%62.50%100%75%16, 16, 16–17, 27
contracts/state-transition/chain-deps/facets
   Admin.sol86.05%72.73%92.31%90.20%126, 153–154, 156, 76, 85, 97, 97, 97–99
   Executor.sol82.41%74.34%81.82%88.26%125, 191, 194, 200, 202–205, 216, 234, 248, 307, 342–345, 347, 367–368, 380–381, 381, 381–382, 382, 382, 386, 386, 386, 388–389, 389, 389–390, 393, 401, 419, 419–420, 432–434, 44, 454, 495, 502, 521, 526, 56, 56, 58, 58, 58, 587, 59–60, 612–613, 65, 661, 663, 67–68, 724
   Getters.sol86.96%60%90.48%88.89%102, 108, 111, 122, 125, 170, 196, 221, 74, 79, 99
   Mailbox.sol66.67%53.57%58.82%73.91%102, 110, 120, 120, 120, 122, 128, 128, 128, 134–135, 137, 142–143, 169, 198, 198, 198–199, 219, 264, 275, 281, 49, 49, 49, 51–53, 70, 80
   ZkSyncHyperchainBase.sol82.14%78.57%85.71%85.71%48, 56, 56, 56
contracts/state-transition/libraries
   Diamond.sol94.33%84.09%100%98.85%110, 116, 119, 184, 239, 268, 287, 289
   LibMap.sol100%100%100%100%
   Merkle.sol97.67%92.86%100%100%58
   PriorityQueue.sol100%100%100%100%
   PriorityTree.sol60.87%0%85.71%66.67%59, 59, 59–60, 66, 66, 66–67
   TransactionValidator.sol97.18%94.12%100%100%54–55
contracts/upgrades
   BaseZkSyncUpgrade.sol66.93%45.45%100%74.65%102, 102, 102, 104, 107, 110–111, 118, 122, 122,

@ly0va
Copy link
Member Author

ly0va commented Jun 21, 2024

Closing in favor of #546

@ly0va ly0va closed this Jun 21, 2024
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.

3 participants