When making a platform fee withdraw in LLMOracleCoordinator::withdrawPlatformFees
, the owner takes all the available balance of the fee token in a contract at that moment.
A problem arises since validators' and generators' fees are not directly sent to them but just approved.
Meaning their fees are still part of the contract's total token balance hence by transferring the total balance all the still pending, non-transferred but approved generator and validator fees will be sent to the owner.
Their may still be pending requests whose validators and generators need fees but lets make an assumption that the owner will ensure that all requests are completed.
Here is a scenario:
BuyerAgent makes a request to the LLMOracleCoordinator
contract and sends the totalFees
to it.
Generators respond to the requests and after the number of generators reach the minimum required, validators also validate the responses.
After validation, the validator and generator fees are approved but they haven`t yet processed the transfers.
The owner sees that all requests have been completed and decide to withdraw the platform fees in LLMOracleCoordinator::withdrawPlatformFees
.
https://github.com/Cyfrin/2024-10-swan-dria/blob/c8686b199daadcef3161980022e12b66a5304f8e/contracts/llm/LLMOracleCoordinator.sol#L375C5-L377C6
Since the validators and generators of the last requests haven`t transferred their amounts, the withdraw will send all their fees to the owner hence them losing their fees.
Loss of validator and generator fees.
Consider checking and subtracting allowances before withdrawing the available fees.
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.