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: Kl/sync layer reorg, multiple changes #864

Open
wants to merge 63 commits into
base: sync-layer-stable
Choose a base branch
from

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.

Copy link

github-actions bot commented Oct 14, 2024

Changes to gas cost

Generated at commit: 7e6fd024874e94d5512d16c0888a4db76f3be995, compared to commit: 5b8b0785e4f7bae0b6d09d2dcd3d2b324204c16d

🧾 Summary (100% most significant diffs)

Contract Method Avg (+/-) %
L1AssetRouter bridgehubDeposit
bridgehubDepositBaseToken
depositLegacyErc20Bridge
finalizeDeposit
finalizeWithdrawal
setAssetHandlerAddressThisChain
transferFundsToNTV
+1,796 ❌
+2,980 ❌
+2,214 ❌
+51 ❌
+34 ❌
+62 ❌
+2,903 ❌
+2.95%
+5.12%
+1.65%
+0.11%
+0.04%
+0.16%
+35.24%
L1ERC20Bridge deposit(address,address,uint256,uint256,uint256)
deposit(address,address,uint256,uint256,uint256,address)
+13,372 ❌
+18,399 ❌
+21.14%
+25.44%
ChainAdmin addRestriction
setUpgradeTimestamp
-10,721 ✅
-307 ✅
-16.60%
-0.68%
AccessControlRestriction grantRole
setRequiredRoleForCall
setRequiredRoleForFallback
+104 ❌
-4,207 ✅
-4,128 ✅
+0.20%
-8.42%
-8.36%
DiamondProxy finalizeEthWithdrawal
getChainId
requestL2Transaction
+245 ❌
+500 ❌
+6 ❌
+0.31%
+5.45%
+0.00%
L1NativeTokenVault bridgeBurn
bridgeMint
ensureTokenIsRegistered
getERC20Getters
registerEthToken
registerToken
updateChainBalancesFromSharedBridge
+3,846 ❌
+51 ❌
+83 ❌
-8 ✅
+60 ❌
+81 ❌
+22 ❌
+4.48%
+0.17%
+0.07%
-0.17%
+0.06%
+0.07%
+0.08%
TransparentUpgradeableProxy bridgeRecoverFailedTransfer
bridgehubDeposit
bridgehubDepositBaseToken
claimFailedDeposit
createNewChain
depositLegacyErc20Bridge
encodeTxDataHash
finalizeDeposit
finalizeWithdrawal
getERC20Getters
registerEthToken
registerToken
setAllowedData
setSelectorIsValidated
updateChainBalancesFromSharedBridge
validateCall
+6 ❌
+1,796 ❌
+2,980 ❌
+7 ❌
+6 ❌
+2,214 ❌
+8 ❌
+62 ❌
+34 ❌
-8 ✅
+60 ❌
+81 ❌
-50 ✅
-24 ✅
+22 ❌
-599 ✅
+0.01%
+2.03%
+3.51%
+0.01%
+0.00%
+1.42%
+0.20%
+0.05%
+0.03%
-0.07%
+0.05%
+0.05%
-0.09%
-0.04%
+0.04%
-2.01%
Bridgehub ctmAssetIdFromChainId -169 ✅ -3.44%
DummyBridgehubSetter createNewChain
removeChainTypeManager
requestL2TransactionDirect
requestL2TransactionTwoBridges
setAddresses
setPendingAdmin
-2,695 ✅
+7 ❌
+1,169 ❌
+2,335 ❌
+2 ❌
+1 ❌
-2.47%
+0.03%
+1.21%
+1.57%
+0.00%
+0.00%
L1Nullifier bridgeRecoverFailedTransfer
claimFailedDeposit
encodeTxDataHash
finalizeDeposit
+6 ❌
+7 ❌
+8 ❌
+37 ❌
+0.01%
+0.01%
+0.23%
+0.05%
L2SharedBridgeLegacy initialize -2,808 ✅ -0.12%
TestnetERC20Token approve
transfer
-2 ✅
+17 ❌
-0.00%
+0.04%
MerkleTest calculateRoot(bytes32[],uint256,bytes32) -1 ✅ -0.03%
BridgedStandardERC20 bridgeInitialize -71 ✅ -0.03%
DeployL1Script runForTest +2,732 ❌ +0.01%
DummyChainTypeManagerWBH setZKChain +1 ❌ +0.00%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
L1AssetRouter 3,404,437 (+33,746) bridgehubDeposit
bridgehubDepositBaseToken
depositLegacyErc20Bridge
finalizeDeposit
finalizeWithdrawal
setAssetHandlerAddressThisChain
transferFundsToNTV
16,556 (0)
572 (0)
10,298 (0)
25,964 (+51)
26,129 (0)
29,685 (+62)
1,303 (0)
0.00%
0.00%
0.00%
+0.20%
0.00%
+0.21%
0.00%
62,663 (+1,796)
61,150 (+2,980)
136,712 (+2,214)
47,697 (+51)
84,684 (+34)
39,635 (+62)
11,140 (+2,903)
+2.95%
+5.12%
+1.65%
+0.11%
+0.04%
+0.16%
+35.24%
64,866 (+5,018)
53,177 (-8)
199,893 (+3,321)
46,726 (+51)
99,326 (+51)
39,635 (+62)
11,333 (+3,382)
+8.38%
-0.02%
+1.69%
+0.11%
+0.05%
+0.16%
+42.54%
118,961 (+5,381)
96,298 (+5,370)
199,946 (+3,321)
54,080 (+51)
112,170 (+51)
49,585 (+62)
37,712 (+5,340)
+4.74%
+5.91%
+1.69%
+0.09%
+0.05%
+0.13%
+16.50%
12 (0)
9 (0)
3 (0)
14 (0)
20 (0)
156 (0)
19 (0)
L1ERC20Bridge 1,238,384 (+54,756) deposit(address,address,uint256,uint256,uint256)
deposit(address,address,uint256,uint256,uint256,address)
27,875 (0)
28,071 (0)
0.00%
0.00%
76,620 (+13,372)
90,711 (+18,399)
+21.14%
+25.44%
102,354 (+24,532)
103,066 (+24,588)
+31.52%
+31.33%
119,840 (+25,047)
104,107 (+12,254)
+26.42%
+13.34%
12 (0)
6 (0)
ChainAdmin 835,028 (+50,152) addRestriction
setUpgradeTimestamp
21,897 (-2,306)
25,361 (0)
-9.53%
0.00%
53,867 (-10,721)
45,001 (-307)
-16.60%
-0.68%
75,759 (+3,093)
45,321 (+12)
+4.26%
+0.03%
82,979 (+10,313)
45,645 (0)
+14.19%
0.00%
9 (+3)
256 (0)
AccessControlRestriction 1,357,213 (+27,431) grantRole
setRequiredRoleForCall
setRequiredRoleForFallback
51,277 (+111)
24,360 (-24,327)
24,219 (-23,818)
+0.22%
-49.97%
-49.58%
51,505 (+104)
45,728 (-4,207)
45,242 (-4,128)
+0.20%
-8.42%
-8.36%
51,649 (+111)
49,094 (+35)
48,444 (+35)
+0.22%
+0.07%
+0.07%
51,649 (+111)
54,114 (0)
53,925 (0)
+0.22%
0.00%
0.00%
1,024 (0)
1,536 (+256)
1,536 (+256)
GettersFacet 922,106 (0) getAdmin 375 (0) 0.00% 2,193 (+152) +7.45% 2,375 (0) 0.00% 2,375 (0) 0.00% 11 (-1)
DiamondProxy 2,405,277 (0) finalizeEthWithdrawal
getAdmin
getChainId
getProtocolVersion
requestL2Transaction
util_setChainId
37,779 (0)
1,146 (0)
9,674 (+4,500)
5,152 (0)
33,295 (0)
28,944 (0)
0.00%
0.00%
+86.97%
0.00%
0.00%
0.00%
79,520 (+245)
5,191 (-38)
9,674 (+500)
8,902 (-107)
131,412 (+6)
33,777 (-38)
+0.31%
-0.73%
+5.45%
-1.19%
+0.00%
-0.11%
80,015 (-12)
5,146 (0)
9,674 (0)
9,652 (0)
170,048 (+12)
33,756 (0)
-0.01%
0.00%
0.00%
0.00%
+0.01%
0.00%
80,291 (0)
9,646 (0)
9,674 (0)
9,652 (0)
191,977 (0)
34,128 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
257 (0)
11 (-1)
9 (0)
6 (-1)
771 (0)
519 (0)
L1NativeTokenVault 3,496,299 (+172,824) bridgeBurn
bridgeMint
ensureTokenIsRegistered
getERC20Getters
registerEthToken
registerToken
updateChainBalancesFromSharedBridge
12,777 (0)
10,638 (+51)
753 (+22)
4,693 (-8)
94,984 (0)
693 (+22)
27,695 (+22)
0.00%
+0.48%
+3.01%
-0.17%
0.00%
+3.28%
+0.08%
89,719 (+3,846)
29,723 (+51)
113,885 (+83)
4,693 (-8)
100,089 (+60)
121,987 (+81)
27,695 (+22)
+4.48%
+0.17%
+0.07%
-0.17%
+0.06%
+0.07%
+0.08%
105,981 (+5,332)
31,237 (+51)
116,066 (+84)
4,693 (-8)
99,637 (+62)
122,442 (+84)
27,695 (+22)
+5.30%
+0.16%
+0.07%
-0.17%
+0.06%
+0.07%
+0.08%
105,981 (+5,332)
34,914 (+51)
116,066 (+84)
4,693 (-8)
106,768 (+62)
129,573 (+84)
27,695 (+22)
+5.30%
+0.15%
+0.07%
-0.17%
+0.06%
+0.06%
+0.08%
1,299 (0)
14 (0)
261 (0)
1 (0)
880 (0)
881 (0)
2 (0)
TransparentUpgradeableProxy 644,375 (0) allowAdminImplementation
bridgeRecoverFailedTransfer
bridgehubDeposit
bridgehubDepositBaseToken
claimFailedDeposit
createNewChain
depositLegacyErc20Bridge
encodeTxDataHash
finalizeDeposit
finalizeWithdrawal
getERC20Getters
registerEthToken
registerToken
setAllowedData
setSelectorIsValidated
updateChainBalancesFromSharedBridge
validateCall
54,663 (0)
45,682 (0)
46,736 (0)
29,946 (0)
49,282 (0)
55,179 (0)
39,966 (0)
2,727 (+8)
125,120 (+51)
56,800 (0)
11,917 (-8)
123,173 (0)
29,029 (+22)
55,427 (0)
54,716 (-22)
51,370 (+22)
18,190 (+10,087)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+0.29%
+0.04%
0.00%
-0.07%
0.00%
+0.08%
0.00%
-0.04%
+0.04%
+124.48%
54,914 (+10)
88,364 (+6)
90,052 (+1,796)
87,853 (+2,980)
87,030 (+7)
2,778,143 (+6)
158,115 (+2,214)
4,077 (+8)
131,627 (+62)
111,784 (+34)
11,917 (-8)
128,278 (+60)
150,543 (+81)
56,431 (-50)
54,746 (-24)
51,484 (+22)
29,191 (-599)
+0.02%
+0.01%
+2.03%
+3.51%
+0.01%
+0.00%
+1.42%
+0.20%
+0.05%
+0.03%
-0.07%
+0.05%
+0.05%
-0.09%
-0.04%
+0.04%
-2.01%
55,035 (0)
98,769 (+8)
94,614 (+4,979)
82,544 (-8)
95,113 (+8)
3,304,484 (+12)
217,157 (+3,321)
2,727 (+8)
131,627 (+62)
126,506 (+51)
11,917 (-8)
127,826 (+62)
151,002 (+84)
56,048 (-60)
54,764 (-22)
51,484 (+22)
29,135 (-2,794)
0.00%
+0.01%
+5.55%
-0.01%
+0.01%
+0.00%
+1.55%
+0.29%
+0.05%
+0.04%
-0.07%
+0.05%
+0.06%
-0.11%
-0.04%
+0.04%
-8.75%
55,035 (0)
110,235 (+8)
139,298 (+5,381)
120,865 (+5,370)
105,796 (+8)
3,530,804 (0)
217,222 (+3,321)
7,227 (+8)
138,135 (+73)
136,221 (+51)
11,917 (-8)
134,957 (+62)
158,133 (+84)
58,247 (+24)
54,764 (-22)
51,598 (+22)
35,396 (-4,228)
0.00%
+0.01%
+4.02%
+4.65%
+0.01%
0.00%
+1.55%
+0.11%
+0.05%
+0.04%
-0.07%
+0.05%
+0.05%
+0.04%
-0.04%
+0.04%
-10.67%
258 (0)
4 (0)
12 (0)
9 (0)
8 (0)
11 (0)
3 (0)
10 (0)
2 (0)
20 (0)
1 (0)
880 (0)
881 (0)
257 (0)
258 (0)
2 (0)
9 (-1)
Bridgehub 4,281,381 (-2,412) ctmAssetIdFromChainId
getZKChain
l1CtmDeployer
setAddresses
sharedBridge
4,744 (-169)
0 (0)
414 (0)
50,873 (0)
387 (0)
-3.44%
+∞%
0.00%
0.00%
0.00%
4,744 (-169)
2,946 (+4)
2,339 (-3)
50,966 (-1)
949 (+17)
-3.44%
+0.14%
-0.13%
-0.00%
+1.82%
4,744 (-169)
2,770 (0)
2,414 (0)
50,873 (0)
387 (0)
-3.44%
0.00%
0.00%
0.00%
0.00%
4,744 (-169)
5,051 (0)
2,414 (0)
51,113 (0)
2,387 (0)
-3.44%
0.00%
0.00%
0.00%
0.00%
4 (-1)
57 (-3)
27 (-1)
59 (-2)
32 (-1)
DummyBridgehubSetter 4,310,705 (-2,354) addChainTypeManager
createNewChain
proveL1ToL2TransactionStatus
proveL2LogInclusion
proveL2MessageInclusion
removeChainTypeManager
requestL2TransactionDirect
requestL2TransactionTwoBridges
setAddresses
setPendingAdmin
23,895 (0)
29,369 (+312)
0 (0)
0 (0)
0 (0)
23,844 (+12)
33,020 (0)
31,017 (+12)
24,336 (-12)
25,999 (-12)
0.00%
+1.07%
+∞%
+∞%
+∞%
+0.05%
0.00%
+0.04%
-0.05%
-0.05%
44,150 (+2)
106,405 (-2,695)
1,388 (-2)
1,524 (+11)
1,621 (+16)
25,476 (+7)
97,410 (+1,169)
151,369 (+2,335)
66,065 (+2)
47,721 (+1)
+0.00%
-2.47%
-0.14%
+0.73%
+1.00%
+0.03%
+1.21%
+1.57%
+0.00%
+0.00%
47,621 (0)
36,509 (0)
985 (-6)
1,100 (-3)
1,191 (0)
25,832 (0)
77,325 (+1,256)
46,817 (-378)
71,205 (0)
49,885 (0)
0.00%
0.00%
-0.61%
-0.27%
0.00%
0.00%
+1.65%
-0.80%
0.00%
0.00%
47,621 (0)
879,109 (-11,346)
3,632 (+7)
3,873 (0)
4,055 (-14)
26,244 (0)
235,543 (+8,621)
434,482 (+8,843)
91,345 (0)
49,897 (0)
0.00%
-1.27%
+0.19%
0.00%
-0.34%
0.00%
+3.80%
+2.08%
0.00%
0.00%
6,656 (0)
2,560 (0)
512 (0)
512 (0)
512 (0)
2,048 (0)
1,024 (0)
1,536 (0)
3,328 (0)
4,864 (0)
MailboxFacet 2,743,534 (0) finalizeEthWithdrawal 8,251 (0) 0.00% 52,191 (+246) +0.47% 52,735 (0) 0.00% 52,735 (0) 0.00% 257 (0)
L1Nullifier 2,584,411 (-348) bridgeRecoverFailedTransfer
claimFailedDeposit
encodeTxDataHash
finalizeDeposit
14,140 (0)
18,793 (0)
2,063 (+8)
10,085 (0)
0.00%
0.00%
+0.39%
0.00%
60,624 (+6)
62,688 (+7)
3,413 (+8)
72,104 (+37)
+0.01%
+0.01%
+0.23%
+0.05%
73,394 (+8)
70,826 (+8)
2,063 (+8)
87,012 (+51)
+0.01%
+0.01%
+0.39%
+0.06%
81,570 (+8)
87,483 (+8)
6,563 (+8)
114,752 (+73)
+0.01%
+0.01%
+0.12%
+0.06%
4 (0)
8 (0)
10 (0)
22 (0)
ChainTypeManager 3,826,188 (0) createNewChain
initialize
1,046 (0)
22,764 (0)
0.00%
0.00%
3,231,958 (-6,930)
123,752 (+180)
-0.21%
+0.15%
3,474,483 (0)
210,092 (0)
0.00%
0.00%
3,476,483 (0)
228,483 (0)
0.00%
0.00%
34 (-1)
79 (-2)
L2SharedBridgeLegacy 3,253,692 (-3,058) initialize 2,264,478 (-2,808) -0.12% 2,264,478 (-2,808) -0.12% 2,264,478 (-2,808) -0.12% 2,264,478 (-2,808) -0.12% 6 (0)
DiamondInit 439,771 (0) initialize 22,599 (0) 0.00% 376,387 (-148) -0.04% 378,218 (0) 0.00% 398,118 (0) 0.00% 146 (-1)
TestnetERC20Token 640,427 (0) allowance
approve
mint
transfer
845 (0)
24,272 (0)
34,031 (0)
46,377 (0)
0.00%
0.00%
0.00%
0.00%
2,842 (+1)
46,257 (-2)
61,797 (-2)
46,734 (+17)
+0.04%
-0.00%
-0.00%
+0.04%
2,845 (0)
46,208 (-12)
68,255 (0)
46,677 (+36)
0.00%
-0.03%
0.00%
+0.08%
2,845 (0)
46,568 (0)
68,615 (0)
46,977 (0)
0.00%
0.00%
0.00%
0.00%
3,116 (+1,035)
1,527 (0)
1,704 (0)
257 (0)
MerkleTest 463,586 (+12) calculateRoot(bytes32[],uint256,bytes32) 571 (0) 0.00% 2,930 (-1) -0.03% 2,982 (0) 0.00% 3,037 (+11) +0.36% 265 (0)
BridgedStandardERC20 2,119,536 (-3,056) bridgeInitialize 226,151 (-71) -0.03% 226,151 (-71) -0.03% 226,151 (-71) -0.03% 226,151 (-71) -0.03% 3 (0)
DeployL1Script 58,093,957 (+373,558) runForTest 18,377,704 (+2,732) +0.01% 18,377,704 (+2,732) +0.01% 18,377,704 (+2,732) +0.01% 18,377,704 (+2,732) +0.01% 3 (0)
L1GenesisUpgrade 2,678,069 (0) genesisUpgrade 113,912 (0) 0.00% 114,474 (+17) +0.01% 113,912 (0) 0.00% 115,912 (0) 0.00% 32 (-1)
AdminFacet 3,416,810 (+2,600) genesisUpgrade 125,221 (0) 0.00% 125,783 (+17) +0.01% 125,221 (0) 0.00% 127,221 (0) 0.00% 32 (-1)
MerkleTreeNoSort 534,636 (0) getProof 2,594 (0) 0.00% 32,740 (+2) +0.01% 33,193 (0) 0.00% 33,215 (0) 0.00% 277 (0)
DummyChainTypeManagerWBH 3,848,191 (0) setZKChain 44,101 (0) 0.00% 44,140 (+1) +0.00% 44,155 (-6) -0.01% 44,161 (0) 0.00% 256 (0)
L2WrappedBaseToken 1,652,822 (+12)
DiamondCutTestContract 1,826,384 (-12)
FullMerkleTest 796,157 (-12)
Governance 987,196 (-12)
ValidatorTimelock 785,851 (+12)
DefaultUpgrade 1,332,833 (-12)
GettersFacetWrapper 1,729,382 (+12)

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