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

Kl/l2 bridge fixes #687

Merged
merged 38 commits into from
Aug 14, 2024
Merged

Kl/l2 bridge fixes #687

merged 38 commits into from
Aug 14, 2024

Conversation

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

@kelemeno kelemeno requested a review from Deniallugo as a code owner August 13, 2024 10:08
Copy link

github-actions bot commented Aug 13, 2024

Changes to gas cost

Generated at commit: 4d554a3180dd93ea279b1fb8f02d9c45897e3d6a, compared to commit: 4c4411cdc50d42ec4e6c9d295334d462d830b9a9

🧾 Summary (100% most significant diffs)

Contract Method Avg (+/-) %
TransparentUpgradeableProxy encodeTxDataHash
getHyperchain
protocolVersion
-2,193 ✅
-2,823 ✅
+1,695 ❌
-27.70%
-66.31%
+48.26%
DiamondProxy acceptAdmin
getAdmin
getProtocolVersion
-3,888 ✅
-298 ✅
-2,666 ✅
-10.68%
-20.03%
-69.83%
StateTransitionManager createNewChain
getHyperchain
initialize
-1,928,582 ✅
-684 ✅
-22,642 ✅
-62.01%
-46.00%
-16.80%
AdminFacet acceptAdmin
genesisUpgrade
setPendingAdmin
setTokenMultiplier
-5,954 ✅
-1,476 ✅
-8,854 ✅
+1,601 ❌
-47.59%
-1.29%
-37.96%
+5.87%
L1AssetRouter bridgehubConfirmL2Transaction
bridgehubDeposit
bridgehubDepositBaseToken
encodeTxDataHash
-2,126 ✅
-38,037 ✅
-2,793 ✅
-2,094 ✅
-9.80%
-39.97%
-4.74%
-29.27%
MessageRoot addNewChain -78,642 ✅ -33.83%
MailboxFacet bridgehubRequestL2Transaction -45,803 ✅ -32.55%
Bridgehub acceptOwnership
addToken
getHyperchain
initialize
l2TransactionBaseCost
setAddresses
transferOwnership
+4,284 ❌
+258 ❌
-253 ✅
-7,750 ✅
-345 ✅
-16,112 ✅
+8,092 ❌
+20.10%
+0.71%
-12.12%
-24.23%
-12.92%
-23.97%
+20.35%
L1ERC20Bridge initialize +1,108 ❌ +4.92%
L1GenesisUpgrade genesisUpgrade
upgrade
-1,096 ✅
-274 ✅
-1.06%
-0.47%
L1NativeTokenVault bridgeBurn -148 ✅ -0.46%
MerkleTest calculateRoot(bytes32[],uint256,bytes32) -3 ✅ -0.10%
MerkleTreeNoSort getProof +4 ❌ +0.01%
DummyStateTransitionManagerWBH setHyperchain 0 ➖ 0.00%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
TransparentUpgradeableProxy 845,337 (0) encodeTxDataHash
getHyperchain
protocolVersion
tokenAddress
2,723 (0)
1,434 (0)
957 (0)
0 (0)
0.00%
0.00%
0.00%
+∞%
5,723 (-2,193)
1,434 (-2,823)
5,207 (+1,695)
176 (-2,808)
-27.70%
-66.31%
+48.26%
-94.10%
7,223 (0)
1,434 (-1,684)
5,207 (+2,250)
0 (0)
0.00%
-54.01%
+76.09%
+∞%
7,223 (-17,142)
1,434 (-21,184)
9,457 (0)
9,683 (0)
-70.36%
-93.66%
0.00%
0.00%
15 (-2)
1 (-78)
4 (-5)
55 (-25)
GettersFacet 887,287 (0) getAdmin
getProtocolVersion
419 (0)
381 (0)
0.00%
0.00%
419 (-70)
381 (-1,333)
-14.31%
-77.77%
419 (0)
381 (-2,000)
0.00%
-84.00%
419 (-2,000)
381 (-2,000)
-82.68%
-84.00%
1 (-56)
1 (-2)
DiamondProxy 2,456,636 (+516,812) acceptAdmin
getAdmin
getProtocolVersion
30,766 (0)
1,190 (0)
1,152 (0)
0.00%
0.00%
0.00%
32,501 (-3,888)
1,190 (-298)
1,152 (-2,666)
-10.68%
-20.03%
-69.83%
32,501 (-4,536)
1,190 (0)
1,152 (-4,000)
-12.25%
0.00%
-77.64%
34,237 (-2,800)
1,190 (-8,500)
1,152 (-4,000)
-7.56%
-87.72%
-77.64%
2 (-12)
1 (-56)
1 (-2)
StateTransitionManager 4,194,166 (0) createNewChain
getHyperchain
initialize
protocolVersion
1,271 (0)
803 (0)
22,836 (0)
329 (0)
0.00%
0.00%
0.00%
0.00%
1,181,719 (-1,928,582)
803 (-684)
112,122 (-22,642)
1,329 (-111)
-62.01%
-46.00%
-16.80%
-7.71%
29,652 (-3,378,863)
803 (0)
22,836 (-186,325)
1,329 (-1,000)
-99.13%
0.00%
-89.08%
-42.94%
3,514,235 (0)
803 (-4,281)
209,526 (0)
2,329 (0)
0.00%
-84.21%
0.00%
0.00%
3 (-19)
1 (-47)
23 (-7)
4 (-5)
AdminFacet 3,218,316 (0) acceptAdmin
genesisUpgrade
setPendingAdmin
setTokenMultiplier
2,412 (0)
112,738 (0)
2,685 (0)
28,855 (+4,128)
0.00%
0.00%
0.00%
+16.69%
6,558 (-5,954)
112,738 (-1,476)
14,470 (-8,854)
28,855 (+1,601)
-47.59%
-1.29%
-37.96%
+5.87%
6,558 (-6,947)
112,738 (-1,554)
14,470 (-9,786)
28,855 (0)
-51.44%
-1.36%
-40.34%
0.00%
10,705 (-2,800)
112,738 (-1,554)
26,256 (0)
28,855 (0)
-20.73%
-1.36%
0.00%
0.00%
2 (-12)
1 (-19)
2 (-19)
30 (-19)
Governance 1,151,228 (0) owner 396 (0) 0.00% 896 (-662) -42.49% 396 (-2,000) -83.47% 2,396 (0) 0.00% 24 (-19)
L1AssetRouter 4,220,994 (0) bridgehubConfirmL2Transaction
bridgehubDeposit
bridgehubDepositBaseToken
encodeTxDataHash
initialize
setAssetHandlerAddressThisChain
setL1Erc20Bridge
setNativeTokenVault
4,936 (0)
10,169 (0)
646 (0)
2,059 (0)
45,482 (0)
7,650 (0)
4,794 (0)
4,763 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
19,565 (-2,126)
57,127 (-38,037)
56,129 (-2,793)
5,059 (-2,094)
140,056 (-92)
49,193 (+929)
24,407 (+118)
24,363 (+118)
-9.80%
-39.97%
-4.74%
-29.27%
-0.07%
+1.92%
+0.49%
+0.49%
26,880 (+2,000)
58,714 (-7,457)
46,926 (-18,283)
6,559 (0)
141,224 (0)
49,450 (0)
24,891 (0)
24,847 (0)
+8.04%
-11.27%
-28.04%
0.00%
0.00%
0.00%
0.00%
0.00%
26,880 (0)
106,654 (-197,712)
122,149 (0)
6,559 (-16,306)
141,224 (0)
49,450 (0)
24,891 (0)
24,847 (0)
0.00%
-64.96%
0.00%
-71.31%
0.00%
0.00%
0.00%
0.00%
3 (-2)
11 (-2)
9 (-4)
15 (-2)
82 (-7)
163 (-14)
83 (-7)
83 (-7)
MessageRoot 1,281,716 (0) addNewChain 21,860 (0) 0.00% 153,844 (-78,642) -33.83% 197,839 (-86,497) -30.42% 197,839 (-100,654) -33.72% 4 (-19)
MailboxFacet 2,956,805 (0) bridgehubRequestL2Transaction 16,326 (0) 0.00% 94,894 (-45,803) -32.55% 119,622 (-2,193) -1.80% 124,008 (-150,773) -54.87% 4 (-4)
Bridgehub 3,520,685 (-26,596) acceptOwnership
addStateTransitionManager
addToken
getHyperchain
initialize
l2TransactionBaseCost
owner
proveL1ToL2TransactionStatus
proveL2LogInclusion
removeStateTransitionManager
setAddresses
setPendingAdmin
stateTransitionManagerIsRegistered
tokenIsRegistered
transferOwnership
25,601 (+13,464)
23,896 (0)
24,134 (+110)
1,834 (-22)
24,232 (0)
2,325 (0)
442 (0)
0 (0)
0 (0)
23,895 (0)
51,109 (-16,112)
25,942 (0)
589 (0)
568 (0)
47,849 (+25,432)
+110.93%
0.00%
+0.46%
-1.19%
0.00%
0.00%
0.00%
+∞%
+∞%
0.00%
-23.97%
0.00%
0.00%
0.00%
+113.45%
25,601 (+4,284)
41,157 (+33)
36,592 (+258)
1,834 (-253)
24,232 (-7,750)
2,325 (-345)
2,331 (+39)
1,959 (+6)
2,096 (+23)
25,545 (-2)
51,109 (-16,112)
37,891 (+8)
1,255 (+1)
1,368 (-30)
47,849 (+8,092)
+20.10%
+0.08%
+0.71%
-12.12%
-24.23%
-12.92%
+1.70%
+0.31%
+1.11%
-0.01%
-23.97%
+0.02%
+0.08%
-2.15%
+20.35%
25,601 (0)
47,587 (0)
36,866 (+10,624)
1,834 (-22)
24,232 (0)
2,325 (0)
2,442 (0)
1,539 (0)
1,679 (+3)
25,905 (0)
51,109 (-16,112)
37,852 (0)
589 (0)
568 (0)
47,849 (0)
0.00%
0.00%
+40.48%
-1.19%
0.00%
0.00%
0.00%
0.00%
+0.18%
0.00%
-23.97%
0.00%
0.00%
0.00%
0.00%
25,601 (0)
47,587 (0)
47,609 (+110)
1,834 (-13,653)
24,232 (-24,359)
2,325 (-29,835)
2,442 (0)
4,720 (-21)
5,019 (-7)
26,362 (0)
51,109 (-16,112)
49,762 (0)
2,589 (0)
2,568 (0)
47,849 (0)
0.00%
0.00%
+0.23%
-88.16%
-50.13%
-92.77%
0.00%
-0.44%
-0.14%
0.00%
-23.97%
0.00%
0.00%
0.00%
0.00%
15 (-7)
3,584 (-7)
1,536 (-21)
256 (-31)
15 (-7)
256 (-3)
542 (-34)
512 (0)
512 (0)
2,048 (0)
512 (+505)
512 (0)
3,072 (-7)
1,280 (-33)
15 (-7)
L1ERC20Bridge 1,116,643 (0) initialize 23,625 (+1,266) +5.66% 23,625 (+1,108) +4.92% 23,625 (+1,266) +5.66% 23,625 (0) 0.00% 1 (-7)
L1GenesisUpgrade 2,791,705 (0) genesisUpgrade
upgrade
102,013 (0)
58,182 (0)
0.00%
0.00%
102,013 (-1,096)
58,182 (-274)
-1.06%
-0.47%
102,013 (-1,154)
58,182 (-289)
-1.12%
-0.49%
102,013 (-1,154)
58,182 (-289)
-1.12%
-0.49%
1 (-19)
1 (-19)
DiamondInit 568,496 (0) initialize 22,660 (0) 0.00% 414,556 (+2,339) +0.57% 424,265 (0) 0.00% 446,665 (0) 0.00% 91 (-22)
L1NativeTokenVault 1,937,741 (0) bridgeBurn
initialize
registerToken
5,371 (0)
23,150 (0)
484 (0)
0.00%
0.00%
0.00%
32,153 (-148)
49,994 (-26)
80,888 (+18)
-0.46%
-0.05%
+0.02%
29,349 (-3,657)
50,326 (0)
82,362 (0)
-11.08%
0.00%
0.00%
71,494 (0)
50,326 (0)
84,990 (0)
0.00%
0.00%
0.00%
19 (-4)
82 (-7)
195 (-7)
MerkleTest 468,218 (0) calculateRoot(bytes32[],uint256,bytes32) 606 (0) 0.00% 2,919 (-3) -0.10% 2,943 (0) 0.00% 2,987 (-11) -0.37% 261 (0)
MerkleTreeNoSort 534,636 (0) getProof 32,953 (0) 0.00% 33,182 (+4) +0.01% 33,193 (+22) +0.07% 33,215 (0) 0.00% 273 (0)
DummyStateTransitionManagerWBH 4,205,170 (0) setHyperchain 111,114 (0) 0.00% 111,151 (0) 0.00% 111,174 (+12) +0.01% 111,174 (0) 0.00% 768 (0)

