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

Gateway L2->L1 messaging fixes #725

Merged
merged 5 commits into from
Aug 21, 2024

Conversation

StanislavBreadless
Copy link
Collaborator

What ❔

  • Correct checks for batch being finalized
  • L2->L1 messaging that is compatible with migrating back and forth from gateway

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.

Copy link

github-actions bot commented Aug 21, 2024

Changes to gas cost

Generated at commit: 02b444f0c70cb7e0624d796a88e6778e2a165816, compared to commit: 336e40c022127ffb4adf3f3f1e8ab4795eb72ff4

🧾 Summary (100% most significant diffs)

Contract Method Avg (+/-) %
DiamondProxy finalizeEthWithdrawal
proveL1ToL2TransactionStatus
proveL2LogInclusion
proveL2MessageInclusion
requestL2Transaction
util_setChainId
-376 ✅
+10 ❌
+7 ❌
+1,684 ❌
+2 ❌
+10 ❌
-0.49%
+0.09%
+0.09%
+20.38%
+0.00%
+0.03%
MailboxFacet proveL1ToL2TransactionStatus
proveL2LogInclusion
proveL2MessageInclusion
+10 ❌
+7 ❌
+264 ❌
+0.19%
+0.19%
+5.11%
DummyBridgehubSetter addTokenAssetId
setHyperchain
setSTM
0 ➖
0 ➖
0 ➖
0.00%
0.00%
0.00%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
DiamondProxy 2,430,995 (0) finalizeEthWithdrawal
proveL1ToL2TransactionStatus
proveL2LogInclusion
proveL2MessageInclusion
requestL2Transaction
util_setChainId
37,881 (0)
10,685 (+10)
4,524 (+10)
5,030 (+10)
33,397 (0)
33,823 (+4,812)
0.00%
+0.09%
+0.22%
+0.20%
0.00%
+16.59%
76,541 (-376)
10,685 (+10)
7,570 (+7)
9,948 (+1,684)
130,215 (+2)
33,889 (+10)
-0.49%
+0.09%
+0.09%
+20.38%
+0.00%
+0.03%
77,012 (-12)
10,685 (+10)
7,152 (0)
11,519 (+3,255)
167,117 (+36)
33,823 (0)
-0.02%
+0.09%
0.00%
+39.39%
+0.02%
0.00%
77,300 (0)
10,685 (+10)
11,035 (+10)
13,295 (+1,786)
191,220 (0)
34,195 (0)
0.00%
+0.09%
+0.09%
+15.52%
0.00%
0.00%
257 (0)
1 (0)
3 (0)
3 (+1)
771 (0)
519 (0)
MailboxFacet 3,092,169 (+83,709) finalizeEthWithdrawal
proveL1ToL2TransactionStatus
proveL2LogInclusion
proveL2MessageInclusion
8,341 (0)
5,360 (+10)
1,799 (0)
4,187 (+10)
0.00%
+0.19%
0.00%
+0.24%
49,212 (-370)
5,360 (+10)
3,724 (+7)
5,435 (+264)
-0.75%
+0.19%
+0.19%
+5.11%
49,744 (0)
5,360 (+10)
3,681 (+10)
5,942 (+771)
0.00%
+0.19%
+0.27%
+14.91%
49,744 (0)
5,360 (+10)
5,692 (+10)
6,176 (+10)
0.00%
+0.19%
+0.18%
+0.16%
257 (0)
1 (0)
3 (0)
3 (+1)
DummyBridgehubSetter 3,978,792 (-18,199) addStateTransitionManager
addTokenAssetId
proveL1ToL2TransactionStatus
proveL2LogInclusion
removeStateTransitionManager
setHyperchain
setPendingAdmin
setSTM
23,853 (0)
24,151 (0)
0 (0)
0 (0)
23,851 (0)
111,384 (0)
25,965 (0)
44,187 (0)
0.00%
0.00%
+∞%
+∞%
0.00%
0.00%
0.00%
0.00%
41,114 (+2)
36,594 (0)
1,412 (+27)
1,550 (+18)
25,498 (-10)
111,421 (0)
41,564 (-3)
44,224 (0)
+0.00%
0.00%
+1.95%
+1.17%
-0.04%
0.00%
-0.01%
0.00%
47,544 (0)
36,949 (-6)
985 (-9)
1,133 (-12)
25,861 (0)
111,444 (+12)
49,569 (0)
44,247 (+12)
0.00%
-0.02%
-0.91%
-1.05%
0.00%
+0.01%
0.00%
+0.03%
47,544 (0)
47,575 (0)
3,632 (-7)
3,932 (-7)
26,318 (0)
111,444 (0)
49,785 (0)
44,247 (0)
0.00%
0.00%
-0.19%
-0.18%
0.00%
0.00%
0.00%
0.00%
3,584 (0)
1,536 (0)
512 (0)
512 (0)
2,048 (0)
768 (0)
1,280 (0)
768 (0)
MerkleTest 468,218 (0) calculateRoot(bytes32[],uint256,bytes32) 606 (0) 0.00% 2,893 (+2) +0.07% 2,943 (0) 0.00% 2,998 (0) 0.00% 265 (0)
DiamondInit 523,294 (0) initialize 22,660 (0) 0.00% 392,286 (+79) +0.02% 400,752 (0) 0.00% 420,652 (0) 0.00% 108 (+1)
MerkleTreeNoSort 534,636 (0) getProof 2,594 (0) 0.00% 32,736 (-5) -0.02% 33,193 (0) 0.00% 33,215 (0) 0.00% 277 (0)
DummyHyperchain 3,300,917 (+83,710)

