Skip to content

[Cirrus] Don't vote on old polls#709

Closed
quantumagi wants to merge 5 commits intostratisproject:release/1.1.0.0from
quantumagi:limitvoting
Closed

[Cirrus] Don't vote on old polls#709
quantumagi wants to merge 5 commits intostratisproject:release/1.1.0.0from
quantumagi:limitvoting

Conversation

@quantumagi
Copy link
Contributor

@quantumagi quantumagi commented Sep 15, 2021

@quantumagi
Copy link
Contributor Author

quantumagi commented Sep 15, 2021

The only "drawback" is that if a vote for given voting data does not complete within 10,000 blocks it can no longer be repeated/continued later on. This situation will remain in effect until we add the poll expiry mechanism.

/// <remarks>All access should be protected by <see cref="locker"/>.</remarks>
private void CleanFinishedPollsLocked()
{
bool TooOldToVoteOn(Poll poll)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you maybe add a comment here to say why we are including these?

// the action (removes the hash) and then reapplies it again. To allow for this scenario we have to exclude
// executed polls here.
List<Poll> finishedPolls = this.polls.Where(x => !x.IsPending && !x.IsExecuted).ToList();
List<Poll> finishedPolls = this.polls.Where(x => TooOldToVoteOn(x) || (!x.IsPending && !x.IsExecuted)).ToList();
Copy link
Contributor

@fassadlr fassadlr Sep 15, 2021

Choose a reason for hiding this comment

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

Can we add a info log here

To say why the vote is being excluded?

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 suggest we make it a debug log because I think it's going to pop up more than expected until such time as expiry is implemented.

Copy link
Contributor

@fassadlr fassadlr left a comment

Choose a reason for hiding this comment

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

@quantumagi please hold off on merging whilst I'm testing on CirrusTest.

@quantumagi quantumagi marked this pull request as draft September 16, 2021 07:24
@quantumagi
Copy link
Contributor Author

This is included in PR #707.

@quantumagi quantumagi closed this Sep 20, 2021
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