Inflated price due to unnecessary precision scaling
The `price` at Line 137 below is denominated in 18 decimals as the `getPriceInEth` function always returns the `price` in 18 decimals precision.\\nThere is no need to scale the accumulated price by 1e18.\\nIt will cause the average price (existing._initAcc) to be inflated significantly\\nThe numerator will almost always be larger than the denominator (INIT_SAMPLE_COUNT = 18). There is no risk of it rounding to zero, so any scaling is unnecessary.\\nAssume that throughout the initialization process, the `getPriceInEth(XYZ)` always returns 2 ETH (2e18). After 18 rounds (INIT_SAMPLE_COUNT == 18) of initialization, `existing._initAcc` will equal 36 ETH (36e18). As such, the `averagePrice` will be as follows:\\n```\\naveragePrice = existing._initAcc * 1e18 / INIT_SAMPLE_COUNT;\\naveragePrice = 36e18 * 1e18 / 18\\naveragePrice = 36e36 / 18\\naveragePrice = 2e36\\n```\\n\\n`existing.fastFilterPrice` and `existing.slowFilterPrice` will be set to `2e36` at Lines 157 and 158 below.\\nIn the post-init phase, the `getPriceInEth` function return 3 ETH (3e18). Thus, the following code will be executed at Line 144s and 155 below:\\n```\\nexisting.slowFilterPrice = Stats.getFilteredValue(SLOW_ALPHA, existing.slowFilterPrice, price);\\nexisting.fastFilterPrice = Stats.getFilteredValue(FAST_ALPHA, existing.fastFilterPrice, price);\\n\\nexisting.slowFilterPrice = Stats.getFilteredValue(SLOW_ALPHA, 2e36, 3e18); // SLOW_ALPHA = 645e14; // 0.0645\\nexisting.fastFilterPrice = Stats.getFilteredValue(FAST_ALPHA, 2e36, 3e18); // FAST_ALPHA = 33e16; // 0.33\\n```\\n\\nAs shown above, the existing filter prices are significantly inflated by the scale of 1e18, which results in the prices being extremely skewed.\\nUsing the formula of fast filter, the final fast filter price computed will be as follows:\\n```\\n((priorValue * (1e18 - alpha)) + (currentValue * alpha)) / 1e18\\n((priorValue * (1e18 - 33e16)) + (currentValue * 33e16)) / 1e18\\n((priorValue * 67e16) + (currentValue * 33e16)) / 1e18\\n((2e36 * 67e16) + (3e18 * 33e16)) / 1e18\\n1.34e36 (1340000000000000000 ETH)\\n```\\n\\nThe token is supposed only to be worth around 3 ETH. However, the fast filter price wrongly determine that it is worth around 1340000000000000000 ETH\\n```\\nFile: IncentivePricingStats.sol\\n    function updatePricingInfo(IRootPriceOracle pricer, address token) internal {\\n..SNIP..\\n        uint256 price = pricer.getPriceInEth(token);\\n\\n        // update the timestamp no matter what phase we're in\\n        existing.lastSnapshot = uint40(block.timestamp);\\n\\n        if (existing._initComplete) {\\n            // post-init phase, just update the filter values\\n            existing.slowFilterPrice = Stats.getFilteredValue(SLOW_ALPHA, existing.slowFilterPrice, price);\\n            existing.fastFilterPrice = Stats.getFilteredValue(FAST_ALPHA, existing.fastFilterPrice, price);\\n        } else {\\n            // still the initialization phase\\n            existing._initCount += 1;\\n            existing._initAcc += price;\\n\\n            // snapshot count is tracked internally and cannot be manipulated\\n            // slither-disable-next-line incorrect-equality\\n            if (existing._initCount == INIT_SAMPLE_COUNT) { // @audit-info INIT_SAMPLE_COUNT = 18;\\n                // if this sample hits the target number, then complete initialize and set the filters\\n                existing._initComplete = true;\\n                uint256 averagePrice = existing._initAcc * 1e18 / INIT_SAMPLE_COUNT;\\n                existing.fastFilterPrice = averagePrice;\\n                existing.slowFilterPrice = averagePrice;\\n            }\\n        }\\n```\\n
Remove the 1e18 scaling.\\n```\\nif (existing._initCount == INIT_SAMPLE_COUNT) {\\n    // if this sample hits the target number, then complete initialize and set the filters\\n    existing._initComplete = true;\\n// Remove the line below\\n    uint256 averagePrice = existing._initAcc * 1e18 / INIT_SAMPLE_COUNT;\\n// Add the line below\\n    uint256 averagePrice = existing._initAcc / INIT_SAMPLE_COUNT;\\n    existing.fastFilterPrice = averagePrice;\\n    existing.slowFilterPrice = averagePrice;\\n}\\n```\\n
The price returned by the stat calculators will be excessively inflated. The purpose of the stats/calculators contracts is to store, augment, and clean data relevant to the LMPs. When the solver proposes a rebalance, the strategy uses the stats contracts to calculate a composite return (score) for the proposed destinations. Using that composite return, it determines if the swap is beneficial for the vault.\\nIf a stat calculator provides incorrect and inflated pricing, it can cause multiple implications that lead to losses to the protocol, such as false signals allowing the unprofitable rebalance to be executed.
```\\naveragePrice = existing._initAcc * 1e18 / INIT_SAMPLE_COUNT;\\naveragePrice = 36e18 * 1e18 / 18\\naveragePrice = 36e36 / 18\\naveragePrice = 2e36\\n```\\n