The LibWellMinting
contract is designed to compute the time-weighted average deltaB for a given Well. However, it contains a potential out-of-bounds error when handling arrays of different lengths, particularly when the number of tokens returned by the IWell(well).tokens()
function does not match the length of other arrays used in calculations.
If the IWell(well).tokens();
return more then 2 tokens.
The tokens is pass to the getRatiosAndBeanIndex
function.
In the getRatiosAndBeanIndex
function generates the ratios array based on the tokens returned by IWell(well).tokens()
, which may have a variable length depending on the Well's configuration.
The number of tokens can vary, potentially returning more than two tokens (e.g., BEAN
, WETH
, WSTETH
) and this is all supported by getUsdPrice
function.
The core issue lies in the calculateDeltaBAtBeanIndex
function, which takes in two arrays, reserves and ratios, and performs calculations assuming they are of the same length. This assumption can lead to an out-of-bounds error if the arrays have different lengths.
An out-of-bounds
error can cause the contract to revert, preventing any operations dependent on these calculations from succeeding. This could disrupt the normal functioning of the LibWellMinting, leading to failed updates to deltaB calculations.
Manual Review
Ensure that the lengths of reserves and ratios arrays are the same in the calculateDeltaBAtBeanIndex
function before pass to calcReserveAtRatioSwap function.
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.