Location: contracts/libraries/Statistics.sol
Problem: Each function iterates over the entire array, which may result in high gas usage for large datasets. Since each loop iteration consumes gas, the complexity of these calculations can lead to prohibitive costs if the library is used with large on-chain data arrays.
Recommendation: Limit the array size for on-chain use, or consider off-chain computations if the dataset is large. Alternatively, aggregate values as they are collected to avoid recalculating for large datasets.
Tools used: Github and VSC
POC:
Expected Outcome: This will consume a high amount of gas, potentially causing the transaction to fail on-chain due to gas limits. It demonstrates that this library may not be suitable for large arrays in an on-chain environment.
Impact: Makes the library impractical for large datasets, leading to increased costs and potential for transaction failure due to exceeding gas limits, especially if used on-chain.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.