Repeated requests to the oracle within a single phase may result in the BuyerAgent's balance falling below the amountPerRound threshold.
The protocol defines minimal fund amount as amountPerRound plus oracle fee:
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/BuyerAgent.sol#L153
This is enforced in withdraw function effectively preventing the balance fall below the minimum amount when the BuyerAgent is not in Withdraw phase:
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/BuyerAgent.sol#L270-L272
It is important to note that the formula used in minFundAmount is enough to cover 1 call to oracle per round. However, nothing prevents a user to call oracle multiple times using oracleStateRequest or oraclePurchaseRequest depending on the phase.
Considering an example where a user had exactly amountPerRound + oracleFee balance at the beginning of the phase:
first call to oraclePurchaseRequest will leave amountPerRound on the balance
second call to oraclePurchaseRequest will leave amountPerRound - oracleFee on the balance
A constraint imposed by minFundAmount can be breached. Subsequently, this can lead to the purchase call reversal due to insufficient funds since oracles are expected to compose a purchase list up to amountPerRound.
Manual review
Prohibit duplicate requests to oracles at the same phase or enforce minFundAmount() check during such calls.
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.