Skip to content

Commit 72428df

Browse files
committed
fix test
1 parent e99f069 commit 72428df

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

tests/reporting/test_fee_distribution.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
def test_initial_report_and_participation_fee_collection(localFixture, universe, market, categoricalMarket, scalarMarket, cash, reputationToken):
88
feeWindow = localFixture.applySignature('FeeWindow', market.getFeeWindow())
9+
constants = localFixture.contracts["Constants"]
910

1011
# We cannot purchase participation tokens yet since the window isn't active
1112
with raises(TransactionFailed):
@@ -68,14 +69,15 @@ def test_initial_report_and_participation_fee_collection(localFixture, universe,
6869

6970
marketStake = marketInitialReport.getStake()
7071
expectedFees = reporterFees * marketStake / totalStake
72+
expectedGasBond = 2 * constants.GAS_TO_REPORT() * constants.DEFAULT_REPORTING_GAS_PRICE()
7173
with TokenDelta(reputationToken, marketStake, tester.a0, "Redeeming didn't refund REP"):
72-
with EtherDelta(expectedFees, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
74+
with EtherDelta(expectedFees + expectedGasBond, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
7375
assert marketInitialReport.redeem(tester.a0)
7476

7577
categoricalMarketStake = categoricalInitialReport.getStake()
7678
expectedFees = reporterFees * categoricalMarketStake / totalStake
7779
with TokenDelta(reputationToken, categoricalMarketStake, tester.a0, "Redeeming didn't refund REP"):
78-
with EtherDelta(expectedFees, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
80+
with EtherDelta(expectedFees + expectedGasBond, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
7981
assert categoricalInitialReport.redeem(tester.a0)
8082

8183
def test_failed_crowdsourcer_fees(localFixture, universe, market, cash, reputationToken):
@@ -121,6 +123,7 @@ def test_failed_crowdsourcer_fees(localFixture, universe, market, cash, reputati
121123

122124
def test_one_round_crowdsourcer_fees(localFixture, universe, market, cash, reputationToken):
123125
feeWindow = localFixture.applySignature('FeeWindow', market.getFeeWindow())
126+
constants = localFixture.contracts["Constants"]
124127

125128
# We'll make the window active
126129
localFixture.contracts["Time"].setTimestamp(feeWindow.getStartTime() + 1)
@@ -159,11 +162,14 @@ def test_one_round_crowdsourcer_fees(localFixture, universe, market, cash, reput
159162

160163
# The initial reporter gets fees even though they were not correct. They do not get their REP back though
161164
expectedFees = cash.balanceOf(feeWindow.address) + cash.balanceOf(universe.getOrCreateFeeWindowBefore(feeWindow.address))
165+
expectedGasBond = 2 * constants.GAS_TO_REPORT() * constants.DEFAULT_REPORTING_GAS_PRICE()
162166
with TokenDelta(reputationToken, 0, tester.a0, "Redeeming didn't refund REP"):
163-
with EtherDelta(expectedFees, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
167+
with EtherDelta(expectedFees + expectedGasBond, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
164168
assert initialReporter.redeem(tester.a0)
165169

166170
def test_multiple_round_crowdsourcer_fees(localFixture, universe, market, cash, reputationToken):
171+
constants = localFixture.contracts["Constants"]
172+
167173
# Initial Report disputed
168174
proceedToNextRound(localFixture, market, tester.k1, True)
169175
# Initial Report winning
@@ -197,8 +203,9 @@ def test_multiple_round_crowdsourcer_fees(localFixture, universe, market, cash,
197203
# The initial reporter locked in REP for 5 rounds.
198204
expectedInitialReporterFees = getExpectedFees(localFixture, cash, initialReporter, 5)
199205
expectedRep = long(initialReporter.getStake() + initialReporter.getStake() / 2)
206+
expectedGasBond = 2 * constants.GAS_TO_REPORT() * constants.DEFAULT_REPORTING_GAS_PRICE()
200207
with TokenDelta(reputationToken, expectedRep, tester.a0, "Redeeming didn't refund REP"):
201-
with EtherDelta(expectedInitialReporterFees, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
208+
with EtherDelta(expectedInitialReporterFees + expectedGasBond, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
202209
assert initialReporter.redeem(tester.a0)
203210

204211
# The first winning dispute crowdsourcer will get fees for 4 rounds

tests/reporting/test_universe_redeem.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_redeem_participation_tokens(kitchenSinkFixture, universe, market, cash)
6262

6363
def test_redeem_reporting_participants(kitchenSinkFixture, market, categoricalMarket, scalarMarket, universe, cash):
6464
reputationToken = kitchenSinkFixture.applySignature("ReputationToken", universe.getReputationToken())
65+
constants = kitchenSinkFixture.contracts["Constants"]
6566

6667
# Initial Report
6768
proceedToNextRound(kitchenSinkFixture, market, doGenerateFees = True)
@@ -90,8 +91,9 @@ def test_redeem_reporting_participants(kitchenSinkFixture, market, categoricalMa
9091
expectedRep = long(winningDisputeCrowdsourcer2.getStake() + winningDisputeCrowdsourcer1.getStake())
9192
expectedRep = long(expectedRep + expectedRep / 2)
9293
expectedRep += long(initialReporter.getStake() + initialReporter.getStake() / 2)
94+
expectedGasBond = 2 * constants.GAS_TO_REPORT() * constants.DEFAULT_REPORTING_GAS_PRICE()
9395
with TokenDelta(reputationToken, expectedRep, tester.a0, "Redeeming didn't refund REP"):
94-
with EtherDelta(expectedFees, tester.a0, kitchenSinkFixture.chain, "Redeeming didn't increase ETH correctly"):
96+
with EtherDelta(expectedFees + expectedGasBond, tester.a0, kitchenSinkFixture.chain, "Redeeming didn't increase ETH correctly"):
9597
with PrintGasUsed(kitchenSinkFixture, "Universe Redeem:", 0):
9698
assert universe.redeemStake([initialReporter.address, winningDisputeCrowdsourcer1.address, winningDisputeCrowdsourcer2.address], [])
9799

0 commit comments

Comments
 (0)