Feat: Implement Robust On-Chain Logic for Game Settlement and Staking (#526)#681
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 17 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@kryputh 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! 🚀 |
Resolves #526
Context
This PR implements critical on-chain lifecycle management functions in
contracts/game_contract/src/lib.rsto securely handle game settlement and staking withdrawals. It addresses structural gaps in how normal wins are claimed and how unmatched stakes are refunded.Tasks Completed
claim_win: Normal wins (checkmates) are now processed on-chain using an ED25519 payload signature (game_id || winner_address) verified against theADMIN_KEYto guarantee authenticity and immediately trigger the escrow payout.cancel_game: Adds necessary staking logic allowing game creators to cancel a game and retrieve their staked tokens fromESCROWprior to an opponent joining (GameState::Created).claim_draw: Refactored the draw logic to require a backend-signed payload (game_id || "DRAW"), preventing malicious or losing players from unilaterally declaring a draw to recoup their wagers.Acceptance Criteria Met:
#526