Skip to content

feat: add match cancellation fee to discourage abuse#1020

Merged
famvilianity-eng merged 2 commits into
StellarCheckMate:mainfrom
AbuJulaybeeb:feat/951-cancellation-fee
Jul 1, 2026
Merged

feat: add match cancellation fee to discourage abuse#1020
famvilianity-eng merged 2 commits into
StellarCheckMate:mainfrom
AbuJulaybeeb:feat/951-cancellation-fee

Conversation

@AbuJulaybeeb

Copy link
Copy Markdown

What was done

  • Added cancellation_fee_basis_points: u32 to the ProtocolConfig structure with a default value of 100 (1%).
  • Updated the cancel_match logic to calculate the cancellation fee using the formula: stake_amount * cancellation_fee_basis_points / 10_000.
  • Implemented the deduction of the calculated fee from the cancelling player's deposit prior to refunding the remaining balance.

Why it was done

Previously, players could cancel pending matches for free, which created a DoS vulnerability through spam cancellations. Introducing a small cancellation fee economically disincentivizes this abusive behavior and ensures protocol stability.

How it was verified

  • Verified fee calculation math correctly applies the configured basis points to the player's stake.
  • Confirmed the fee is correctly deducted from the refund amount.
  • Validated that the remaining balance is successfully refunded to the cancelling player.
  • Executed the test suite (cargo test) to ensure all cancellation flow tests and invariants pass successfully.

Closes #951

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@AbuJulaybeeb 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! 🚀

Learn more about application limits

@famvilianity-eng famvilianity-eng merged commit c8b0e5b into StellarCheckMate:main Jul 1, 2026
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.

Add Match Cancellation Fee to Discourage Abuse

2 participants