Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force_claim_period_start can put the contract in an invalid state #6

Open
andreiashu opened this issue Oct 13, 2021 · 0 comments
Open

Comments

@andreiashu
Copy link
Member

Description

force_claim_period_start is an owner_only operated function that allows the owner of the contract to move the stage into Claim:

#[only_owner]
#[endpoint(forceClaimPeriodStart)]
fn force_claim_period_start(&self) -> SCResult<()> {
let total_winning_tickets = self.nr_winning_tickets().get();
self.total_confirmed_tickets().set(&total_winning_tickets);
Ok(())

The issue is that this function should fail when the owner, mistakenly, calls it and creates a stage transition that is erroneous.

For example, when in any stage before ConfirmTickets, this function should fail: moving to Claim stage without allowing users to confirm their tickets does not make sense.

Recommendation

The function should check if the stage transition is a valid one before allowing an owner to perform it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant