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

Unit tests for cw3-fixed-multisig #95

Merged
merged 15 commits into from
Sep 27, 2020

Conversation

maurolacy
Copy link
Contributor

@maurolacy maurolacy commented Sep 24, 2020

There are still some extra checks to do, but I think these now are acceptable unit tests.

@maurolacy maurolacy marked this pull request as draft September 24, 2020 19:59
@maurolacy maurolacy self-assigned this Sep 24, 2020
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Thank you for the start. Added some comments on how to simplify the test code, but also some points that need testing and likely don't work properly in the contract code, which I didn't see until reading these test cases. Thank you for them

contracts/cw3-fixed-multisig/src/contract.rs Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
@ethanfrey
Copy link
Member

Nice cleanup, and you convinved me about the 0 weight members. This should be documented in the README (TODO)

@maurolacy maurolacy marked this pull request as ready for review September 26, 2020 15:10
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Looking good, just those last TODOs and it is golden.

contracts/cw3-fixed-multisig/src/contract.rs Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
// non-Open proposals cannot be voted
// Vote it again
let env = mock_env(VOTER5, &[]);
let res = handle(&mut deps, env, yes_vote);
Copy link
Contributor Author

@maurolacy maurolacy Sep 27, 2020

Choose a reason for hiding this comment

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

After adding this test, I was left wondering that maybe it's a good idea to allow voting on Passed proposals: https://github.com/CosmWasm/cosmwasm-plus/blob/f979892bb7d32339769ad83ccb289e92e5a2f300/contracts/cw3-fixed-multisig/src/contract.rs#L165

That way, we can get better statistics on the final result of a given proposal. That is, despite a proposal having passed, it can have a large number of No / Veto votes (some of which could have been cast after it passed). Or, conversely, a proposal can have a larger adoption than the one reflected by the results; which currently "freeze" after it passes.

@maurolacy maurolacy merged commit eeec69d into cw3-fixed-multisig Sep 27, 2020
@maurolacy maurolacy deleted the cw3-fixed-multisig-tests branch September 27, 2020 12:56
@ethanfrey
Copy link
Member

Thank you

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.

2 participants