-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix uo #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totalAmount >= totalOutcomeAmounts[_outcome]
spreadMultiplier >= 2 >= 1
maxAmount = sM * (tA - tOA[i]) - tOA[i] == sM * tA - (sM + 1) * tOA[i] >= 0 when
tA >= ((sM + 1) / sM) * tOA[i]
Edit: originally, I had a minus instead of a plus sign, and that caused my math to say that this expression would work no matter what, but I've since corrected that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops =___= I made an error in my analysis. Lemme see if there is still an edge case.
Okay, so I recommend adding a test section under the challenge: // Sender 1 tries to increase their bid but can't
await etherToken.deposit({value: 50, from: accounts[sender1]})
await etherToken.approve(ultimateOracle.address, 50, { from: accounts[sender1] })
await ultimateOracle.voteForOutcome(2, 50, { from: accounts[sender1] })
assert.equal(await ultimateOracle.outcomeAmounts(accounts[sender1], 2), 100) And clamping the subtraction so the maxAmount gets set to 0 when the subtraction would underflow. |
Looks good to me! That additional test is a good idea. |
Thank you both for checking, I will add the test. |
Added a test for this @cag The transaction throws, because the .sub method throws. |
Codecov Report
@@ Coverage Diff @@
## master #28 +/- ##
==========================================
+ Coverage 84.78% 85.01% +0.22%
==========================================
Files 25 25
Lines 631 634 +3
Branches 105 106 +1
==========================================
+ Hits 535 539 +4
+ Misses 96 95 -1
Continue to review full report at Codecov.
|
Clamp instead of revert in limit subtraction
Refactor test runner and add filtration option
A fix for the front running issue in the UO discovered by @niran
(For some reason I cannot add you as reviewer @niran. I guess because you are not part of the Gnosis organization?)