feat: Add timeout mechanism to prevent griefing#2
Open
Abidoyesimze wants to merge 2 commits intoLearnWeb3DAO:mainfrom
Open
feat: Add timeout mechanism to prevent griefing#2Abidoyesimze wants to merge 2 commits intoLearnWeb3DAO:mainfrom
Abidoyesimze wants to merge 2 commits intoLearnWeb3DAO:mainfrom
Conversation
- Add last-move-block tracking to game state - Implement cancel-game function for timeout scenarios - Add can-cancel-game read-only function - Add comprehensive timeout tests (6 new test cases) - Prevent players from indefinitely stalling games - Ensure fair fund distribution when games are cancelled - Only game participants can cancel games - Games that have ended cannot be cancelled Resolves the griefing issue where losing players could refuse to make moves, leaving games in limbo with locked funds.
Features Added: - Timeout protection system to prevent griefing by inactive players - Smart contract functions: cancel-game and can-cancel-game - Frontend UI components for timeout management - Real-time timeout status checking Technical Implementation: - Updated contract address to deployed testnet version - Added last-move-block field to game data structure - Created TimeoutIndicator React component with cancel button - Integrated cancel-game functionality in useStacks hook - Added canCancelGame read-only function for UI state management UI/UX Enhancements: - Timeout warning banner for ongoing games - One-click game cancellation for eligible players - Visual feedback for timeout protection status - Seamless integration with existing game flow Anti-Griefing Measures: - Players can cancel games after timeout period - Automatic fund distribution to non-timeout player - Prevents indefinite game stalling - Protects player investments from bad actors This implementation solves the critical griefing issue where losing players could refuse to make moves, locking up both players' funds indefinitely.
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.
Resolves the griefing issue where losing players could refuse to make moves, leaving games in limbo with locked funds.