Platform: Code4rena
Start Date: 07/09/2022
Pot Size: $20,000 CANTO
Total HM: 7
Participants: 65
Period: 1 day
Judge: 0xean
Total Solo HM: 3
Id: 159
League: ETH
Rank: 15/65
Findings: 2
Award: $146.62
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xhunter
Also found by: BipinSah, Rohan16, Sm4rty, Tomo, fatherOfBlocks, m_Rassska, oyc_109, prasantgupta52, rokinot
https://github.com/code-423n4/2022-09-canto/blob/65fbb8b9de22cf8f8f3d742b38b4be41ee35c468/src/Swap/BaseV1-core.sol#L539 https://github.com/code-423n4/2022-09-canto/blob/65fbb8b9de22cf8f8f3d742b38b4be41ee35c468/src/Swap/BaseV1-core.sol#L564 https://github.com/code-423n4/2022-09-canto/blob/65fbb8b9de22cf8f8f3d742b38b4be41ee35c468/src/Swap/BaseV1-core.sol#L608
The array in storage, allPairs, will start adding elements with the createPair() function, at first this will not lead to any problem, but then as the time of use of the contract begins to pass, they will continue to increase the number of Pairs inside of the arrangement. This will generate an increase in the execution costs of the setPeriodSize() function and in the event that a high number of pairs is achieved, a DoS could be generated.
One option is that elements of the allPairs array can be deleted, with the aim that the pairs are eliminated when they no longer have a sense of being.
#0 - nivasan1
2022-09-10T16:21:52Z
duplicate #8
🌟 Selected for report: lukris02
Also found by: 0x040, 0x1f8b, 0x52, 0xA5DF, 0xNazgul, 0xSky, Bnke0x0, Bronicle, CertoraInc, Chom, CodingNameKiki, Deivitto, Diraco, Dravee, EthLedger, IgnacioB, JC, JansenC, Jeiwan, R2, RaymondFam, ReyAdmirado, Rolezn, SinceJuly, TomJ, Tomo, Yiko, a12jmx, ajtra, ak1, codexploder, cryptphi, csanuragjain, erictee, fatherOfBlocks, gogo, hake, hansfriese, hickuphh3, ignacio, ontofractal, oyc_109, p_crypt0, pashov, peritoflores, rajatbeladiya, rbserver, rokinot, rvierdiiev, tnevler
242.8216 CANTO - $39.22
BaseV1- core
L100/108/342/523/526/556/561/562/576/581/586 - It is validated with a require but no message is sent if it reverts, the correct thing to do would be to show a message according to the reason for the error.
L26/420 - There is commented code that should not be, since it does not provide any value, nor a better understanding of the code.
L76 - There is an event, claim that is created but never used, this is dead code that shouldn't be there.
L177/180 - if you set the value inside the if and put a new value in _observation, that value could have been executed in the same block with the last one, so you could make "timeElapsed" return 0 and then when divisions are made an exception would be generated. The solution to this is to validate and display a message if timeElapsed == 0.
L187/196/224/234/260/268 - The function receives an input and then uses it to do a division, it should be validated if it is == 0 so that it does not generate an exception without a message.
L331/332/333/334/352/353/355/356 - The burn function has a modifier lock that allows it to validate the reentrancy, but in any case it is not recommended that the check effect interact pattern is not fulfilled, in the code is first transferred and then the balance is updated.
L555 - The mechanism for changing the admin could be improved by adding the functionality that there is a pending admin and that the address must accept its role.
L536 - MaxPeriod should be a constant since it will never be modified.
BaseV1-libs.sol
BaseV1-periphery.sol
L89 - The mechanism for changing the admin could be improved by adding the functionality that there is a pending admin and that the address must accept its role.
L90/219/220/300/465/468 - It is validated with a require but no message is sent if it reverts, the correct thing to do would be to show a message according to the reason for the error.
L55 - The struct route should be written with the first letter in uppercase (Route) in this way it is clear that it is a structure.
L203/205/206 - It should be validated that the total supply is != 0 and otherwise revert showing a message for the case.
L370/371/373 - In the for cycle an array is iterated and internally it is used to go through another array as well, this can generate errors since if they do not have the same length it could generate exceptions and incorrect values.