Skip to content

[Backport release/v6.x] Fix dispute fee distribution for multi rounds#1035

Merged
brendaloya merged 1 commit into
release/v6.xfrom
backport-1030-to-release/v6.x
Jun 12, 2026
Merged

[Backport release/v6.x] Fix dispute fee distribution for multi rounds#1035
brendaloya merged 1 commit into
release/v6.xfrom
backport-1030-to-release/v6.x

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport 33c4113 from #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>
(cherry picked from commit 33c4113)
@brendaloya brendaloya merged commit f315786 into release/v6.x Jun 12, 2026
0 of 3 checks passed
@brendaloya brendaloya deleted the backport-1030-to-release/v6.x branch June 12, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants