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

Increase Test Coverage #632

Merged
merged 17 commits into from
Aug 8, 2024
Merged

Increase Test Coverage #632

merged 17 commits into from
Aug 8, 2024

Conversation

koloz193
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.

Base automatically changed from zk-sl-gas-testing to kl/sync-layer-reorg July 22, 2024 17:29
@matter-labs matter-labs deleted a comment from github-actions bot Jul 23, 2024
Copy link

github-actions bot commented Jul 23, 2024

Changes to gas cost

Generated at commit: f8b482d80feaa4b6e3303e33a0f114ad833e73df, compared to commit: 7ee53bcdccf3ea6a306b9e867ffc8633dff9eda1

🧾 Summary (100% most significant diffs)

Contract Method Avg (+/-) %
TransparentUpgradeableProxy createNewChain
setChainCreationParams
setNewVersionUpgrade
setUpgradeDiamondCut
setValidatorTimelock
validatorTimelock
+1,166,570 ❌
+360 ❌
+799 ❌
+360 ❌
-3,231 ✅
+625 ❌
+1699.40%
+0.37%
+0.40%
+0.37%
-8.15%
+11.74%
StateTransitionManager createNewChain
initialize
setChainCreationParams
setNewVersionUpgrade
setUpgradeDiamondCut
setValidatorTimelock
+17,140 ❌
-6,729 ✅
+189 ❌
+628 ❌
+189 ❌
-3,239 ✅
+0.55%
-4.75%
+0.42%
+0.42%
+0.41%
-28.68%
MessageRoot addNewChain
initialize
-16,557 ✅
+22 ❌
-6.65%
+0.02%
Utils getGettersSelectors +224 ❌ +3.21%
AdminFacet executeUpgrade
genesisUpgrade
+8,991 ❌
-78 ✅
+3.01%
-0.07%
DiamondProxy executeUpgrade +7,413 ❌ +2.63%
DiamondCutTestContract diamondCut +1,273 ❌ +0.63%
L1GenesisUpgrade genesisUpgrade
upgradeInner
-58 ✅
-15 ✅
-0.06%
-0.03%
DeployL1Script run -17,651 ✅ -0.04%
DummyStateTransitionManagerWBH setHyperchain 0 ➖ 0.00%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
TransparentUpgradeableProxy 845,385 (+506) createNewChain
getHyperchain
setChainCreationParams
setNewVersionUpgrade
setUpgradeDiamondCut
setValidatorTimelock
validatorTimelock
54,697 (+158)
1,434 (0)
97,632 (+360)
202,975 (+799)
98,213 (+360)
33,178 (-6,461)
1,075 (0)
+0.29%
0.00%
+0.37%
+0.40%
+0.37%
-16.30%
0.00%
1,235,216 (+1,166,570)
4,257 (-36)
97,632 (+360)
202,975 (+799)
98,213 (+360)
36,408 (-3,231)
5,950 (+625)
+1699.40%
-0.84%
+0.37%
+0.40%
+0.37%
-8.15%
+11.74%
83,078 (+14,432)
3,118 (0)
97,632 (+360)
202,975 (+799)
98,213 (+360)
36,408 (-3,231)
6,575 (+1,250)
+21.02%
0.00%
+0.37%
+0.40%
+0.37%
-8.15%
+23.47%
3,567,875 (+3,485,121)
22,618 (0)
97,632 (+360)
202,975 (+799)
98,213 (+360)
39,639 (0)
9,575 (0)
+4211.42%
0.00%
+0.37%
+0.40%
+0.37%
0.00%
0.00%
3 (+1)
79 (+1)
1 (0)
1 (0)
1 (0)
2 (+1)
4 (+2)
StateTransitionManager 4,133,413 (+7,967) createNewChain
getHyperchain
initialize
setChainCreationParams
setNewVersionUpgrade
setUpgradeDiamondCut
setValidatorTimelock
1,271 (0)
803 (0)
22,836 (0)
45,191 (+189)
151,084 (+628)
46,663 (+189)
4,818 (-6,477)
0.00%
0.00%
0.00%
+0.42%
+0.42%
+0.41%
-57.34%
3,154,503 (+17,140)
1,487 (-14)
134,853 (-6,729)
45,191 (+189)
151,084 (+628)
46,663 (+189)
8,056 (-3,239)
+0.55%
-0.93%
-4.75%
+0.42%
+0.42%
+0.41%
-28.68%
3,459,694 (0)
803 (0)
209,526 (+189)
45,191 (+189)
151,084 (+628)
46,663 (+189)
8,056 (-3,239)
0.00%
0.00%
+0.09%
+0.42%
+0.42%
+0.41%
-28.68%
3,514,270 (+37,476)
5,084 (0)
209,539 (0)
45,191 (+189)
151,084 (+628)
46,663 (+189)
11,295 (0)
+1.08%
0.00%
0.00%
+0.42%
+0.42%
+0.41%
0.00%
22 (+1)
48 (+1)
30 (+8)
1 (0)
1 (0)
1 (0)
2 (+1)
MessageRoot 1,267,083 (-25,348) addNewChain
initialize
21,860 (-154,547)
133,489 (+22)
-87.61%
+0.02%
232,486 (-16,557)
133,489 (+22)
-6.65%
+0.02%
284,336 (0)
133,489 (+22)
0.00%
+0.02%
298,493 (0)
133,489 (+22)
0.00%
+0.02%
23 (+4)
7 (0)
Utils 4,703,539 (+11,618) getGettersSelectors 7,197 (+224) +3.21% 7,197 (+224) +3.21% 7,197 (+224) +3.21% 7,197 (+224) +3.21% 20 (+4)
AdminFacet 3,211,082 (0) executeUpgrade
genesisUpgrade
2,706 (0)
112,773 (-1,554)
0.00%
-1.36%
307,451 (+8,991)
114,249 (-78)
+3.01%
-0.07%
488,383 (+14,984)
114,327 (0)
+3.17%
0.00%
488,433 (+14,984)
114,327 (0)
+3.16%
0.00%
5 (0)
20 (+1)
DiamondProxy 1,939,824 (-516,860) executeUpgrade
getAdmin
31,894 (0)
1,168 (0)
0.00%
0.00%
289,729 (+7,413)
1,477 (-5)
+2.63%
-0.34%
437,335 (+12,354)
1,168 (0)
+2.91%
0.00%
437,385 (+12,354)
9,668 (0)
+2.91%
0.00%
5 (0)
55 (+1)
Bridgehub 3,287,902 (0) addStateTransitionManager
addToken
proveL1ToL2TransactionStatus
proveL2LogInclusion
removeStateTransitionManager
setPendingAdmin
23,010 (0)
22,922 (0)
0 (0)
0 (0)
23,895 (0)
26,046 (0)
0.00%
0.00%
+∞%
+∞%
0.00%
0.00%
40,304 (-1)
37,214 (-4)
1,938 (0)
2,064 (-23)
25,265 (-3)
37,991 (-8)
-0.00%
-0.01%
0.00%
-1.10%
-0.01%
-0.02%
46,442 (0)
46,138 (0)
1,550 (0)
1,676 (-6)
25,333 (0)
37,959 (0)
0.00%
0.00%
0.00%
-0.36%
0.00%
0.00%
46,442 (0)
46,354 (0)
4,770 (+14)
5,019 (-7)
26,362 (0)
49,872 (0)
0.00%
0.00%
+0.29%
-0.14%
0.00%
0.00%
3,591 (0)
1,813 (0)
512 (0)
512 (0)
2,048 (0)
512 (0)
DiamondCutTestContract 1,848,539 (0) diamondCut 23,712 (0) 0.00% 203,587 (+1,273) +0.63% 45,091 (0) 0.00% 1,422,565 (+25,451) +1.82% 20 (0)
GettersFacet 905,661 (0) getAdmin 397 (0) 0.00% 469 (-2) -0.42% 397 (0) 0.00% 2,397 (0) 0.00% 55 (+1)
DiamondInit 568,496 (0) initialize 22,660 (0) 0.00% 412,217 (+285) +0.07% 424,265 (0) 0.00% 446,665 (0) 0.00% 113 (+1)
L1GenesisUpgrade 2,814,049 (0) genesisUpgrade
upgradeInner
102,008 (-1,154)
58,204 (-289)
-1.12%
-0.49%
103,104 (-58)
58,478 (-15)
-0.06%
-0.03%
103,162 (0)
58,493 (0)
0.00%
0.00%
103,162 (0)
58,493 (0)
0.00%
0.00%
20 (+1)
20 (+1)
DeployL1Script 47,587,224 (-17,478) run 48,208,467 (-17,651) -0.04% 48,208,467 (-17,651) -0.04% 48,208,467 (-17,651) -0.04% 48,208,467 (-17,651) -0.04% 7 (0)
MerkleTest 468,218 (0) calculateRoot(bytes32[],uint256,bytes32) 606 (0) 0.00% 2,922 (+1) +0.03% 2,943 (0) 0.00% 2,998 (0) 0.00% 261 (0)
MerkleTreeNoSort 534,636 (0) getProof 32,953 (0) 0.00% 33,176 (-5) -0.02% 33,193 (0) 0.00% 33,215 (0) 0.00% 273 (0)
DummyStateTransitionManagerWBH 4,144,393 (+7,978) setHyperchain 111,114 (0) 0.00% 111,151 (0) 0.00% 111,162 (-12) -0.01% 111,174 (0) 0.00% 768 (0)
DummyStateTransitionManager 4,142,645 (+7,980)

