Ripe Sage Ant
Medium
Removal of marketConfig swaps elements in array. When users create new market, they specify config index in array. As a result, they will create market with incorrect config because removal swaps indexes.
- In ReputationMarket.removeMarketConfig() it swaps indexes.
- In ReputationMarket._createMarket() it uses config index to specify which type of config to use.
- Admin needs to call
removeMarketConfig()
to remove non-last index, for example 1 - At the same time there must be tx in mempool
createMarket()
which uses config with same index, i.e. 1
- Let's say there are 3 configs in array:
[config0, config1, config2]
- User submits tx to create Market with config1, i.e. configIndex = 0
- Admin removes marketConfig 1. So entries are swapped and now are following: [config0, config2]
- User's tx is executed. Market with config2 is created by mistake.
The market creator creates market with incorrect config. There is no functionality to create market with correct config anymore.
No response
Do not swap entries in array marketConfigs
. Or add arguments to specify wanted config in createMarket()