Skip to content

chore: replace transient storage Locker with sstore/sload variant#106

Draft
Khrafts wants to merge 1 commit into
mainfrom
feat/london
Draft

chore: replace transient storage Locker with sstore/sload variant#106
Khrafts wants to merge 1 commit into
mainfrom
feat/london

Conversation

@Khrafts
Copy link
Copy Markdown
Member

@Khrafts Khrafts commented Mar 4, 2026

Add local Locker library using sstore/sload instead of tstore/tload for compatibility with pre-Cancun chains. Use Uniswap version when deploying to chains that support transient storage.

Add local Locker library using sstore/sload instead of tstore/tload
for compatibility with pre-Cancun chains. Use Uniswap version when
deploying to chains that support transient storage.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 4, 2026

Changes to gas cost

Generated at commit: 621f516d72d9a9791192b9fa835fc86a96851a8e, compared to commit: 71a92d5578679975cd8a5864a54a2af2a478230e

🧾 Summary (20% most significant diffs)

Contract Method Avg (+/-) %
SwapFacility replaceAssetWithM
replaceAssetWithMWithPermit(address,address,address,uint256,address,uint256,bytes)
replaceAssetWithMWithPermit(address,address,address,uint256,address,uint256,uint8,bytes32,bytes32)
swap
swapWithPermit(address,address,uint256,address,uint256,bytes)
swapWithPermit(address,address,uint256,address,uint256,uint8,bytes32,bytes32)
+20,405 ❌
+21,954 ❌
+21,954 ❌
+21,231 ❌
+21,954 ❌
+21,954 ❌
+15.04%
+7.50%
+7.52%
+13.11%
+9.97%
+10.56%
TransparentUpgradeableProxy accruedYieldOf
approve
balanceWithYieldOf
disableEarning
msgSender
pause
projectedTotalSupply
replaceAssetWithM
replaceAssetWithMWithPermit(address,address,address,uint256,address,uint256,bytes)
replaceAssetWithMWithPermit(address,address,address,uint256,address,uint256,uint8,bytes32,bytes32)
setFeeRecipient
swap
swapWithPermit(address,address,uint256,address,uint256,bytes)
swapWithPermit(address,address,uint256,address,uint256,uint8,bytes32,bytes32)
transfer
-6,145 ✅
-2,178 ✅
+3,658 ❌
-3,240 ✅
+71 ❌
+2,175 ❌
+3,251 ❌
+19,840 ❌
+17,563 ❌
+17,563 ❌
+2,801 ❌
+19,878 ❌
+17,563 ❌
+17,563 ❌
-6,175 ✅
-43.36%
-5.42%
+24.75%
-6.73%
+8.94%
+4.37%
+31.99%
+12.84%
+6.82%
+6.84%
+4.44%
+12.22%
+8.82%
+9.28%
-8.23%
JMIExtensionHarness unwrap +2,816 ❌ +8.61%
MYieldFeeHarness unwrap +1,972 ❌ +4.84%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
SwapFacility 3,592,546 (+102,978) msgSender
replaceAssetWithM
replaceAssetWithMWithPermit(address,address,address,uint256,address,uint256,bytes)
replaceAssetWithMWithPermit(address,address,address,uint256,address,uint256,uint8,bytes32,bytes32)
swap
swapWithPermit(address,address,uint256,address,uint256,bytes)
swapWithPermit(address,address,uint256,address,uint256,uint8,bytes32,bytes32)
450 (+71)
27,336 (+21,900)
314,483 (+21,954)
313,955 (+21,954)
27,278 (+21,900)
242,092 (+21,954)
161,615 (+21,954)
+18.73%
+402.87%
+7.50%
+7.52%
+407.21%
+9.97%
+15.72%
1,875 (+1,496)
156,105 (+20,405)
314,483 (+21,954)
313,955 (+21,954)
183,121 (+21,231)
242,092 (+21,954)
229,845 (+21,954)
+394.72%
+15.04%
+7.50%
+7.52%
+13.11%
+9.97%
+10.56%
2,450 (+2,071)
170,305 (+19,954)
314,483 (+21,954)
313,955 (+21,954)
178,415 (+20,796)
242,092 (+21,954)
223,055 (+21,954)
+546.44%
+13.27%
+7.50%
+7.52%
+13.19%
+9.97%
+10.92%
2,450 (+2,071)
261,342 (+21,954)
314,483 (+21,954)
313,955 (+21,954)
335,841 (+22,025)
242,092 (+21,954)
317,616 (+21,954)
+546.44%
+9.17%
+7.50%
+7.52%
+7.02%
+9.97%
+7.43%
2,569 (0)
26 (0)
1 (0)
1 (0)
520 (0)
1 (0)
13 (0)
TransparentUpgradeableProxy 1,117,489 (0) ONE_HUNDRED_PERCENT
accruedYieldOf
approve
balanceOf
balanceWithYieldOf
claimFee
claimYieldFor
currentIndex
decimals
disableEarning
earnerRate
enableEarning
fallback
feeRate
feeRecipient
forceTransfer
forceTransfers
freeze
freezeAccounts
hasRole
isEarningEnabled
latestEarnerRateAccrualTimestamp
msgSender
name
pause
principalOf
projectedTotalSupply
replaceAssetWithM
replaceAssetWithMWithPermit(address,address,address,uint256,address,uint256,bytes)
replaceAssetWithMWithPermit(address,address,address,uint256,address,uint256,uint8,bytes32,bytes32)
setAccountOf(address,uint256,uint112)
setAccountOf(address,uint256,uint112,bool,uint16)
setBalanceOf
setFeeRate
setFeeRecipient
setIsEarningEnabled
setLatestIndex
setLatestRate
setLatestUpdateTimestamp
setTotalPrincipal
setTotalSupply
swap
swapWithPermit(address,address,uint256,address,uint256,bytes)
swapWithPermit(address,address,uint256,address,uint256,uint8,bytes32,bytes32)
totalAccruedFee
totalAccruedYield
totalPrincipal
totalSupply
transfer
unwrap
updateIndex
wrap
5,207 (0)
2,426 (0)
27,585 (0)
1,034 (0)
18,433 (+4,028)
36,447 (0)
9,019 (0)
7,457 (0)
7,271 (0)
28,472 (0)
7,381 (0)
28,369 (0)
0 (0)
7,311 (0)
7,301 (0)
29,776 (+51)
31,719 (+49)
52,923 (+23,856)
77,734 (+47,135)
7,626 (+45)
7,540 (+232)
5,216 (0)
865 (+71)
8,101 (0)
51,960 (+23,421)
7,522 (0)
13,415 (+3,676)
170,741 (+19,954)
275,011 (+17,563)
274,355 (+17,563)
31,712 (0)
30,149 (0)
48,825 (0)
28,896 (0)
28,933 (0)
28,760 (0)
28,750 (0)
28,692 (0)
28,658 (0)
28,693 (0)
28,627 (0)
68,320 (+21,900)
216,799 (+17,563)
152,184 (+17,564)
15,270 (0)
11,932 (0)
7,345 (+44)
7,264 (0)
56,117 (0)
27,428 (0)
30,576 (0)
27,253 (0)
0.00%
0.00%
0.00%
0.00%
+27.96%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+∞%
0.00%
0.00%
+0.17%
+0.15%
+82.07%
+154.04%
+0.59%
+3.17%
0.00%
+8.94%
0.00%
+82.07%
0.00%
+37.75%
+13.23%
+6.82%
+6.84%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+47.18%
+8.82%
+13.05%
0.00%
0.00%
+0.60%
0.00%
0.00%
0.00%
0.00%
0.00%
5,218 (-4)
8,026 (-6,145)
37,995 (-2,178)
4,339 (-282)
18,440 (+3,658)
94,509 (+52)
48,161 (-90)
12,620 (+207)
7,304 (-4)
44,899 (-3,240)
14,384 (-128)
77,421 (+640)
17,722 (-390)
7,329 (-1)
7,314 (-14)
38,783 (+73)
451,891 (+2,143)
52,926 (+345)
669,175 (+18,167)
7,633 (+10)
9,112 (+66)
7,965 (+103)
865 (+71)
8,145 (0)
51,966 (+2,175)
7,522 (-26)
13,415 (+3,251)
174,303 (+19,840)
275,011 (+17,563)
274,355 (+17,563)
70,598 (+64)
61,026 (-54)
48,959 (+13)
38,374 (+31)
65,822 (+2,801)
30,131 (-4)
31,526 (+3)
30,352 (+13)
31,127 (+39)
31,448 (-86)
48,399 (+231)
182,501 (+19,878)
216,799 (+17,563)
206,770 (+17,563)
15,633 (-35)
12,293 (-13)
7,345 (+44)
7,273 (-17)
68,871 (-6,175)
60,532 (+1,603)
43,771 (+689)
112,977 (+379)
-0.08%
-43.36%
-5.42%
-6.10%
+24.75%
+0.06%
-0.19%
+1.67%
-0.05%
-6.73%
-0.88%
+0.83%
-2.15%
-0.01%
-0.19%
+0.19%
+0.48%
+0.66%
+2.79%
+0.13%
+0.73%
+1.31%
+8.94%
0.00%
+4.37%
-0.34%
+31.99%
+12.84%
+6.82%
+6.84%
+0.09%
-0.09%
+0.03%
+0.08%
+4.44%
-0.01%
+0.01%
+0.04%
+0.13%
-0.27%
+0.48%
+12.22%
+8.82%
+9.28%
-0.22%
-0.11%
+0.60%
-0.23%
-8.23%
+2.72%
+1.60%
+0.34%
5,218 (-11)
2,426 (-11,764)
27,585 (-6,533)
7,501 (0)
18,443 (+4,035)
94,866 (0)
49,812 (0)
15,564 (+5,291)
7,304 (-12)
42,438 (-3,324)
15,106 (0)
77,694 (0)
7,549 (+15)
7,333 (0)
7,301 (-22)
32,231 (0)
66,435 (+504)
52,923 (0)
672,350 (+36,405)
7,626 (0)
9,109 (+14)
10,540 (+5,324)
865 (+71)
8,157 (+11)
51,960 (+42)
7,522 (-27)
13,415 (+2,937)
172,178 (+19,954)
275,011 (+17,563)
274,355 (+17,563)
71,644 (-12)
55,191 (0)
48,909 (+24)
37,317 (0)
70,108 (+16,376)
28,760 (0)
31,574 (0)
31,492 (0)
31,482 (0)
31,601 (-6)
48,641 (+44)
178,845 (+20,025)
216,799 (+17,563)
201,326 (+17,563)
15,273 (0)
11,935 (-736)
7,345 (+44)
7,264 (-22)
70,676 (-7,341)
34,323 (0)
45,292 (+40)
121,031 (-6)
-0.21%
-82.90%
-19.15%
0.00%
+28.01%
0.00%
0.00%
+51.50%
-0.16%
-7.26%
0.00%
0.00%
+0.20%
0.00%
-0.30%
0.00%
+0.76%
0.00%
+5.72%
0.00%
+0.15%
+102.07%
+8.94%
+0.14%
+0.08%
-0.36%
+28.03%
+13.11%
+6.82%
+6.84%
-0.02%
0.00%
+0.05%
0.00%
+30.48%
0.00%
0.00%
0.00%
0.00%
-0.02%
+0.09%
+12.61%
+8.82%
+9.56%
0.00%
-5.81%
+0.60%
-0.30%
-9.41%
0.00%
+0.09%
-0.00%
5,230 (0)
18,159 (0)
56,062 (0)
7,545 (0)
18,443 (0)
111,966 (0)
114,249 (0)
15,564 (0)
7,338 (0)
87,736 (-12,486)
15,106 (0)
92,499 (-9,648)
220,012 (+17,507)
7,333 (0)
7,356 (0)
58,808 (0)
1,785,683 (0)
52,989 (+66)
1,242,699 (0)
7,657 (0)
10,689 (0)
10,540 (0)
865 (+71)
8,168 (0)
51,986 (0)
7,522 (-27)
13,415 (0)
231,183 (+17,563)
275,011 (+17,563)
274,355 (+17,563)
71,860 (0)
72,333 (0)
49,401 (0)
55,505 (0)
105,145 (-14,019)
31,572 (0)
31,574 (0)
31,504 (0)
31,518 (0)
31,661 (-66)
48,707 (-202)
290,473 (+17,620)
216,799 (+17,563)
276,984 (+17,563)
16,012 (-3,093)
12,674 (0)
7,345 (0)
7,286 (-34)
78,017 (-18,262)
88,567 (0)
51,266 (0)
121,169 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
-12.46%
0.00%
-9.45%
+8.65%
0.00%
0.00%
0.00%
0.00%
+0.12%
0.00%
0.00%
0.00%
0.00%
+8.94%
0.00%
0.00%
-0.36%
0.00%
+8.22%
+6.82%
+6.84%
0.00%
0.00%
0.00%
0.00%
-11.76%
0.00%
0.00%
0.00%
0.00%
-0.21%
-0.41%
+6.46%
+8.82%
+6.77%
-16.19%
0.00%
0.00%
-0.46%
-18.97%
0.00%
0.00%
0.00%
4 (-2)
115 (-1,676)
78 (-27)
224 (-44)
10 (-2,372)
259 (-1)
274 (-2)
800 (-17)
4 (-2)
10 (-5)
14 (-3)
101 (-11)
60,057 (+11,049)
7 (-1)
10 (-5)
241 (-3)
260 (-2)
132 (-2)
122 (-4)
13 (-7)
6 (-6)
520 (+8)
730 (0)
4 (-2)
4 (-7)
14 (-640)
12 (-767)
21 (0)
1 (0)
1 (0)
1,814 (0)
1,258 (+8)
7,734 (+438)
3,335 (0)
9 (-4)
2,836 (0)
2,817 (0)
1,042 (0)
512 (0)
257 (-2,572)
260 (-259)
486 (0)
1 (0)
13 (0)
1,526 (-19)
910 (-17)
12 (-3,196)
22 (-13)
4 (-3)
263 (0)
15 (-2)
150 (+8)
MExtensionHarness 2,750,390 (0) transfer
unwrap
wrap
552 (0)
478 (0)
477 (0)
0.00%
0.00%
0.00%
16,959 (+278)
27,157 (+2,307)
59,901 (+1,831)
+1.67%
+9.28%
+3.15%
4,688 (0)
10,612 (+2,071)
61,560 (+2,071)
0.00%
+24.25%
+3.48%
30,183 (0)
44,569 (+2,071)
61,560 (+2,071)
0.00%
+4.87%
+3.48%
260 (0)
262 (0)
264 (0)
JMIExtensionHarness 5,101,129 (0) balanceOf
fromAssetToExtensionAmount
fromExtensionToAssetAmount
replaceAssetWithM
setAssetBalanceOf
setTotalAssets
unwrap
wrap(address,address,uint256)
wrap(address,uint256)
607 (0)
2,874 (0)
2,832 (0)
602 (0)
2,774 (0)
2,523 (0)
8,358 (+2,071)
601 (0)
4,089 (+71)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+32.94%
0.00%
+1.77%
2,341 (+2)
3,241 (+5)
3,200 (+3)
31,333 (+660)
5,508 (-3)
21,242 (-39)
35,522 (+2,816)
71,607 (+1,029)
73,262 (+148)
+0.09%
+0.15%
+0.09%
+2.15%
-0.05%
-0.18%
+8.61%
+1.46%
+0.20%
2,607 (0)
3,372 (0)
3,330 (0)
6,328 (0)
5,574 (0)
22,423 (0)
31,478 (+71)
57,998 (+2,071)
79,589 (+71)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+0.23%
+3.70%
+0.09%
2,607 (0)
3,415 (0)
3,373 (0)
86,811 (0)
5,574 (0)
22,423 (0)
58,243 (+2,071)
129,839 (+2,071)
79,589 (+71)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+3.69%
+1.62%
+0.09%
754 (+6)
1,784 (0)
1,491 (-1)
543 (0)
1,029 (0)
1,026 (0)
273 (0)
582 (0)
26 (0)
MYieldFeeHarness 5,556,097 (0) accruedYieldOf
balanceWithYieldOf
claimFee
currentIndex
projectedTotalSupply
setAccountOf
setFeeRate
setIsEarningEnabled
setLatestIndex
setLatestRate
setLatestUpdateTimestamp
setTotalPrincipal
setTotalSupply
totalAccruedFee
totalAccruedYield
transfer
transferFrom
unwrap
wrap
2,008 (0)
9,487 (0)
10,468 (0)
4,619 (0)
4,824 (0)
5,100 (0)
2,779 (0)
2,653 (0)
2,595 (0)
2,573 (0)
2,551 (0)
2,652 (0)
2,542 (0)
10,355 (0)
7,017 (0)
552 (0)
46,503 (0)
3,085 (0)
3,141 (0)
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%
9,317 (-26)
9,844 (-5)
68,544 (+66)
4,976 (-3)
5,195 (-3)
43,801 (+66)
11,601 (-9)
4,010 (-12)
5,349 (+7)
4,478 (+26)
5,011 (+54)
5,348 (+2)
20,349 (+25)
10,749 (-4)
7,385 (-6)
22,787 (-748)
50,986 (-280)
42,687 (+1,972)
65,470 (+1,044)
-0.28%
-0.05%
+0.10%
-0.06%
-0.06%
+0.15%
-0.08%
-0.30%
+0.13%
+0.58%
+1.09%
+0.04%
+0.12%
-0.04%
-0.08%
-3.18%
-0.55%
+4.84%
+1.62%
9,272 (0)
9,490 (0)
68,887 (0)
4,619 (0)
5,563 (0)
44,900 (0)
11,186 (0)
2,653 (0)
5,395 (0)
5,373 (0)
5,351 (0)
5,452 (0)
22,442 (0)
10,358 (0)
7,020 (-736)
11,589 (0)
46,503 (0)
47,696 (+71)
70,757 (+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%
-9.49%
0.00%
0.00%
+0.15%
+3.02%
10,011 (0)
10,229 (0)
85,987 (0)
5,358 (0)
5,563 (0)
44,900 (0)
23,503 (0)
5,453 (0)
5,395 (0)
5,373 (0)
5,351 (0)
5,452 (0)
22,442 (0)
14,190 (0)
7,759 (0)
69,762 (0)
75,186 (0)
87,496 (+71)
137,125 (+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.00%
+0.08%
+0.05%
1,744 (-7)
2,336 (-36)
260 (0)
6,719 (0)
762 (-5)
1,814 (0)
2,823 (0)
2,579 (0)
2,561 (0)
529 (0)
256 (0)
2,572 (0)
2,572 (0)
1,540 (-5)
929 (+2)
266 (0)
85 (+5)
346 (+5)
357 (+5)
MEarnerManagerHarness 4,982,003 (0) balanceOf
setAccountOf
setTotalPrincipal
transfer
unwrap
wrap
627 (0)
5,269 (0)
2,586 (0)
574 (0)
943 (0)
972 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
2,579 (+2)
33,991 (-56)
5,244 (-11)
30,562 (+1,201)
37,553 (+1,321)
71,772 (+830)
+0.08%
-0.16%
-0.21%
+4.09%
+3.65%
+1.17%
2,627 (0)
27,969 (0)
5,386 (0)
11,629 (0)
48,097 (+71)
94,511 (0)
0.00%
0.00%
0.00%
0.00%
+0.15%
0.00%
2,627 (0)
45,069 (0)
5,386 (0)
50,967 (0)
85,897 (+71)
116,782 (+71)
0.00%
0.00%
0.00%
0.00%
+0.08%
+0.06%
840 (+32)
1,258 (+8)
257 (0)
262 (0)
334 (0)
227 (+8)
MSpokeYieldFeeHarness 5,669,766 (0) currentIndex
latestEarnerRateAccrualTimestamp
setFeeRate
setIsEarningEnabled
setLatestIndex
setLatestUpdateTimestamp
4,619 (0)
3,234 (0)
7,069 (0)
2,653 (0)
2,595 (0)
2,551 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
7,746 (+163)
5,616 (+1)
15,827 (+249)
4,102 (+77)
5,340 (-33)
4,990 (+22)
+2.15%
+0.02%
+1.60%
+1.91%
-0.61%
+0.44%
10,649 (+6,030)
5,625 (0)
11,186 (0)
5,453 (+2,800)
5,395 (0)
5,351 (0)
+130.55%
0.00%
0.00%
+105.54%
0.00%
0.00%
10,649 (0)
5,625 (0)
29,374 (0)
5,453 (0)
5,395 (0)
5,351 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
775 (0)
269 (+14)
512 (0)
257 (0)
256 (0)
256 (0)
MYieldToOneHarness 3,955,018 (0) balanceOf
setTotalSupply
transferFrom
unwrap
wrap
yield
616 (0)
2,542 (0)
9,557 (0)
3,127 (0)
3,184 (0)
2,531 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
2,320 (+1)
21,606 (-152)
27,734 (+112)
43,004 (+22)
57,823 (+1,083)
7,049 (+63)
+0.04%
-0.70%
+0.41%
+0.05%
+1.91%
+0.90%
2,616 (0)
22,442 (0)
26,403 (0)
45,615 (+71)
77,501 (+71)
7,938 (0)
0.00%
0.00%
0.00%
+0.16%
+0.09%
0.00%
2,616 (0)
22,442 (0)
42,286 (0)
82,615 (+71)
106,425 (+71)
11,034 (0)
0.00%
0.00%
0.00%
+0.09%
+0.07%
0.00%
677 (+2)
262 (0)
144 (-5)
142 (-5)
165 (-5)
355 (-5)
MockM 635,521 (0) currentIndex
earnerRate
latestUpdateTimestamp
setBalanceOf
setLatestUpdateTimestamp
0 (0)
0 (0)
0 (0)
24,204 (0)
23,720 (0)
+∞%
+∞%
+∞%
0.00%
0.00%
2,312 (+3)
161 (+3)
2,099 (+1)
41,378 (-12)
34,882 (+11)
+0.13%
+1.90%
+0.05%
-0.03%
+0.03%
2,379 (0)
0 (0)
2,391 (0)
44,152 (0)
26,580 (0)
0.00%
+∞%
0.00%
0.00%
0.00%
2,379 (0)
2,411 (0)
2,391 (0)
44,488 (0)
43,680 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
580 (+24)
134 (-3)
947 (+49)
4,509 (+2)
516 (0)
UniswapV3SwapAdapter 1,999,150 (0) swapIn
swapOut
25,973 (0)
25,908 (0)
0.00%
0.00%
2,354,034 (+6,393)
2,322,802 (+5,855)
+0.27%
+0.25%
249,013 (0)
242,170 (0)
0.00%
0.00%
25,796,850 (+2,054)
25,479,114 (0)
+0.01%
0.00%
12 (0)
12 (0)
MEarnerManager 4,737,724 (0) unwrap
wrap
80,882 (+71)
71,359 (+71)
+0.09%
+0.10%
82,561 (+71)
100,901 (+71)
+0.09%
+0.07%
80,882 (+71)
105,690 (+71)
+0.09%
+0.07%
85,919 (+71)
116,759 (+71)
+0.08%
+0.06%
3 (0)
12 (0)
MockERC20 549,257 (0) balanceOf
mint
549 (0)
28,329 (0)
0.00%
0.00%
2,331 (+2)
67,104 (-36)
+0.09%
-0.05%
2,549 (0)
68,201 (+12)
0.00%
+0.02%
2,549 (0)
68,489 (0)
0.00%
0.00%
2,498 (-4)
1,036 (0)
MYieldToOneForcedTransferHarness 4,339,213 (0) forceTransfer
forceTransfers
freezeAccounts
2,878 (0)
3,391 (0)
51,180 (0)
0.00%
0.00%
0.00%
12,040 (-3)
430,142 (-264)
639,054 (-395)
-0.02%
-0.06%
-0.06%
5,120 (0)
6,166 (0)
642,218 (+12,062)
0.00%
0.00%
+1.91%
36,720 (0)
1,722,489 (0)
1,209,132 (0)
0.00%
0.00%
0.00%
241 (-2)
260 (0)
122 (0)
MockRateOracle 107,883 (0) earnerRate 0 (0) +∞% 2,282 (+1) +0.04% 2,299 (0) 0.00% 2,299 (0) 0.00% 140 (+7)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 4, 2026

LCOV of commit 23cb8d9 during Forge Coverage #416

Summary coverage rate:
  lines......: 99.1% (903 of 911 lines)
  functions..: 97.8% (223 of 228 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/libs/Locker.sol                                |50.0%      4| 0.0%     2|    -      0

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the dependency on Uniswap’s transient-storage Locker with a locally vendored Locker implementation that uses sstore/sload, improving compatibility with pre-Cancun chains.

Changes:

  • Added a local Locker library that stores/loads the lock holder from a fixed storage slot via sstore/sload.
  • Updated ReentrancyLock to import the new local Locker instead of the Uniswap periphery version.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/swap/libs/Locker.sol Introduces a local Locker library using persistent storage for lock state.
src/swap/ReentrancyLock.sol Switches the Locker import to the new local library.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

pragma solidity 0.8.26;

import { Locker } from "../../lib/uniswap-v4-periphery/src/libraries/Locker.sol";
import { Locker } from "./libs/Locker.sol";
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching the Locker import to the local sstore/sload implementation means the lock is no longer based on transient storage. The contract still documents itself as a "transient reentrancy lock"; please update the NatSpec/commentary in this file to reflect the persistent-storage implementation to avoid misleading integrators/auditors.

Copilot uses AI. Check for mistakes.
Comment thread src/swap/libs/Locker.sol
Comment on lines +11 to +22
bytes32 constant LOCKED_BY_SLOT = 0x0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a;

function set(address locker) internal {
assembly {
sstore(LOCKED_BY_SLOT, locker)
}
}

function get() internal view returns (address locker) {
assembly {
locker := sload(LOCKED_BY_SLOT)
}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Locker library writes to a hard-coded storage slot via inline assembly, which bypasses the ERC-7201 namespaced storage-location pattern used throughout the codebase (e.g., ReentrancyLockStorageLayout and FreezableStorageLayout). Consider moving the lock state into the existing ReentrancyLockStorageStruct (or introducing an ERC-7201 storage location for Locker) to reduce storage-collision risk and keep upgradeable storage access consistent.

Suggested change
bytes32 constant LOCKED_BY_SLOT = 0x0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a;
function set(address locker) internal {
assembly {
sstore(LOCKED_BY_SLOT, locker)
}
}
function get() internal view returns (address locker) {
assembly {
locker := sload(LOCKED_BY_SLOT)
}
bytes32 internal constant LOCKER_STORAGE_LOCATION =
0x0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a;
struct LockerStorageLayout {
address lockedBy;
}
function layout() private pure returns (LockerStorageLayout storage $) {
bytes32 slot = LOCKER_STORAGE_LOCATION;
assembly {
$.slot := slot
}
}
function set(address locker) internal {
layout().lockedBy = locker;
}
function get() internal view returns (address locker) {
locker = layout().lockedBy;

Copilot uses AI. Check for mistakes.
@JPMora89
Copy link
Copy Markdown

JPMora89 commented Mar 4, 2026

Do we also need to update foundry.toml file here with evm_version = "london"

@Khrafts
Copy link
Copy Markdown
Member Author

Khrafts commented Mar 4, 2026

Do we also need to update foundry.toml file here with evm_version = "london"

We could do that, however the Uniswap v4 periphery lib uses tstore/tload (Cancun opcodes) in its Locker.sol. Setting evm_version = "london" causes compilation to fail because the compiler rejects those opcodes — and Foundry's skip config doesn't prevent lib files from being compiled.
So I kept evm_version = "cancun" and instead created a local Locker.sol using sstore/sload, swapping the import in ReentrancyLock.

@PierrickGT
Copy link
Copy Markdown
Member

This change is already present in this branch: #49

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.

4 participants