Skip to content

Commit 5141ebf

Browse files
committed
the gas bonds should go to the market creator, not the designated reporter
1 parent 72428df commit 5141ebf

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

source/contracts/reporting/Market.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ contract Market is DelegationTarget, Extractable, ITyped, Initializable, Ownable
8989
if (_refund > 0) {
9090
require(owner.call.value(_refund)());
9191
}
92-
// Send the reporter gas bond to the initial report contract. It will be paid out only if they are correct.
93-
cash.depositEtherFor.value(reporterGasCostsFeeAttoeth)(participants[0]);
9492
return true;
9593
}
9694

@@ -225,8 +223,10 @@ contract Market is DelegationTarget, Extractable, ITyped, Initializable, Ownable
225223
// If the designated reporter showed up return the no show bond to the market creator. Otherwise it will be used as stake in the first report.
226224
if (_reporter == _initialReporter.getDesignatedReporter()) {
227225
_reputationToken.transfer(owner, _repBalance);
226+
marketCreatorMailbox.depositEther.value(reporterGasCostsFeeAttoeth)();
228227
} else {
229228
_reputationToken.transfer(_initialReporter, _repBalance);
229+
cash.depositEtherFor.value(reporterGasCostsFeeAttoeth)(_initialReporter);
230230
}
231231
return true;
232232
}

tests/reporting/test_escape_hatches.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ def test_reporting_participant_escape_hatch(localFixture, controller, reputation
7474
assert controller.emergencyStop()
7575

7676
# We can now call the escape hatch
77-
expectedGasBond = 2 * constants.GAS_TO_REPORT() * constants.DEFAULT_REPORTING_GAS_PRICE()
78-
with EtherDelta(expectedGasBond, initialReporter.getOwner(), localFixture.chain, "Initial reporter did not get the reporting gas cost bond"):
79-
with TokenDelta(reputationToken, reputationToken.balanceOf(initialReporter.address), tester.a0, "REP was not given back"):
80-
assert initialReporter.withdrawInEmergency()
77+
with TokenDelta(reputationToken, reputationToken.balanceOf(initialReporter.address), tester.a0, "REP was not given back"):
78+
assert initialReporter.withdrawInEmergency()
8179

8280
with TokenDelta(reputationToken, reputationToken.balanceOf(crowdsourcer1.address), tester.a0, "REP was not given back"):
8381
assert crowdsourcer1.withdrawInEmergency()

tests/reporting/test_fee_distribution.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,14 @@ def test_initial_report_and_participation_fee_collection(localFixture, universe,
6969

7070
marketStake = marketInitialReport.getStake()
7171
expectedFees = reporterFees * marketStake / totalStake
72-
expectedGasBond = 2 * constants.GAS_TO_REPORT() * constants.DEFAULT_REPORTING_GAS_PRICE()
7372
with TokenDelta(reputationToken, marketStake, tester.a0, "Redeeming didn't refund REP"):
74-
with EtherDelta(expectedFees + expectedGasBond, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
73+
with EtherDelta(expectedFees, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
7574
assert marketInitialReport.redeem(tester.a0)
7675

7776
categoricalMarketStake = categoricalInitialReport.getStake()
7877
expectedFees = reporterFees * categoricalMarketStake / totalStake
7978
with TokenDelta(reputationToken, categoricalMarketStake, tester.a0, "Redeeming didn't refund REP"):
80-
with EtherDelta(expectedFees + expectedGasBond, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
79+
with EtherDelta(expectedFees, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
8180
assert categoricalInitialReport.redeem(tester.a0)
8281

8382
def test_failed_crowdsourcer_fees(localFixture, universe, market, cash, reputationToken):
@@ -162,9 +161,8 @@ def test_one_round_crowdsourcer_fees(localFixture, universe, market, cash, reput
162161

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

170168
def test_multiple_round_crowdsourcer_fees(localFixture, universe, market, cash, reputationToken):
@@ -203,9 +201,8 @@ def test_multiple_round_crowdsourcer_fees(localFixture, universe, market, cash,
203201
# The initial reporter locked in REP for 5 rounds.
204202
expectedInitialReporterFees = getExpectedFees(localFixture, cash, initialReporter, 5)
205203
expectedRep = long(initialReporter.getStake() + initialReporter.getStake() / 2)
206-
expectedGasBond = 2 * constants.GAS_TO_REPORT() * constants.DEFAULT_REPORTING_GAS_PRICE()
207204
with TokenDelta(reputationToken, expectedRep, tester.a0, "Redeeming didn't refund REP"):
208-
with EtherDelta(expectedInitialReporterFees + expectedGasBond, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
205+
with EtherDelta(expectedInitialReporterFees, tester.a0, localFixture.chain, "Redeeming didn't increase ETH correctly"):
209206
assert initialReporter.redeem(tester.a0)
210207

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

tests/reporting/test_universe_redeem.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def test_redeem_reporting_participants(kitchenSinkFixture, market, categoricalMa
9393
expectedRep += long(initialReporter.getStake() + initialReporter.getStake() / 2)
9494
expectedGasBond = 2 * constants.GAS_TO_REPORT() * constants.DEFAULT_REPORTING_GAS_PRICE()
9595
with TokenDelta(reputationToken, expectedRep, tester.a0, "Redeeming didn't refund REP"):
96-
with EtherDelta(expectedFees + expectedGasBond, tester.a0, kitchenSinkFixture.chain, "Redeeming didn't increase ETH correctly"):
97-
with PrintGasUsed(kitchenSinkFixture, "Universe Redeem:", 0):
98-
assert universe.redeemStake([initialReporter.address, winningDisputeCrowdsourcer1.address, winningDisputeCrowdsourcer2.address], [])
96+
with PrintGasUsed(kitchenSinkFixture, "Universe Redeem:", 0):
97+
assert universe.redeemStake([initialReporter.address, winningDisputeCrowdsourcer1.address, winningDisputeCrowdsourcer2.address], [])
9998

tests/reporting_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def generateFees(fixture, universe, market):
114114
completeSets = fixture.contracts['CompleteSets']
115115
cash = fixture.contracts['Cash']
116116
mailbox = fixture.applySignature('Mailbox', market.getMarketCreatorMailbox())
117+
assert mailbox.withdrawEther()
117118

118119
cost = 1000 * market.getNumTicks()
119120
marketCreatorFees = cost / market.getMarketCreatorSettlementFeeDivisor()

0 commit comments

Comments
 (0)