Feat/issue127 standardize status#148
Merged
Otaiki1 merged 2 commits intoApr 27, 2026
Merged
Conversation
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.
closes #127
Changes Made
Renamed Open to Active: The variant RaffleStatus::Open has been renamed to RaffleStatus::Active to align with the terminology used in logic checks and to fulfill the requirement for consistency.
Updated All References: Audited and updated every occurrence of RaffleStatus::Open in mod.rs, lib.rs, and test.rs.
buy_tickets Fix: Updated the logic in buy_tickets to ensure it only proceeds if the raffle status is Active and the prize has been deposited. This resolves the reported inconsistency where tickets could be purchased before the raffle was fully "Active" (i.e., prize-backed).
finalize_raffle Audit: Verified that finalize_raffle correctly transitions a raffle from Active to Drawing only when the expiration or ticket-count conditions are met, ensuring state integrity.
Fixed Failing Panic Tests: The rename and the addition of the prize_deposited check resolved several failing unit tests (e.g., test_invalid_state_transition_buy_before_deposit) that were previously passing incorrectly.
Updated Mocking: Ensured all test cases use the new Active variant, maintaining a passing build.
Verification Results
Status Consistency: All RaffleStatus variants are now used consistently across the codebase.
Test Results: Core raffle flow tests and status-transition tests (like test_basic_internal_raffle_flow) are passing.
Build: cargo check and cargo test verify the structural integrity of the changes.