-
Notifications
You must be signed in to change notification settings - Fork 0
systemcontract: add transferVote method #182
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
Conversation
| receivedVotes[candidateTo] += amount; | ||
| votedTo[msg.sender] = candidateTo; | ||
| voterGasPerVote[msg.sender] = candidateGasPerVote[candidateTo]; | ||
| voteHeight[msg.sender] = block.number; |
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'd suggest not to change the height so that if voter changes the vote target, then it still receives the reward for the rest of the epoch. Exactly like if candidate performs the second vote for the same address.
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.
But it's a subject of discussion.
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.
There is a case that a voter first vote to candidate A whose shareRate is low (e.g. 1), then change to another candidate B whose shareRate is high (e.g. 1000) after epoch change. That could happen if A is not select as a CN, so the voter leaves because there is no reward. This seems reasonable.
But if the voter change back to A before the next epoch change. There will be a fact that the voter puts its effective votes to A, but shares rewards from B. Is that what the candidate B expects to see?
I suggest that we delay this change till the future, e.g. when we reduce the epoch length.
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.
Agree, your second example is reasonable, we probably need to think about this case a bit more.
I suggest that we delay this change till the future
Could you create an issue for that?
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.
Ref. #222.
rebase master
AnnaShaleva
left a comment
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.
With additional issue (#182 (comment)) this PR LGTM.
Luckily, governanceABI does not include method offsets and compatibility between the current Testnet is preserved. But we need to schedule system contracts updates on Testnet after v0.1.2 is released.
|
@chenquanyu, @roman-khimov, @nicolegys, ready for review and testing. |
Need to squash the commits into logical blocks.
|
@txhsl, please, squash the commits into a single one. |
* index some event parameters * update solidity compiler version * systemcontract: governance unit tests (#210) * update gitignore * init hardhat project * first ut * systemcontract: add candidate management ut and getter check (#211) * systemcontract: use customized error library (#209) * systemcontract: use customized error library * update existing ut * systemcontract: add policy unit tests (#214) * systemcontract: add ut about reward distribution and fix several ut (#215) * systemcontract: optimize gas cost (#195) * systemcontract: optimize gas cost --------- Co-authored-by: belane <[email protected]>
|
@txhsl, please, don't merge the unstructured changes into master. We'll end up in a git history mess in a few months. |
Close #165. Need update before merge.