kelemeno and others added 3 commits August 13, 2024 20:45
Co-authored-by: Stanislav Bezkorovainyi <stanislavbezkor@gmail.com>
Base automatically changed from kl/sync-layer-reorg to sync-layer-stable August 14, 2024 10:23
Copy link

Coverage after merging kl/l2-bridge-fixes into kl/sync-layer-reorg will be

89.42%

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.78%89.29%97.37%98.39%118, 133, 190, 247, 308, 352, 488, 505, 526, 707–708, 843
   L1ERC20Bridge.sol100%100%100%100%
   L1NativeTokenVault.sol96.12%97.62%84.62%97.30%252, 257, 45
contracts/bridgehub
   Bridgehub.sol79.53%50.75%87.10%94.02%103, 103, 141, 254–257, 259–261, 263, 319–320, 322, 322, 322, 365, 373–374, 377, 377, 377–378, 400, 438, 462–463, 542, 545–546, 550–551, 578–579, 610, 615, 82, 87, 92, 98
   MessageRoot.sol91.38%61.54%100%100%156, 162, 69, 76, 94
   STMDeploymentTracker.sol71.43%50%77.78%77.78%105, 107, 110, 122, 31, 54, 81, 84
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.sol73.85%68.18%75%76.92%52–53, 53, 53–54, 54, 54–55, 55, 55, 57–59, 62, 65, 83
   MessageHashing.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.sol73.74%51.35%62.16%85.71%145–147, 151, 204, 247, 254, 272, 278, 285, 297, 304, 311, 319, 326, 334, 341, 350, 350, 350, 352, 363, 365, 432, 446, 449, 464, 469, 488, 516, 83, 89, 89
   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.sol82.14%56.82%85%92.31%103, 103, 103–105, 131, 131, 131–132, 132, 132, 134, 155, 201–202, 204, 218–219, 226, 245–246, 251, 288, 298, 302, 82, 91
   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.sol83.19%66.67%84.09%84.85%104, 107, 113, 116, 127, 130, 172, 223, 229, 233, 64, 79, 84
   Mailbox.sol58.38%47.06%59.26%61.61%105, 121–122, 122, 122, 124–125, 133–135, 146, 157–158, 160–161, 163, 168, 172, 172–174, 174, 174–175, 178, 178, 178, 181, 183–184, 186, 191, 193, 196–197, 202–205, 208–209, 226, 232, 232, 232, 240, 245, 272, 301–302, 379, 390, 396, 535, 535, 535–536, 556, 65, 75, 97
   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,

@kelemeno kelemeno changed the base branch from sync-layer-stable to kl/sync-layer-reorg August 14, 2024 10:38
@kelemeno kelemeno merged commit 50c633c into kl/sync-layer-reorg Aug 14, 2024
@kelemeno kelemeno deleted the kl/l2-bridge-fixes branch August 14, 2024 10:39
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