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

Bug Fix : Delete Elections is not guarded by Modifier #34

Closed
Ronnieraj37 opened this issue Mar 23, 2024 · 0 comments
Closed

Bug Fix : Delete Elections is not guarded by Modifier #34

Ronnieraj37 opened this issue Mar 23, 2024 · 0 comments

Comments

@Ronnieraj37
Copy link
Contributor

Ronnieraj37 commented Mar 23, 2024

Problems:

  • Delete Elections function doesn't have a onlyOwner Modifier. This can make anyone to delete any election.
  • There are 2 deleteElection functions both in Elections.sol and ElectionStorage.sol where one calls the other.

Elections.sol

        electionStorage.deleteElection(_election);
    }

ElectionStorage.sol

   function deleteElection (address _election) external {
        Election election = Election(_election);
        require(election.getStatus() == Election.Status.pending, "Cannot delete election after election has started");
        ...
}

Instead of adding a modifier in deleteElections we should add it inside the electionStorage and remove this function as this will just cause unnecessary loops and extra gas if modifier is added to Elections.sol.

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

No branches or pull requests

1 participant