Platform: Code4rena
Start Date: 03/10/2023
Pot Size: $24,500 USDC
Total HM: 6
Participants: 62
Period: 3 days
Judge: LSDan
Total Solo HM: 3
Id: 288
League: ETH
Rank: 24/62
Findings: 2
Award: $40.13
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: adriro
Also found by: 0x3b, 0xAadi, 0xDING99YA, 0xTheC0der, 0xWaitress, 0xdice91, 100su, 3docSec, BRONZEDISC, BoRonGod, Eurovickk, GKBG, HChang26, IceBear, JP_Courses, MatricksDeCoder, Mike_Bello90, SovaSlava, Topmark, albahaca, cookedcookee, gzeon, hunter_w3b, kutugu, lukejohn, marqymarq10, matrix_0wl, orion, pep7siup, radev_sw, sces60107, taner2344, tpiliposian, wahedtalash77, xAriextz, zpan
4.9369 USDC - $4.94
https://github.com/code-423n4/2023-10-canto/blob/e9183df85f40a3f588f369c8f3a8fdd8f7503f38/canto_ambient/contracts/mixins/LiquidityMining.sol#L5-L8 https://github.com/code-423n4/2023-10-canto/blob/e9183df85f40a3f588f369c8f3a8fdd8f7503f38/canto_ambient/contracts/callpaths/LiquidityMiningPath.sol#L5-L8
Suggested changes:
-- import "../libraries/SafeCast.sol"; -- import "./PositionRegistrar.sol"; -- import "./StorageLayout.sol"; -- import "./PoolRegistry.sol";' ++ import { SafeCast } from "../libraries/SafeCast.sol"; ++ import { PositionRegistrar } from "./PositionRegistrar.sol"; ++ import { StorageLayout } from "./StorageLayout.sol"; ++ import { PoolRegistry } from "./PoolRegistry.sol";
and
Suggested changes:
-- import "../libraries/SafeCast.sol"; -- import "../mixins/StorageLayout.sol"; -- import "../mixins/LiquidityMining.sol"; -- import "../libraries/ProtocolCmd.sol"; ++ import { SafeCast } from "../libraries/SafeCast.sol"; ++ import { StorageLayout } from "../mixins/StorageLayout.sol"; ++ import { LiquidityMining } from "../mixins/LiquidityMining.sol"; ++ import { ProtocolCmd } from "../libraries/ProtocolCmd.sol";
constant WEEK
has no explicit visibility set.Standard practice to explicitly declare visibility of functions and state variables.
Suggested change:
-- uint256 constant WEEK = 604800; // Week in seconds 604800 ++ uint256 constant public WEEK = 604800; // Week in seconds 604800
Ratio
would have been a better choice of words compared to Percentage
, more accurate, as it is an actual ratio and not actual percentage representation in the arithmetic computation in the line below this comment.Dev comment:
// Percentage of this weeks overall in range liquidity that was provided by the user times the overall weekly rewards
Suggested:
// Ratio of this weeks overall in range liquidity that was provided by the user times the overall weekly rewards
OK if sent to EOA, otherwise if this call is to a user/attacker/controlled contract that contains a fallback() function with callback function inside it to call a vulnerable function in DEX protocol...
(bool sent, ) = owner.call{value: rewardsToSend}("");
Recommendation:
Recommend that they do a check for code length > 0...IF they dont allow user controlled contracts here...
In the context of the claimAmbientRewards
function, if you do not include the payable
modifier when declaring the owner
parameter, and you attempt to use the owner.call{value: rewardsToSend}("")
to send rewards to the user, it may result in a compilation error or runtime failure, preventing the transfer of rewards to the user.
However, the calling function from LiquidityMiningPath.sol does indeed pass payable(msg.sender)
for this address parameter, which would avoid any native token sending issues, but this contract may/will still revert during compiling. LOW because of the low impact, can just modify the contract before compiling again and deploying.
-- address owner, ++ address payable owner,
external
instead of public
visibility modifier since this function isnt going to be called internally at all and only called externally via delegatecall via main DEX contract; Reentrancy risk & access control?https://github.com/code-423n4/2023-10-canto/blob/e9183df85f40a3f588f369c8f3a8fdd8f7503f38/canto_ambient/contracts/callpaths/LiquidityMiningPath.sol#L26 https://github.com/code-423n4/2023-10-canto/blob/e9183df85f40a3f588f369c8f3a8fdd8f7503f38/canto_ambient/contracts/callpaths/LiquidityMiningPath.sol#L41
public
to internal
visibility modifier.#0 - c4-pre-sort
2023-10-09T17:21:12Z
141345 marked the issue as sufficient quality report
#1 - c4-judge
2023-10-18T23:10:45Z
dmvt marked the issue as grade-b
🌟 Selected for report: 0xweb3boy
Also found by: 0xdice91, Banditx0x, JP_Courses, ZanyBonzy, albahaca, cookedcookee, hunter_w3b, invitedtea, radev_sw, sandy
35.1935 USDC - $35.19
Small but tough-ish codebase to tackle for me. It can be deceptive, as this contest contains massive functions, well at least in my opinion. I made it through them, and managed to understand them pretty well.
Canto is doing a great job as an EVM compatible L1 chain, great future, and their ethos/intentions are honorable & important for the future of the web3 & DeFi space.
I learned a lot, which was my main objective. Once I learn how to do invariant fuzz testing, and proper coded PoCs, I will be able to dive deeper and get better results.
Approach Taken:
Architecture/Implementation Comments:
Codebase Quality Analysis:
Centralization Risks:
Mechanism Review:
Systemic Risks:
Conclusion:
16 hours
#0 - c4-pre-sort
2023-10-09T17:25:27Z
141345 marked the issue as sufficient quality report
#1 - c4-judge
2023-10-19T16:24:48Z
dmvt marked the issue as grade-b