Repository navigation
Overturn window, claim guard, exact accrual, dispute gate - #2268
Merged
Olowodarey merged 2 commits intoNov 23, 2026
Merged
Olowodarey merged 2 commits into
Olowodarey merged 2 commits into
Conversation
Resolves Arena1X#2196. Resolves Arena1X#2197. Resolves Arena1X#2199. Resolves Arena1X#2205.
|
@ussyalfaks Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four independent contract hardening changes.
#2196 — Bounded overturn window for match results (
creator-event-manager)MATCH_RESULT_OVERTURN_WINDOW_SECONDS(1 day).overturn_match_resultnow rejects withoverturn_window_closedoncenow >= submitted_at + window, or once the result has been marked final.submitted_at, so repeated overturns can't keep a result open forever.finalize_match_result(match_id)(infinalize.rs) marks a result final after the window closes and emits("match", "result_final")with(match_id, event_id, home, away, finalized_at).finalize_eventalso marks every remaining result of the event final, so each result emits the event exactly once. New view:get_match_result_finalized_at.DataKey::MatchResultFinalizedAt(match_id)plus get/set helpers.finalize_match_resultand throughfinalize_event).#2197 — Guard prize claims against double-claim (
creator-event-manager)storage::set_prize_allocationnow treatsclaimedas permanent: a settled allocation can never be written back to unclaimed, whatever order calls happen in.storage::mark_prize_allocation_claimedchecks and sets the flag in one step.claim_prizecalls it before the transfer (checks-effects-interactions), so a failed transfer reverts the claim along with it.claimed = true; a second claim is rejected with no extra payout; exactly one("prize", "claimed")event is emitted; trying to reset the flag in storage has no effect.#2199 — Precise reward accrual in the staking vault (
staking-vault)distributekept leftover whole units inpending_rewardswhile the accumulator also held the fractional part of the same amount. That value was counted twice, so over many deposits stakers could claim more than was funded.src/config.rsdocuments the fixed-point model and what precision it guarantees. Distribution now works in scaled units and carries the sub-unit remainder forward in a newPoolState::reward_remainder, so the pool's books balance exactly after every distribution.reward_debtis now kept in scaled units. The newpool::settlepays a position and moves it to its new share count while keeping any fraction it earned but hasn't been paid. Over its lifetime a position gets the floor of its exact share: short by less than one unit, however many deposits or claims happen.RewardLedger(funded/distributed) is updated on fee deposits, routed penalties and every reward payout (stake, unstake, withdraw, claim). Payouts are capped so thatdistributed <= fundedalways holds.pending_rewards == 1); it now checks the exact scaled accounting instead.#2205 — Resolution dispute window for open-market (
open-market)config.rsaddsdispute_window_end,is_dispute_window_open,has_open_dispute,ensure_payouts_unlockedandare_payouts_paused.claim_payoutandbatch_distribute_payoutsare blocked while a dispute against the resolution is open. They returnDisputeAlreadyFiled, reused because the error enum is at its 50-case cap.("dsp", "raised")and("dsp", "reslvd"). New views:are_payouts_pausedandget_dispute_window_end.Closes #2196
Closes #2197
Closes #2199
Closes #2205
Closes #2196
Closes #2197
Closes #2199
Closes #2205