fix(dec-20-audit): [H01] Bond penalty may not apply#2329
fix(dec-20-audit): [H01] Bond penalty may not apply#2329mrice32 merged 2 commits intoUMAprotocol:masterfrom
Conversation
Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
| uint256 bond = request.bond; | ||
|
|
||
| // Unburned portion of the loser's bond = floor(bond / 2) | ||
| uint256 unburnedBond = bond.div(2); |
There was a problem hiding this comment.
Is there any way to link unburnedBond and burnedBond via state variables? It's not very readable how burnedBond + unburnedBond = bond.
However, I don't really like the idea of storing burnedBond on-chain because it contributes bytecode and gas to store a variable that isn't that important to the user, so I understand why you did it this way.
There was a problem hiding this comment.
Maybe we could use a helper method to standardize the computation?
There was a problem hiding this comment.
Yeah, we could return burnedBond + unburnedBond + an assertion that their sum equals bond which should help reduce some of the testing code
There was a problem hiding this comment.
I added a function to compute the burned bond and compute unburned bond by doing bond - burned bond, which should guarantee burned bond + unburned bond = bond.
| await verifyBalanceSum(optimisticOracle.address, reward, totalCustomBond); | ||
| }); | ||
|
|
||
| it("Burned bond rounding", async function() { |
nicholaspai
left a comment
There was a problem hiding this comment.
Thanks for adding the internal method I think this makes it more readable and easier to change in the future
Motivation
The optimistic oracle is designed so that in the event of a dispute, the incorrect party pays the bond penalty to the vindicated party, as determined by the DVM. However, if the proposer and disputer are the same entity, this transfer has no effect. The only remaining deterrent is the DVM fee. Since the bond size is specifically chosen to dissuade attackers from submitting the wrong price and delaying resolution, the ability to nullify the bond penalty undermines the economic reasoning. Moreover, if the reward exceeds the DVM fee, the attacker may actually be positively rewarded for delaying the resolution.
This attack does not apply to contracts deployed from the Perpetual Multiparty template, because they disregard disputed price requests. Nevertheless, it does limit the simplicity and applicability of the optimistic oracle. Consider burning some or all of the bond penalty and ensuring the reward is not high enough to compensate.
Summary
As suggested above, half of the bond is paid to the store in order to "burn" it. This makes the loss for someone who intentionally delays a request by proposing and disputing themselves proportional to the bond.
Issue(s)
N/A