relist function Simply adds to new buyer's list without cleaning old state
AssetListing storage asset = listings[_asset];
The variable name asset
shadows the parameter _asset
, making the code confusing and error-prone
// Example Scenario:
// Initial state:
assetsPerBuyerRound[buyerA][1] = [asset1, asset2, asset3]
// After relisting asset2 to buyerB:
assetsPerBuyerRound[buyerA][1] = [asset1, asset2, asset3] // Still contains asset2!
assetsPerBuyerRound[buyerB][2] = [asset2] // Added here too
// Problems:
// 1. Asset counted towards buyerA's limit
// 2. Inconsistent state
Inconsistent state in relist which affects maxAssetCount calculations. Doesn't remove asset from old buyer's list
Manual Review
Find asset in old buyer's array. Remove asset efficiently. Move last element to the removed position (unless it's the last element)
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.