Skip to content

chore: use Locker with persistent storage#49

Draft
0xIryna wants to merge 2 commits into
mainfrom
linea-deployment
Draft

chore: use Locker with persistent storage#49
0xIryna wants to merge 2 commits into
mainfrom
linea-deployment

Conversation

@0xIryna
Copy link
Copy Markdown
Contributor

@0xIryna 0xIryna commented Aug 11, 2025

Description

Modify Uniswap's Locker contract that uses SLOAD and SSTORE instead of TLOAD and TSTORE to allow deployments for the chains which do not natively support TLOAD, TSTORE.

Note

The fix is temporary as transient storage will be supported by the network in a future upgrade.
Do not merge into main branch.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 11, 2025

Changes to gas cost

Generated at commit: 3239afc6a84e11d22d9bfcc1d0d13053de8214df, compared to commit: 909c536deac54de5a5bc3305f57e310c327fb441

🧾 Summary (20% most significant diffs)

Contract Method Avg (+/-) %
SwapFacility swap
swapInM
swapInMWithPermit(address,uint256,address,uint256,bytes)
swapInMWithPermit(address,uint256,address,uint256,uint8,bytes32,bytes32)
swapOutM
swapOutMWithPermit(address,uint256,address,uint256,bytes)
swapOutMWithPermit(address,uint256,address,uint256,uint8,bytes32,bytes32)
+21,097 ❌
+21,938 ❌
+21,954 ❌
+21,954 ❌
+21,319 ❌
+21,954 ❌
+21,954 ❌
+12.49%
+13.87%
+12.61%
+10.38%
+17.03%
+11.16%
+10.85%
TransparentUpgradeableProxy balanceWithYieldOf
currentIndex
projectedTotalSupply
setFeeRecipient
swap
swapInM
swapInMWithPermit(address,uint256,address,uint256,bytes)
swapOutM
swapOutMWithPermit(address,uint256,address,uint256,bytes)
-1,806 ✅
-1,134 ✅
-1,636 ✅
-8,818 ✅
+19,618 ❌
+19,668 ❌
+17,563 ❌
+18,714 ❌
+17,563 ❌
-10.64%
-10.27%
-13.51%
-16.11%
+12.83%
+12.67%
+10.83%
+15.55%
+9.75%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
SwapFacility 2,823,953 (+103,606) msgSender
swap
swapInM
swapInMWithPermit(address,uint256,address,uint256,bytes)
swapInMWithPermit(address,uint256,address,uint256,uint8,bytes32,bytes32)
swapOutM
swapOutMWithPermit(address,uint256,address,uint256,bytes)
swapOutMWithPermit(address,uint256,address,uint256,uint8,bytes32,bytes32)
swapWithPermit
437 (+71)
33,539 (+21,900)
33,445 (+21,889)
159,681 (+21,954)
178,755 (+21,954)
33,436 (+21,900)
218,636 (+21,954)
213,282 (+21,954)
312,585 (+21,954)
+19.40%
+188.16%
+189.42%
+15.94%
+14.00%
+189.84%
+11.16%
+11.47%
+7.55%
2,223 (+1,857)
190,061 (+21,097)
180,104 (+21,938)
196,070 (+21,954)
233,477 (+21,954)
146,510 (+21,319)
218,636 (+21,954)
224,229 (+21,954)
312,585 (+21,954)
+507.38%
+12.49%
+13.87%
+12.61%
+10.38%
+17.03%
+11.16%
+10.85%
+7.55%
2,437 (+2,071)
157,132 (+19,954)
174,829 (+21,943)
193,627 (+21,954)
236,740 (+21,954)
143,980 (+21,918)
218,636 (+21,954)
224,229 (+21,954)
312,585 (+21,954)
+565.85%
+14.55%
+14.35%
+12.79%
+10.22%
+17.96%
+11.16%
+10.85%
+7.55%
2,437 (+2,071)
299,096 (+21,954)
253,934 (+21,943)
237,347 (+21,954)
274,008 (+21,954)
237,616 (+21,954)
218,636 (+21,954)
235,176 (+21,954)
312,585 (+21,954)
+565.85%
+7.92%
+9.46%
+10.19%
+8.71%
+10.18%
+11.16%
+10.30%
+7.55%
1,169 (0)
23 (0)
69 (0)
4 (0)
6 (0)
32 (0)
1 (0)
2 (0)
1 (0)
TransparentUpgradeableProxy 1,043,495 (0) ONE_HUNDRED_PERCENT
accruedFeeOf
accruedYieldAndFeeOf
accruedYieldOf
balanceWithYieldOf
claimFee
claimFor(address)
currentIndex
enableEarning
fallback
feeRecipient
grantRole
hasRole
isEarningEnabled
latestEarnerRateAccrualTimestamp
msgSender
principalOf
projectedTotalSupply
setAccountInfo(address,bool,uint16)
setAccountOf(address,uint256,uint112)
setAccountOf(address,uint256,uint112,bool,uint16)
setBalanceOf
setFeeRate
setFeeRecipient
setIsEarningEnabled
setLatestIndex
setLatestRate
setLatestUpdateTimestamp
setTotalPrincipal
setTotalSupply
swap
swapInM
swapInMWithPermit(address,uint256,address,uint256,bytes)
swapInMWithPermit(address,uint256,address,uint256,uint8,bytes32,bytes32)
swapOutM
swapOutMWithPermit(address,uint256,address,uint256,bytes)
swapOutMWithPermit(address,uint256,address,uint256,uint8,bytes32,bytes32)
swapWithPermit
totalAccruedFee
totalAccruedYield
totalPrincipal
transfer
unwrap
wrap
5,229 (0)
17,559 (0)
17,638 (0)
14,948 (0)
15,166 (0)
36,425 (0)
26,548 (0)
7,457 (0)
28,369 (0)
0 (-1,012)
7,301 (0)
34,102 (0)
7,604 (0)
7,330 (0)
5,193 (0)
0 (0)
7,571 (0)
10,478 (0)
29,331 (0)
31,712 (0)
30,149 (0)
49,053 (0)
28,918 (0)
28,933 (0)
28,739 (0)
28,727 (0)
28,714 (0)
28,680 (0)
28,693 (0)
28,627 (0)
60,580 (+21,900)
60,100 (+21,889)
150,571 (+17,563)
165,596 (+17,563)
60,091 (+21,900)
197,725 (+17,563)
193,218 (+17,563)
272,960 (+17,564)
15,292 (0)
11,911 (0)
7,323 (0)
26,855 (0)
27,450 (0)
27,253 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
-100.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+∞%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+56.62%
+57.28%
+13.20%
+11.86%
+57.34%
+9.75%
+10.00%
+6.88%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
5,240 (-3)
17,574 (-325)
17,655 (-263)
16,297 (-663)
15,167 (-1,806)
94,221 (-22)
68,313 (+3,295)
9,912 (-1,134)
75,542 (-1,011)
18,776 (-23)
7,302 (-3)
56,165 (-18)
7,619 (-8)
7,958 (+60)
7,879 (-10)
6,091 (+3,366)
7,571 (-8)
10,478 (-1,636)
60,312 (-2,306)
70,668 (-43)
61,156 (+9)
49,149 (-4)
38,406 (-21)
45,919 (-8,818)
30,146 (-17)
31,492 (+19)
30,355 (-6)
31,181 (+11)
31,488 (+1)
48,461 (+1)
172,473 (+19,618)
174,887 (+19,668)
179,682 (+17,563)
209,380 (+17,563)
139,083 (+18,714)
197,725 (+17,563)
201,975 (+17,563)
272,960 (+17,564)
15,696 (-7)
12,299 (-1)
7,323 (-11)
54,172 (+2)
57,325 (+10)
111,916 (-50)
-0.06%
-1.82%
-1.47%
-3.91%
-10.64%
-0.02%
+5.07%
-10.27%
-1.32%
-0.12%
-0.04%
-0.03%
-0.10%
+0.76%
-0.13%
+123.52%
-0.11%
-13.51%
-3.68%
-0.06%
+0.01%
-0.01%
-0.05%
-16.11%
-0.06%
+0.06%
-0.02%
+0.04%
+0.00%
+0.00%
+12.83%
+12.67%
+10.83%
+9.16%
+15.55%
+9.75%
+9.52%
+6.88%
-0.04%
-0.01%
-0.15%
+0.00%
+0.02%
-0.04%
5,240 (-11)
17,572 (-599)
17,661 (0)
17,453 (-119)
15,166 (-3,245)
94,105 (-739)
67,663 (0)
10,230 (0)
77,672 (0)
10,230 (0)
7,301 (0)
56,300 (0)
7,626 (0)
7,435 (-105)
10,495 (0)
7,352 (+6,571)
7,571 (-8)
10,478 (-3,001)
32,076 (-32,661)
71,656 (+12)
55,149 (+24)
49,089 (0)
37,339 (0)
31,279 (-19,414)
31,551 (0)
31,551 (0)
31,514 (0)
31,504 (0)
31,541 (0)
48,575 (0)
157,562 (+19,954)
179,753 (+21,943)
177,728 (+17,564)
211,989 (+17,563)
136,690 (+17,535)
197,725 (+17,563)
201,975 (+17,563)
272,960 (+17,564)
16,031 (0)
12,650 (0)
7,323 (-11)
36,153 (0)
32,195 (0)
118,863 (0)
-0.21%
-3.30%
0.00%
-0.68%
-17.63%
-0.78%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
-1.39%
0.00%
+841.36%
-0.11%
-22.26%
-50.45%
+0.02%
+0.04%
0.00%
0.00%
-38.30%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+14.50%
+13.90%
+10.97%
+9.03%
+14.72%
+9.75%
+9.52%
+6.88%
0.00%
0.00%
-0.15%
0.00%
0.00%
0.00%
5,251 (0)
17,582 (-599)
17,661 (-577)
17,582 (-599)
15,169 (-3,252)
111,944 (0)
105,485 (0)
12,690 (-511)
102,124 (0)
138,035 (+2,071)
7,312 (-11)
56,300 (0)
7,635 (-22)
10,678 (0)
10,495 (0)
7,352 (+2,071)
7,571 (-17)
10,478 (-3,001)
110,800 (0)
71,860 (0)
72,333 (0)
49,401 (0)
55,483 (0)
70,108 (-28,716)
31,551 (0)
31,551 (0)
31,526 (0)
31,528 (0)
31,661 (0)
48,707 (0)
261,096 (+17,563)
224,658 (+13,179)
212,704 (+17,564)
241,808 (+17,563)
211,604 (+17,564)
197,725 (+17,563)
210,733 (+17,563)
272,960 (+17,564)
19,149 (0)
12,653 (0)
7,323 (-22)
75,478 (0)
86,417 (0)
119,019 (0)
0.00%
-3.29%
-3.16%
-3.29%
-17.65%
0.00%
0.00%
-3.87%
0.00%
+1.52%
-0.15%
0.00%
-0.29%
0.00%
0.00%
+39.22%
-0.22%
-22.26%
0.00%
0.00%
0.00%
0.00%
0.00%
-29.06%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+7.21%
+6.23%
+9.00%
+7.83%
+9.05%
+9.75%
+9.09%
+6.88%
0.00%
0.00%
-0.30%
0.00%
0.00%
0.00%
2 (-1)
12 (-14)
6 (-5)
33 (-18)
8 (-10)
260 (0)
5 (-6)
19 (-10)
72 (-6)
31,455 (+521)
6 (-1)
336 (-53)
7 (-2)
6 (-1)
526 (-10)
651 (-404)
14 (-14)
10 (-12)
11 (-12)
1,811 (0)
1,244 (-1)
503 (-2)
3,333 (0)
5 (-1)
2,836 (0)
2,817 (0)
1,042 (0)
512 (0)
257 (0)
260 (0)
18 (0)
68 (-1)
4 (0)
6 (0)
32 (0)
1 (0)
2 (0)
1 (0)
1,530 (-4)
929 (-2)
12 (-12)
261 (0)
262 (0)
140 (-1)
UniswapV3SwapAdapter 2,019,265 (+20,103) msgSender
swapIn
swapOut
415 (+71)
47,873 (+21,900)
47,808 (+21,900)
+20.64%
+84.32%
+84.53%
415 (+71)
2,751,654 (+21,985)
2,712,282 (+18,570)
+20.64%
+0.81%
+0.69%
415 (+71)
136,587 (+17,728)
126,418 (+11,941)
+20.64%
+14.92%
+10.43%
415 (+71)
25,794,077 (+4,108)
25,481,097 (+1,983)
+20.64%
+0.02%
+0.01%
5 (0)
10 (0)
10 (0)
MExtensionHarness 2,750,390 (0) transfer
unwrap
wrap
552 (0)
478 (0)
477 (0)
0.00%
0.00%
0.00%
18,325 (+1,177)
27,271 (+3,990)
59,485 (+1,630)
+6.86%
+17.14%
+2.82%
30,183 (+25,495)
10,599 (+2,071)
61,547 (+2,071)
+543.84%
+24.28%
+3.48%
30,183 (0)
44,534 (+2,071)
61,547 (+2,071)
0.00%
+4.88%
+3.48%
260 (0)
262 (0)
264 (0)
MYieldFeeHarness 5,059,779 (0) accruedYieldOf
balanceWithYieldOf
claimFee
currentIndex
projectedTotalSupply
setAccountOf
setFeeRate
setIsEarningEnabled
setLatestIndex
setLatestRate
setLatestUpdateTimestamp
setTotalPrincipal
setTotalSupply
totalAccruedFee
totalAccruedYield
transfer
unwrap
wrap
9,291 (0)
9,509 (0)
10,446 (0)
4,576 (0)
4,824 (0)
5,100 (0)
2,801 (0)
2,632 (0)
2,572 (0)
2,595 (0)
2,573 (0)
2,607 (0)
2,542 (0)
10,377 (0)
6,996 (0)
552 (0)
8,318 (+2,071)
8,324 (+2,071)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+33.15%
+33.12%
9,666 (-6)
9,885 (-10)
68,242 (-22)
4,943 (-4)
5,210 (-6)
43,876 (-44)
11,637 (-7)
4,030 (-15)
5,314 (+20)
4,458 (-16)
5,099 (+22)
5,320 (-2)
20,319 (-55)
10,781 (-7)
7,384 (-1)
14,305 (-195)
37,183 (+1,620)
66,596 (+1,997)
-0.06%
-0.10%
-0.03%
-0.08%
-0.12%
-0.10%
-0.06%
-0.37%
+0.38%
-0.36%
+0.43%
-0.04%
-0.27%
-0.06%
-0.01%
-1.34%
+4.56%
+3.09%
10,030 (0)
10,248 (0)
68,126 (-739)
4,576 (-739)
5,563 (0)
44,900 (0)
11,208 (0)
2,632 (-2,800)
5,372 (0)
5,395 (0)
5,373 (0)
5,407 (0)
22,442 (0)
11,116 (0)
7,735 (0)
4,725 (0)
10,597 (+2,071)
64,877 (+2,071)
0.00%
0.00%
-1.07%
-13.90%
0.00%
0.00%
0.00%
-51.55%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+24.29%
+3.30%
10,033 (0)
10,251 (0)
85,965 (0)
5,315 (0)
5,563 (0)
44,900 (0)
21,011 (0)
5,432 (0)
5,372 (0)
5,395 (0)
5,373 (0)
5,407 (0)
22,442 (0)
14,234 (0)
7,738 (0)
62,898 (0)
87,083 (+71)
132,506 (+71)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+0.08%
+0.05%
1,645 (-6)
2,264 (-18)
260 (0)
6,707 (0)
752 (-4)
1,811 (0)
2,821 (0)
2,579 (0)
2,561 (0)
529 (0)
256 (0)
2,572 (0)
2,572 (0)
1,530 (-4)
929 (-2)
264 (0)
266 (0)
271 (0)
MockM 627,532 (0) currentIndex
earnerRate
setBalanceOf
setLatestUpdateTimestamp
0 (0)
0 (0)
24,182 (0)
23,698 (0)
+∞%
+∞%
0.00%
0.00%
2,308 (-1)
155 (+2)
40,138 (-18)
34,860 (0)
-0.04%
+1.31%
-0.04%
0.00%
2,379 (0)
0 (0)
44,106 (0)
26,558 (0)
0.00%
+∞%
0.00%
0.00%
2,379 (0)
2,389 (0)
44,466 (0)
43,658 (+12)
0.00%
0.00%
0.00%
+0.03%
553 (-1)
138 (-2)
2,944 (-7)
516 (0)
MSpokeYieldFeeHarness 5,176,216 (0) currentIndex
setFeeRate
setIsEarningEnabled
setLatestIndex
setLatestRate
4,576 (0)
7,091 (0)
2,632 (0)
2,572 (0)
2,595 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
7,669 (-69)
15,826 (-98)
4,070 (-32)
5,317 (+11)
4,003 (+6)
-0.89%
-0.62%
-0.78%
+0.21%
+0.15%
10,584 (0)
11,208 (0)
5,432 (0)
5,372 (0)
5,395 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
10,584 (0)
29,352 (0)
5,432 (0)
5,372 (0)
5,395 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
775 (0)
512 (0)
257 (0)
256 (0)
513 (0)
MYieldToOneHarness 3,838,193 (0) balanceOf
unwrap
wrap
594 (0)
3,181 (0)
3,306 (0)
0.00%
0.00%
0.00%
2,429 (-1)
39,111 (+227)
71,486 (+142)
-0.04%
+0.58%
+0.20%
2,594 (0)
28,776 (+71)
77,338 (+71)
0.00%
+0.25%
+0.09%
2,594 (0)
82,387 (+71)
104,262 (+71)
0.00%
+0.09%
+0.07%
609 (-2)
38 (0)
55 (0)
MEarnerManager 4,539,741 (0) unwrap
wrap
80,741 (+71)
69,196 (+71)
+0.09%
+0.10%
82,420 (+71)
98,738 (+71)
+0.09%
+0.07%
80,741 (+71)
103,527 (+71)
+0.09%
+0.07%
85,778 (+71)
114,596 (+71)
+0.08%
+0.06%
3 (0)
12 (0)
MEarnerManagerHarness 4,779,490 (0) setAccountOf
unwrap
wrap
5,269 (0)
965 (0)
972 (0)
0.00%
0.00%
0.00%
34,138 (+7)
30,803 (+8)
84,832 (-52)
+0.02%
+0.03%
-0.06%
27,969 (0)
5,521 (0)
92,361 (0)
0.00%
0.00%
0.00%
45,069 (0)
59,759 (0)
92,361 (0)
0.00%
0.00%
0.00%
1,244 (-1)
262 (0)
141 (-1)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 11, 2025

LCOV of commit 55c41d9 during Forge Coverage #236

Summary coverage rate:
  lines......: 98.4% (690 of 701 lines)
  functions..: 96.7% (176 of 182 functions)
  branches...: no data found

Files changed coverage rate:
                                                   |Lines       |Functions  |Branches    
  Filename                                         |Rate     Num|Rate    Num|Rate     Num
  =======================================================================================
  src/swap/ReentrancyLock.sol                      |31.6%     19| 0.0%     5|    -      0
  src/swap/UniswapV3SwapAdapter.sol                |17.1%     70| 0.0%    12|    -      0
  src/swap/libs/Locker.sol                         |50.0%      4| 0.0%     2|    -      0
  src/swap/libs/ReentrancyLock.sol                 |33.3%      6| 0.0%     2|    -      0

@PierrickGT PierrickGT changed the title chore: use Locker with persistent storage for Linea chore: use Locker with persistent storage Aug 11, 2025
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