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

[Eprod-974] Process Poll Timer #3

Merged
merged 10 commits into from
Aug 30, 2024
Merged

[Eprod-974] Process Poll Timer #3

merged 10 commits into from
Aug 30, 2024

Conversation

ufoscout
Copy link
Contributor

No description provided.

Base automatically changed from EPROD-969_inspect_message to main August 26, 2024 15:10
@ufoscout ufoscout marked this pull request as ready for review August 26, 2024 15:18
src/upgrader_canister/src/state/polls.rs Outdated Show resolved Hide resolved
}

/// Closes the poll
pub fn close(self, result: PollResult) -> ClosedPoll {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to derive the result of the poll here instead of giving it from outside? The current approach opens a way to create a closed poll with more no votes, that is still accepted. Of course, it will probably not happen, but it's usually better to have type system protect you from creating an invalid instance.

It's not a blocker, so I will approve the PR, but consider refactoring this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PollResult is provided from outside because here we don't know the poll-approval policy. As of today, we require yes-votes to be more than no-votes, but we could apply different strategies like "All yes-votes", "At least 60% yes-votes" and so on. If needed, this can be refactored in the future to accept an "ApprovalStrategy" instead of a PollResult

@ufoscout ufoscout merged commit be861de into main Aug 30, 2024
1 check passed
@ufoscout ufoscout deleted the EPROD-974_timer branch August 30, 2024 09:57
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

Successfully merging this pull request may close these issues.

5 participants