Market::configureConnectedVaults
attempts to add vault IDs to a new enumerable set at index connectedVaults.length
whithout first expanding the array's storage slots, causing an array out of bounds error.
For example, if connectedVaults
has length 2 (indexes 0,1 exist), trying to add at connectedVaults[2]
will revert because index 2 doesn't exist in storage yet. Arrays must be explicity expanded using push
before accessing new indexes.
POC:
Add the following helper to MarketHarness.sol
and update marketHarnessSelectors
in TreeProxyUtils.sol
to include it.
Add this test to getAdjustedProfitForMarketId.t.sol
Function reverts with array out of bounds error
Any future upgrades or integrations using this function would fail
Foundry
Once grabbing connectedVaults
, instead of just iterating and trying to add to connectedVaults.length
:
Call push
on connectedVaults
to expand the array to increase properly.
Create a variable newSetIndex
which will point to the newly created last slot in array
Do the same for loop, but instead you are now pushing it to the proper expanded array index
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.