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

Chore/increase test coverage and add natspec #317

Conversation

alex0207s
Copy link
Contributor

@alex0207s alex0207s commented Jul 16, 2024

  • fix the logic in LimitOrderSwap.sol to not allow zero takerToken orders or zero makerToken orders

  • increase test coverage to near 100%; comment on the reasons why some branches cannot be covered.

  • remove dead codes from the Tokenlon contracts.

  • fix typos.

  • add a script to package.json for generating coverage - coverage.

  • add natspec to Tokenlon contracts.

Copy link

github-actions bot commented Jul 16, 2024

Changes to gas cost

Generated at commit: 58248155279e942d9175e334d673e4d9e9bff123, compared to commit: 019650b2eaf9c86d0e3fce3c04acfe001f5f4cd9

🧾 Summary (20% most significant diffs)

Contract Method Avg (+/-) %
AllowanceTarget spendFromUserTo
unpause
+1,756 ❌
+2,113 ❌
+3.55%
+9.02%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
AllowanceTarget 613,454 (0) pause
spendFromUserTo
unpause
23,422 (0)
25,029 (0)
23,423 (0)
0.00%
0.00%
0.00%
26,608 (+354)
51,264 (+1,756)
25,536 (+2,113)
+1.35%
+3.55%
+9.02%
27,671 (0)
49,849 (+13,708)
25,536 (+2,113)
0.00%
+37.93%
+9.02%
27,671 (0)
91,606 (0)
27,649 (+4,226)
0.00%
0.00%
+18.04%
4 (+1)
8 (+1)
2 (+1)

Copy link

github-actions bot commented Jul 16, 2024

Changes to gas cost

Generated at commit: 58248155279e942d9175e334d673e4d9e9bff123, compared to commit: 019650b2eaf9c86d0e3fce3c04acfe001f5f4cd9

🧾 Summary (20% most significant diffs)

Contract Method Avg (+/-) %
LimitOrderSwap fillLimitOrder
fillLimitOrderGroup
-246,932 ✅
-68,112 ✅
-17.31%
-28.05%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
LimitOrderSwap 2,730,640 (+36,206) fillLimitOrder
fillLimitOrderFullOrKill
fillLimitOrderGroup
36,094 (0)
48,304 (+42)
31,168 (-166,968)
0.00%
+0.09%
-84.27%
1,179,473 (-246,932)
104,056 (+34)
174,739 (-68,112)
-17.31%
+0.03%
-28.05%
161,770 (-6,889)
48,304 (+42)
198,266 (-47,337)
-4.08%
+0.09%
-19.27%
29,534,880 (+1)
215,562 (+19)
291,975 (+195)
+0.00%
+0.01%
+0.07%
28 (+5)
3 (0)
9 (+3)
RFQ 2,465,421 (+21,622) cancelRFQOffer
feeCollector
fillRFQ
setFeeCollector
23,996 (+22)
382 (-44)
31,822 (0)
23,793 (+22)
+0.09%
-10.33%
0.00%
+0.09%
37,923 (+22)
382 (-44)
131,171 (+1,527)
25,964 (+22)
+0.06%
-10.33%
+1.18%
+0.08%
38,918 (+22)
382 (-44)
147,976 (0)
23,998 (+22)
+0.06%
-10.33%
0.00%
+0.09%
49,859 (+22)
382 (-44)
238,908 (+15,387)
30,102 (+22)
+0.04%
-10.33%
+6.88%
+0.07%
4 (0)
2 (+1)
24 (+2)
3 (0)
SmartOrderStrategy 1,226,691 (0) approveTokens
executeStrategy
56,282 (0)
23,234 (0)
0.00%
0.00%
185,084 (+10,734)
123,683 (+3,118)
+6.16%
+2.59%
268,806 (0)
90,796 (+51,578)
0.00%
+131.52%
268,806 (0)
610,220 (0)
0.00%
0.00%
33 (+6)
18 (+3)
CoordinatedTaker 2,367,349 (+1,248) approveTokens
submitLimitOrderFill
27,095 (0)
33,103 (0)
0.00%
0.00%
169,261 (+3,043)
128,473 (+9)
+1.83%
+0.01%
189,038 (0)
70,073 (0)
0.00%
0.00%
189,038 (0)
256,667 (+19)
0.00%
+0.01%
15 (+2)
7 (0)
GenericSwap 1,756,522 (+22,941) executeSwap
executeSwapWithSig
32,322 (+45)
39,528 (+44)
+0.14%
+0.11%
117,670 (+45)
168,429 (+44)
+0.04%
+0.03%
115,374 (+45)
175,155 (+44)
+0.04%
+0.03%
252,012 (+45)
283,880 (+44)
+0.02%
+0.02%
12 (0)
4 (0)

@alex0207s alex0207s requested a review from NIC619 July 16, 2024 09:49
contracts/RFQ.sol Outdated Show resolved Hide resolved
@alex0207s alex0207s force-pushed the chore/increase-test-coverage-and-add-natspec branch from fe5a6f4 to 3c55d03 Compare July 19, 2024 07:00
@alex0207s alex0207s merged commit a321bde into chore/cleanup-and-upgrade-codebase Jul 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants