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: 28/65
Findings: 1
Award: $107.40
🌟 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/tree/main/src/Swap/BaseV1-core.sol#L96 https://github.com/code-423n4/2022-09-canto/tree/main/src/Swap/BaseV1-core.sol#L149 https://github.com/code-423n4/2022-09-canto/tree/main/src/Swap/BaseV1-core.sol#L242 https://github.com/code-423n4/2022-09-canto/tree/main/src/Swap/BaseV1-core.sol#L248 https://github.com/code-423n4/2022-09-canto/tree/main/src/Swap/BaseV1-core.sol#L249 https://github.com/code-423n4/2022-09-canto/tree/main/src/Swap/BaseV1-core.sol#L608 https://github.com/code-423n4/2022-09-canto/tree/main/src/Swap/BaseV1-core.sol#L564 https://github.com/code-423n4/2022-09-canto/tree/main/src/Swap/BaseV1-core.sol#L565 https://github.com/code-423n4/2022-09-canto/tree/main/src/Swap/BaseV1-core.sol#L566
As this array can grow quite large, the transaction’s gas cost could exceed the block gas limit and make it impossible to call this function at all
src/Swap/BaseV1-core.sol:96: observations.push(Observation(block.timestamp, 0, 0,0)); src/Swap/BaseV1-core.sol:149: observations.push(Observation(blockTimestamp, reserve0CumulativeLast, reserve1CumulativeLast, totalSupplyCumulativeLast));
src/Swap/BaseV1-core.sol:242: uint lastIndex = observations.length-1; .. src/Swap/BaseV1-core.sol:248: for(; i < lastIndex; i+=window) src/Swap/BaseV1-core.sol:249: nextIndex = i + window;
src/Swap/BaseV1-core.sol:608: allPairs.push(pair);
src/Swap/BaseV1-core.sol:608: allPairs.push(pair) src/Swap/BaseV1-core.sol:564: for (uint i; i < allPairs.length; ) { src/Swap/BaseV1-core.sol:565: BaseV1Pair(allPairs[i]).setPeriodSize(newPeriod); src/Swap/BaseV1-core.sol:566: unchecked {++i;}
Consider introducing a reasonable upper limit based on block gas limits and/or adding a remove method to remove elements in the array.
#0 - nivasan1
2022-09-10T16:23:46Z
duplicate #8