The Buy Phase of a round can be skipped due to an update in the marketplaces SwanMarketParameters which would lead to sellers having listed assets and never having a chance for them to be bought buy a buyerAgent in that round. Theses sellers would still have to pay the listing fees in the Swan:list or Swan:relist functions. Sellers would be expecting to have a chance at the buyerAgent buying their asset, but due to the update they never get this chance. It should be noted that assets can only be bought in the round they were listed and not in future rounds without that asset being relisted. This leads to a permanent loss of those fees with no value being given from them.
SwanManager:setMarketParameters allows the Swan owner to update the market parameters of the marketplace post initialisation, and potentially in the middle of a buyerAgent round.
BuyerAgent:_computePhase is the function that calculates what Phase that specific buyerAgent is in.
When certain market parameters are set an entire Buy Phase can be skipped for a round. See the PoC below:
The following PoC was created using Foundry, insert the below functions into their own Test file for the test. These functions are direct copies from the codebase.
Please then insert the following test into the same Test file.
This PoC represents the issue occuring for a single buyerAgent. In the realistic scenario where there are many buyerAgents, this could very easily happen to multiple buyerAgents at the same time.
The impact of this issue is that sellers will be charged fees for assets that never had a chance to be bought buy a buyer. The protocol would reap the rewards of this buy collecting fees from the listings, and the buyer would also reap the rewards of this as they would collect fees for all the listings in their name, but would not buy anything.
It should be noted that in the event that market parameter updates were announced off-chain before they took place, a malicious actor could deliberately setup a buyerAgent that would exploit this vulnerability, and they could even set the description of this buyerAgent maliciously to something along the lines of, "buy everything thats listed", which would entice sellers to sell to the buyer as they would likely get a sale of their asset and in turn make a profit, however they could be unaware that the Buy Phase for that round may never occur. The malicious actor would then use the upcoming Withdraw phase to withdraw all the money made from the royalties and then drain the wallet, so that it does not buy any assets in future rounds.
Manual Review
The solution to this issue is non-trivial due to the fact that every individual buyerAgent is at their own Phase in their own Round. Meaning this issue will not happen for every single buyerAgent when it does occur.
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.