You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Fix dispute fee distribution for multi rounds (#1030)
* fix: refund dispute fees from round 1 amount, burn later round fees
* Fix/dispute multiround review findings (#1032)
* test: clean up multi-round dispute integration tests
Dedupe the multi-round dispute test scaffolding ahead of the
multi-round fee fixes: fold the from-bond round-1 starter into a
payFromBond param, route round-1 setup through markRoundUnresolved,
add proposeRound/fundedDisputer/seedTipper helpers for the repeated
proposal and account blocks, and make setupDisputedReporter delegate
to the multi-reporter variant. Replace the tipper validator account
with a plain funded account (only its tips carry vote power), make
vote execution deterministic instead of conditional, and drop debug
prints and review-process commentary from test comments.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: do not track later-round dispute fees as refundable first-round stake
AddDisputeRound paid escalation-round fees with isFirstRound=true, so a
later round paid from bond appended its stake origins to the
FeePaidFromStake tracker under the dispute's shared hash id. FeeRefund
distributes the refundable round-1 fee pro-rata over that tracker, so a
later-round bond payer could siphon part of the round-1 payer's refund
(or leave a stale tracker when round 1 was account-funded). Later-round
fees are fully consumed and never refunded, so pass isFirstRound=false.
Adds regression tests covering account-funded and bond-funded round 1,
the refund split after an INVALID resolution, and max-round escalation
where every later round pays from bond.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: burn later-round fee pool when no claim-eligible voters exist
ExecuteVote reserved half of BurnAmount as a voter reward whenever any
vote group participated, including the team. CalculateReward only pays
user and reporter voters, so a dispute resolved by team vote alone
reserved an unclaimable balance in the dispute module forever; with
later-round fees now accumulating into BurnAmount, that stranded amount
grows with every escalation round.
Gate the voter reward on claim-eligible participation instead: rename
GetSumOfAllGroupVotesAllRounds to GetSumOfUserAndReporterVotesAllRounds
and drop team votes from the sum, so team-only resolutions burn the
entire consumed fee pool.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: resolve first-round fee payer in ClaimableDisputeRewards
DisputeFeePayer records are only ever written under the round-1 dispute
id, and WithdrawFeeRefund resolves PrevDisputeIds[0] before loading
them. The ClaimableDisputeRewards query looked the payer up under the
requested dispute id instead, so querying the final resolved round of a
multi-round dispute reported a zero fee refund that the transaction
path would actually pay. Resolve the first-round id in the query the
same way the transaction does.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: report previous-round voter rewards in ClaimableDisputeRewards
The query only called CalculateReward when the address had a Voter
record under the requested dispute id, but ClaimReward has no such
gate: CalculateReward scans every round via PrevDisputeIds, so an
address that voted only in an earlier round of a multi-round dispute
has a real claim that the query reported as zero. Use the final-round
Voter record solely for the RewardClaimed flag (matching where
ClaimReward stores it) and compute the reward regardless; CalculateReward
already yields zero for non-participants.
Includes a combined regression test where one address holds both a
round-1 fee refund and a previous-round-only voter reward, queried by
the final dispute id and then withdrawn through both transaction paths.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: correct round-1 fee split in ADR1011 and trim blank line at EOF
Round 1's 5% does not all go to the burn pool: execution burns half and
reserves half as the voter reward, and burns all of it when no users or
reporters voted. Also remove the trailing blank line flagged by
git diff --check.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: preserve previous-round voter rewards
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Dan F <florentinodc@outlook.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
A dispute can go through more than one round. Round 1 is the main dispute. If a round does not reach quorum someone can push it to another round by paying a fee, and that fee doubles every round. The chain caps this at 5 rounds.
14
+
15
+
This ADR is about what the fee is for each round and what happens to it.
16
+
17
+
Round 1's fee is refundable. You pay the dispute fee, which is the same as the slash amount. If the dispute resolves support you get your fee back minus a small burn and you also get the reporter's slashed tokens. If it resolves invalid you just get your fee back minus the burn. If it resolves against you the reporter gets your fee. So the round 1 fee comes back to you unless you lose the dispute.
18
+
19
+
Rounds 2 and up are different. The fee you pay to start another round is not refundable to anyone. It is a burn. The whole fee gets consumed, half of it is actually burned and half goes to the voters of the dispute (if no users or reporters voted in any round, the voter half is burned as well). The only thing that is ever refundable is the round 1 fee.
20
+
21
+
The fee for each extra round starts at 5% of the slash amount and doubles each round. So round 2 is 10% of the slash, round 3 is 20%, round 4 is 40%, round 5 is 80%, capped at 100%. It gets expensive fast on purpose.
22
+
23
+
Why it works this way:
24
+
25
+
If a dispute is extended to multiple rounds, the escalating fee does two things:
26
+
27
+
1. The doubling fee keeps anyone from dragging a dispute out forever. Every extra round costs a lot more than the last one.
28
+
2. Half of the round fee goes to the voters to incentivize them to vote on the extra rounds. The fee grows as the rounds go up, so the reward for voting grows with it. Burning all of it instead would just destroy the tokens.
29
+
30
+
The round 1 fee stays separate from all of this. It is the part that is actually at risk between the disputer and the reporter, and the final round decides what happens to it. The extra round fees are just the cost of asking for another vote.
31
+
32
+
33
+
## Issues / Notes on Implementation
34
+
35
+
The fee schedule for reference, with s as the slash amount (5% is s/20):
36
+
37
+
- Round 1: pay s. This is the refundable fee. 5% is consumed (half burned, half reserved as the voter reward; all of it burned if no users or reporters voted), 95% is refundable.
0 commit comments