zeitgeist icon indicating copy to clipboard operation
zeitgeist copied to clipboard

Reserve-Bonds in prediction markets when updating the const parameter_types!

Open Chralt98 opened this issue 2 years ago • 1 comments

The prediction market pallet works at the moment with constant values as the OracleBond, ValidityBond, AdvisoryBond etc...

Imagine the following scenario:

Someone creates a permissionless market, which implies a reserve of the OracleBond and the ValidityBond. Let's make the assumption, that the market resolves in one year from now. In this year timespan we decide to update the OracleBond or ValidityBond to be two times lower (because of base asset price fluctuations). Assume, that now is the time (after one year) for the resolution. The bonds get unreserved, but the market creator gets only half of what he initially paid for.

How do we handle updating these values in the future?

Chralt98 avatar Jun 07 '22 09:06 Chralt98

Good catch Chris, this is a serious problem that we has to be handled.

case 1: We reduce the bonds This is straightforward, a migration will unreserve the the difference.

case 2: We increase the bonds This can become more problematic, because we hold all reserves in one named reserved. When unreserving the bond using the new higher values, there are also two cases. One case is that this bond that is unreserved is the only reserve for that account and name (named reserve). In that case, the pallet will just unreserve as much as possible. The other case is a little more ugly. If there are other reserves, it will touch the other reserves as well, because the pallet cannot differentiate (currently) what the reserves belong too (i.e. if it is a oracle bond or a validity bond). In the end nothing really critical happens (as I can tell right now, maybe I am wrong), but the account gets some of the reserves back too early. I am raising the priority to medium for now. There are more important tasks with heavier consequence if untreated in the queue marked with high priority, but sometime we will definitely want to handle that scenario.

sea212 avatar Jul 10 '22 14:07 sea212