Copy link

Coverage after merging sb-some-gw-messaing-fixes into kl/sync-layer-reorg will be

89.63%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
../da-contracts/contracts
   RollupL1DAValidator.sol67.11%50%83.33%73.91%134, 137, 137, 137, 139, 170, 172, 25, 25, 25–26, 26, 26, 28, 30–31, 35–36, 59, 61, 61, 61–62, 64
contracts/bridge
   BridgeHelper.sol100%100%100%100%
   L1AssetRouter.sol95.19%89.29%94.87%97.88%137, 152, 209, 229, 274, 327, 379, 514, 531, 552, 735–736, 871
   L1ERC20Bridge.sol95%87.50%100%96%113, 99
   L1NativeTokenVault.sol96.12%97.62%84.62%97.30%251, 256, 44
contracts/bridgehub
   Bridgehub.sol70.66%44.30%76.32%83.80%104, 104, 104, 109, 115, 120, 120, 187, 187–188, 190–191, 191, 191–192, 198–199, 199, 199–200, 200, 200, 202–203, 203, 203–204, 268, 298–300, 302–304, 306, 332, 341, 346–347, 397–398, 400, 400, 400, 443, 451–452, 455, 455, 455–456, 478, 516, 540–541, 620, 623–624, 628–629, 656–657, 662–663, 691, 696, 99
   MessageRoot.sol91.38%61.54%100%100%156, 162, 69, 76, 94
   STMDeploymentTracker.sol79.49%50%90%94.12%110, 114, 31, 38, 61, 88, 91
contracts/common
   ReentrancyGuard.sol100%100%100%100%
contracts/common/libraries
   DataEncoding.sol80%100%100%66.67%72, 80
   DynamicIncrementalMerkle.sol74.42%100%80%72.22%67–70, 72–74, 76–78
   FullMerkle.sol100%100%100%100%
   L2ContractHelper.sol55.88%30%60%68.42%29, 32–33, 46–47, 47, 47, 49, 49, 49, 56, 86, 90
   Merkle.sol93.85%81.82%100%100%53–55, 83
   MessageHashing.sol100%100%100%100%
   SemVer.sol100%100%100%100%
   UncheckedMath.sol100%100%100%100%
   UnsafeBytes.sol100%100%100%100%
contracts/governance
   ChainAdmin.sol21.43%14.29%20%25%27, 37–38, 45–46, 55, 55, 55, 57, 59–60, 60, 63, 66, 76, 76, 76–77
   Governance.sol99.07%96.77%100%100%44
contracts/state-transition
   StateTransitionManager.sol69.14%45.45%55.88%82.11%103, 130–132, 136, 189, 232, 239, 257, 263, 270, 282, 289, 296, 304, 311, 319, 326, 339, 341, 407, 426, 426, 426, 429, 429, 429, 431, 444, 449, 474, 73, 78, 84, 84
   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%70%100%100%32–36, 60
   DiamondProxy.sol80.77%62.50%100%88.24%16, 16, 16–17, 27
contracts/state-transition/chain-deps/facets
   Admin.sol81.61%54.35%86.36%92.45%107, 119, 119, 119–121, 147, 147, 147–148, 148, 148, 150, 171, 218–219, 221, 234–235, 241, 260–261, 266, 303, 313, 317, 39, 39, 95
   Executor.sol78.44%72.81%81.25%81.61%107, 167, 171–172, 172, 172–173, 173, 173, 184, 184, 188, 188, 188, 206, 220, 231, 234, 279, 279, 279, 282, 285, 287–288, 294–295, 314–317, 319, 36, 368, 368, 368–371, 373, 376, 379–380, 389, 405, 408–409, 411–413, 424–426, 446, 487, 494, 513, 518, 527–528, 579, 604–605
   Getters.sol81.82%66.67%82.22%83.58%110, 113, 119, 122, 133, 136, 178, 229, 235, 239, 65, 70, 85, 90
   Mailbox.sol82.11%77.50%89.66%81.82%132, 155, 165, 194, 198, 198, 198, 201, 203–204, 206, 211, 213, 216–218, 223–226, 228–229, 235, 235, 235, 237, 240–241, 331–332, 52
   ZkSyncHyperchainBase.sol82.14%78.57%85.71%85.71%48, 56, 56, 56
contracts/state-transition/data-availability
   CalldataDA.sol100%100%100%100%
   CalldataDAGateway.sol85.71%66.67%100%100%27–28
   RelayedSLDAValidator.sol96.67%83.33%100%100%94
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%80
   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,

@StanislavBreadless StanislavBreadless merged commit e7442e6 into kl/sync-layer-reorg Aug 21, 2024
23 checks passed
@StanislavBreadless StanislavBreadless deleted the sb-some-gw-messaing-fixes branch August 21, 2024 11:05
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