Omniscia Bonq Audit
price-feed Code Style Findings
price-feed Code Style Findings
PRI-01C: Generic Typographic Mistake
Type | Severity | Location |
---|---|---|
Code Style | price-feed.sol:L89 |
Description:
The referenced line contains a typographical mistake or generic documentational error (i.e. copy-paste) that should be corrected.
Example:
89// filling price points with hipotetical values
Recommendation:
We advise this to be done so to enhance the legibility of the codebase.
Alleviation:
The Bonq Protocol team has stated that they will not proceed with the price feed implementations that they currently have in place after the findings we have identified within the report. The price feeds they will instead utilize will be Chainlink and as such, we consider these exhibits nullified.
PRI-02C: Inefficient Loop Limit Evaluation
Type | Severity | Location |
---|---|---|
Gas Optimization | price-feed.sol:L93 |
Description:
The linked for
loop evaluates its limit inefficiently on each iteration.
Example:
93for (uint256 i = 1; i < snapshots.length; i++) {
Recommendation:
We advise the statements within the for
loop limit to be relocated outside to a local variable declaration that is consequently utilized for the evaluation to significantly reduce the codebase's gas cost. We should note the same optimization is applicable for storage reads present in such limits as they are newly read on each iteration (i.e. length
members of arrays in storage).
Alleviation:
The Bonq Protocol team has stated that they will not proceed with the price feed implementations that they currently have in place after the findings we have identified within the report. The price feeds they will instead utilize will be Chainlink and as such, we consider these exhibits nullified.
PRI-03C: Inefficient Ternary Operators
Type | Severity | Location |
---|---|---|
Gas Optimization | price-feed.sol:L68, L146 |
Description:
The linked ternary operators are redundant as a modulo (%
) mechanism can be utilized instead.
Example:
146uint256 startSnapshotIndex = shift + 1 == PRICE_AVERAGE_PERIOD ? 0 : shift + 1;
Recommendation:
We advise the addition result to be normalized via a modulo operation with the value of PRICE_AVERAGE_PERIOD
thus achieving the same logical result.
Alleviation:
The Bonq Protocol team has stated that they will not proceed with the price feed implementations that they currently have in place after the findings we have identified within the report. The price feeds they will instead utilize will be Chainlink and as such, we consider these exhibits nullified.