@koloz193 koloz193 requested review from kelemeno and ly0va August 5, 2024 14:52
Copy link

github-actions bot commented Aug 6, 2024

Coverage after merging zk-sl-tests into kl/sync-layer-reorg will be

89.27%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
../da-contracts/contracts
   RollupL1DAValidator.sol67.11%50%83.33%73.91%130, 132, 132, 132–133, 135, 169, 171, 25, 25, 25–26, 26, 26, 28, 30–31, 35–36, 91, 94, 94, 94, 96
contracts/bridge
   L1AssetRouter.sol94.90%89.47%97.22%96.70%113, 128, 178, 185, 305–307, 403, 743, 777–781
   L1ERC20Bridge.sol95.24%100%87.50%96.15%247
   L1NativeTokenVault.sol93.79%93.33%80%96.47%272, 277, 47, 53, 53, 53
contracts/bridgehub
   Bridgehub.sol77.89%49.06%80%91.59%114, 127, 172, 221–222, 224–226, 228, 268–269, 343, 343–344, 346, 346, 346, 390, 390–391, 397, 397, 397–398, 420, 424, 456, 478, 481–482, 508–509, 535, 540, 89, 94
   MessageRoot.sol91.38%61.54%100%100%107, 113, 58, 64, 86
   STMDeploymentTracker.sol71.43%50%77.78%77.78%137, 31, 51, 75, 78, 93, 95, 98
