-
Notifications
You must be signed in to change notification settings - Fork 375
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
Anyone should be able to activate an account's vote #7517
Anyone should be able to activate an account's vote #7517
Conversation
Function accepts group and account parameter to activate pending votes of any account.
Extract common functionality from activate to _activate method.
…/6467-activate-account
@nambrot The tests are failing due to ElectionTestInstance interface don't have the new property that was added as part of this change. Any idea where this interface is defined? It looks like this is defined in some other repo. |
Hmm that is a good question. It's based upon https://github.com/celo-org/celo-monorepo/blob/master/packages/protocol/contracts/governance/test/ElectionTest.sol#L9:L9 which should inherit the method and therefore should have it during type generation |
Is it passing locally for you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'm a big fan of this functionality, it will be a great UX improvement for staking services.
}) | ||
}) | ||
|
||
describe('when another voter activates votes', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm all for more tests but I feel this logic is already tested by the #activate.when another voter activates votes
test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already tested by activate for negative scenarios. In this case it positive test cases for activateByAccount method.
Thank you @nambrot for pointing me to the file how the types are generated and I had made typo while calling the method from test. |
What command are you using to run the test? For the initializable error, consider checking out #7254, you just have to make Election inherit from the new |
…/6467-activate-account
Remove the ValidateGroupVoteActivated event test.
@nambrot I tried running tests using |
@m-chrzan I think ElectionTestContract needs some update. I am not sure if InitializableV2 is creating issues during build. https://github.com/celo-org/celo-monorepo/blob/master/packages/protocol/test/governance/voting/lockedgold.ts#L33 please let me know if I am missing something here. Thank you. |
Huh, so this appears to be a slight bug in the test that hadn't been caught before. To fix this particular error message, it should be enough to change that line to
(since we're I imagine you might then start running into issues with the ElectionTest contract itself, since it inherits from Election (which now inherits from InitializableV2), so also needs to call its parent constructor. Since ElectionTest will always be used in testing, just doing
should be enough. |
Change the type of Election contract in test to ElectionContract.
Thank you @m-chrzan for sharing more details around this issue with solution. |
@nambrot One required 'certora-test' is failing. Is it related to this PR? |
@deepakhb2 This is unrelated and there was a fix merged to master today. I have updated your branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 nit
…/6467-activate-account
@deepakhb2 Looks like there is a linting error? |
@nambrot for election.ts file the prettier check is getting passed on my local machine. I am not sure if this is with election.ts file. |
Patch for the lint fix Generated from |
@yorhodes @deepakhb2 Can one of y'all apply the patch, and if it passes then I can merge |
@nambrot I have applied the patch and lint-checks is passed. |
…/6467-activate-account
…lo-monorepo into issue/6467-activate-account
Description
Currently an accounts pending votes can be activated by the same account. This change will allow to activate any other accounts pending vote. But, the account should belong to group i.e is passed. A new method is added to implement this change and non of the existing methods are modified.
Other change
Upgraded Election contract to inherit InitializableV2.
Tested
Added unit tests to cover this change.
Related issues
Backwards compatibility
As this change is made by added a new method and it doesn't affect the existing features.