As a result, _validateQuoteAssetQuantity() may revert, and then the _createBidInfo() and bid() functions will revert as well.
Impact
AuctionRebalanceModuleV1.bid() might always fail if the BoundedStepwiseExponentialPriceAdapter is used as priceAdapter and scalingFactor > 1.
When AuctionRebalanceModuleV1.bid() is called, _quoteAssetLimit is passed from outside.
If the caller calculates _quoteAssetLimit value in respect of price = initialPrice +/- scalingFactor e ^ (timeCoefficient timeBucket) formula,
the bid() function is reverted.
dany.armstrong90
high
Change price calculation in BoundedStepwiseExponentialPriceAdapter.getPrice() is incorrect.
Summary
Change price calculation in BoundedStepwiseExponentialPriceAdapter.getPrice() is incorrect.
Vulnerability Detail
BoundedStepwiseExponentialPriceAdapter.getPrice() calculates component price of that moment. The code is as follows:
From the above code L73, priceChange calculation is incorrect and getPrice() returns greater value than correct value by (scalingFactor - 1) * WAD.
Within the AuctionRebalanceModuleV1._createBidInfo() function, quoteAssetQuantity becomes greater.
And within the _validateQuoteAssetQuantity() function, the condition of quoteAssetQuantity <= _quoteQuantityLimit might be unmet.
As a result, _validateQuoteAssetQuantity() may revert, and then the _createBidInfo() and bid() functions will revert as well.
Impact
AuctionRebalanceModuleV1.bid() might always fail if the BoundedStepwiseExponentialPriceAdapter is used as priceAdapter and scalingFactor > 1. When AuctionRebalanceModuleV1.bid() is called, _quoteAssetLimit is passed from outside. If the caller calculates _quoteAssetLimit value in respect of price = initialPrice +/- scalingFactor e ^ (timeCoefficient timeBucket) formula, the bid() function is reverted.
Code Snippet
https://github.com/sherlock-audit/2023-06-Index/blob/main/index-protocol/contracts/protocol/integration/auction-price/BoundedStepwiseExponentialPriceAdapter.sol#L73
Tool used
Manual Review
Recommendation
Duplicate of #39