contracts/common
   ReentrancyGuard.sol100%100%100%100%
contracts/common/libraries
   DynamicIncrementalMerkle.sol100%100%100%100%
   FullMerkle.sol97.01%83.33%100%100%110, 73
   L2ContractHelper.sol55.88%30%60%68.42%29, 32–33, 46–47, 47, 47, 49, 49, 49, 56, 86, 90
   Merkle.sol73.85%68.18%75%76.92%52–53, 53, 53–54, 54, 54–55, 55, 55, 57–59, 62, 65, 83
   Messaging.sol100%100%100%100%
   SemVer.sol100%100%100%100%
   UncheckedMath.sol100%100%100%100%
   UnsafeBytes.sol100%100%100%100%
contracts/governance
   ChainAdmin.sol22.22%20%33.33%20%16, 28–29, 38, 38, 38, 40, 42–43, 43, 46, 49
   Governance.sol99.07%96.77%100%100%44
contracts/state-transition
   StateTransitionManager.sol75%57.14%62.16%85.58%142–144, 148, 201, 238, 243, 258, 263, 268, 277, 282, 288, 294, 300, 306, 312, 321, 321, 321, 323, 334, 336, 402, 413, 419, 434, 450, 474, 83
   TestnetVerifier.sol77.78%66.67%100%75%16, 32
   ValidatorTimelock.sol98.57%100%100%97.67%236
   Verifier.sol89.88%35.71%96.30%90.93%1673–1674, 287–302, 305–308, 311–318, 321–328, 331–332, 335–336, 339, 384–385, 395–396, 406–407, 417–418, 428–429, 444–445, 454, 454–455, 904–905
contracts/state-transition/chain-deps
   DiamondInit.sol88.24%70%100%100%33–37, 63
   DiamondProxy.sol80.77%62.50%100%88.24%16, 16, 16–17, 27
contracts/state-transition/chain-deps/facets
   Admin.sol81.29%56.82%80.95%91.51%103, 103, 103–105, 130, 130, 130–131, 131, 131, 133, 154, 203–204, 206, 220–221, 228, 246–247, 252, 283, 293, 297, 316, 82, 91
   Executor.sol77.88%71.68%80.65%81.36%100, 158, 160, 164–165, 165, 165–166, 166, 166, 177, 177, 181, 181, 181, 199, 213, 224, 227, 272, 272, 272, 275, 278, 280–281, 287–288, 307–310, 312, 341–342, 366, 366, 366–369, 371, 374, 377–378, 386, 401, 404–405, 407–409, 420–422, 442, 483, 490, 509, 514, 523–524, 575, 600–601
   Getters.sol83.33%66.67%84.44%84.85%104, 107, 113, 116, 127, 130, 175, 226, 232, 236, 64, 79, 84
   Mailbox.sol58.05%45.71%59.26%61.61%100, 108, 124–125, 125, 125, 127–128, 136–138, 148, 160–161, 163–164, 166, 171, 175, 175, 175–177, 177, 177–178, 180, 180, 180, 184, 186–187, 189, 194, 196, 199–200, 205–208, 211–212, 229, 235, 235, 235, 243, 248, 275, 304–305, 385, 396, 402, 541, 541, 541–542, 562, 68, 78
   ZkSyncHyperchainBase.sol82.14%78.57%85.71%85.71%48, 56, 56, 56
contracts/state-transition/data-availability
   CalldataDA.sol100%100%100%100%
   RelayedSLDAValidator.sol91.30%50%100%100%48, 73
contracts/state-transition/libraries
   Diamond.sol94.81%86.49%100%97.73%110, 112, 114, 116, 119, 184, 294
   LibMap.sol100%100%100%100%
   PriorityQueue.sol100%100%100%100%
   PriorityTree.sol97.62%80%100%100%76
   TransactionValidator.sol97.18%94.12%100%100%54–55
contracts/upgrades
   BaseZkSyncUpgrade.sol69.42%48.65%100%75%102, 102, 102, 104, 107, 110–111, 122, 122, 122, 124, 127, 130–131, 145–147, 165–167, 206, 208, 223, 241–242,

@koloz193 koloz193 merged commit 8536918 into kl/sync-layer-reorg Aug 8, 2024
23 checks passed
@koloz193 koloz193 deleted the zk-sl-tests branch August 8, 2024 18:36
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