Implement dead chip / uncollected pot management contract (Issue #206) - #473
Merged
Marvy247 merged 2 commits intoAug 29, 2026
Merged
Conversation
Add verifiable random function (VRF) to the deal circuit. - Prove that the shuffle seed was derived from a VRF output - Enables public verifiability of randomness Changes: - circuits/lib/src/vrf.nr: New VRF module with prove/verify functions - circuits/lib/src/lib.nr: Expose VRF module - circuits/deal_valid/src/main.nr: Accept VRF inputs, derive shuffle seed - circuits/deal_valid_2p/5p/6p/src/main.nr: Update parameterized circuits
- Added treasury contract address configuration to TableConfig - Added dead_chip_timeout_ledgers and reclaim_period_ledgers to TableConfig - Added settlement_entered_ledger field to TableState to track when table entered Settlement - Added SweepState struct to track swept amounts per player - Added DeadChipSweep data key for persistent storage - Implemented sweep_dead_chips() function: * Sweeps uncollected player stacks, pot, and side pots to treasury * Only callable after dead_chip_timeout_ledgers have passed since Settlement * Requires treasury to be configured and timeout > 0 * Records sweep state for potential reclaim * Emits dead_chips_swept event - Implemented reclaim_dead_chips() function: * Allows players to reclaim swept chips within reclaim period * Verifies Ed25519 signature for ownership proof * Transfers chips back from treasury to player * Emits dead_chips_reclaimed event - Implemented get_dead_chip_sweep_state() view function - Updated all Settlement phase transitions to record settlement_entered_ledger - Added new error codes for dead chip operations - Updated PokerTableError enum with unique discriminant values
|
@MarcusDavidG 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! 🚀 |
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
This PR implements dead chip / uncollected pot management as requested in Issue #206, allowing uncollected chips from abandoned tables to be swept to a treasury contract after a timeout, with a reclaim period for players to recover their chips.
Changes
Types (types.rs)
Contract Functions (lib.rs)
sweep_dead_chips(): Sweeps uncollected player stacks, pot, and side pots to treasury after timeout
reclaim_dead_chips(): Allows players to reclaim swept chips within reclaim period
get_dead_chip_sweep_state(): View function to inspect sweep state
Settlement Tracking
Error Codes
Closes #206