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

Backport multisig fixes to voting contracts #178

Merged
merged 5 commits into from
Sep 7, 2022
Merged

Conversation

0xFable
Copy link
Contributor

@0xFable 0xFable commented Sep 5, 2022

Fixes #176
Backported the logic to the package level instead of implementing it in each of the two contracts. If this was not the right approach let me know.
Instead of porting the unit test I made it into a multitest.

@0xFable 0xFable marked this pull request as ready for review September 6, 2022 08:11
@0xFable 0xFable requested review from ueco-jb and maurolacy and removed request for ueco-jb September 6, 2022 08:11
@ueco-jb ueco-jb changed the title Feat/multistatus logic Backport multisig fixes to voting contracts Sep 6, 2022
Copy link

@ueco-jb ueco-jb left a comment

Choose a reason for hiding this comment

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

Logic is correct, but please adjust comments on test.

Comment on lines 165 to 169
// Update Status
proposal.update_status(&env.block);
// We allow execution even after the proposal "expiration" as long as all votes come in before
// that point. If it was approved on time, it can be executed any time.
if proposal.current_status(&env.block) != Status::Passed {
if proposal.status != Status::Passed {
Copy link

Choose a reason for hiding this comment

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

This is redundant, since previous call current_status is called by update_status anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted back 169 to the way it was but curious would it not be more redundant to to keep it that way as proposal.status uses the result of the first current_status call rather than what I went back to which is calling it again?

packages/voting-contract/src/multitest/voting.rs Outdated Show resolved Hide resolved
Comment on lines 404 to 405
// proposal that is open and expired is rejected
assert_eq!(ContractError::Expired {}, err.downcast().unwrap());
Copy link

Choose a reason for hiding this comment

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

That comment is incorrect.
If the proposal was Rejected, it couldn't be closed: https://github.com/confio/poe-contracts/blob/main/packages/voting-contract/src/lib.rs#L199-L201
Can you revisit logic and adjust comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the commentcan make any further changes needed

packages/voting-contract/src/multitest/voting.rs Outdated Show resolved Hide resolved
@0xFable 0xFable requested a review from ueco-jb September 6, 2022 11:46
Copy link

@ueco-jb ueco-jb left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@maurolacy maurolacy left a comment

Choose a reason for hiding this comment

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

LGTM.

Comment on lines +165 to +166
// Update Status
proposal.update_status(&env.block);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not needed. Status will be updated below, and the check is already using current_status.

Copy link
Contributor

@maurolacy maurolacy Sep 6, 2022

Choose a reason for hiding this comment

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

Funny how we have two, three or even more different implementations / variations of the same logic.

It'll be good to move this voting-contract package to cw-plus at some point, and change all multisigs (cw-plus, poe-contracts, and tgrade-contracts) to use it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Created See #194 to track that effort.

@0xFable 0xFable merged commit 69b1d8f into main Sep 7, 2022
@0xFable 0xFable deleted the feat/multistatus-logic branch September 7, 2022 14:10
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.

Backport multisig fixes to voting contracts
3 participants