Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

change approval voting counting procedure#1972

Merged
12 commits merged intomasterfrom
rh-approval-counting
Nov 28, 2020
Merged

change approval voting counting procedure#1972
12 commits merged intomasterfrom
rh-approval-counting

Conversation

@rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Nov 18, 2020

cc @burdges

Supersedes #1930

Change description:

  • Take one new non-empty tranche per no-show, as opposed to the minimal number of tranches which cover the no-show
  • If the required number of checkers (assigned + no-shows) equals or surpasses the total number of validators, we require a simple supermajority to approve.
  • We no longer broadcast our assignment if we already perceive the candidate as having been approved by others.

@rphmeier rphmeier added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Nov 18, 2020
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
@burdges
Copy link
Contributor

burdges commented Nov 23, 2020

We could fix the no-show handling in two different ways: Your new "Take one new non-empty tranche per no-show" vs my old one "Take one new tranche per no-show or the minimal number of tranches which cover the no-show, which ever is more."

I think either provides similar security, but I guess your new text yields simpler code. :)

@burdges
Copy link
Contributor

burdges commented Nov 23, 2020

There is a time shifting effect that I implemented and discussed in #1930 that does not appear here. Arguably it's implicit but not really I think.

@rphmeier
Copy link
Contributor Author

rphmeier commented Nov 25, 2020

@burdges wasn't the outcome of our calls that we didn't need to do the time-shifting thing? I'm not totally clear on how that detail works and what time-shifting we're meant to apply. Could you make a PR referring to how we're meant to do it in abstract English, and add that to protocol-approval.md? Then I'd say that the time-shifting is implicit in "count no-shows" because the exact mechanics of that are defined within the guide.

@burdges
Copy link
Contributor

burdges commented Nov 26, 2020

We've count no shows from when we received the assignment, which avoids misscount other's late assignments as no show. We do however require some mechanism that prevents us sending announcements too early when a no show happens. If a no show takes 1.5 relay chain blocks, so 36 tranches, then we should avoid everyone from tranche 1-35 announcing when one person from tranche zero no shows. It's straightforward to set a stoping condition in the assignment counter loop to achieve this I think.

@rphmeier
Copy link
Contributor Author

If a no show takes 1.5 relay chain blocks, so 36 tranches, then we should avoid everyone from tranche 1-35 announcing when one person from tranche zero no shows. It's straightforward to set a stoping condition in the assignment counter loop to achieve this I think.

Yeah, I'll add something like this today which should prevent everyone from broadcasting at once.

Copy link
Contributor

@burdges burdges left a comment

Choose a reason for hiding this comment

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

It's fine.

* Count no-shows in tranches `k..l` and for each of those, take another non-empty tranche for each no-show. Repeat so on until either
* We run out of tranches to take, having not received any assignments past a certain point. In this case we set `n_tranches` to a special value `RequiredTranches::Pending(last_taken_tranche + uncovered_no_shows)` which indicates that new assignments are needed. `uncovered_no_shows` is the number of no-shows we have not yet covered with `last_taken_tranche`.
* All no-shows are covered by at least one non-empty tranche. Set `n_tranches` to the number of tranches taken and return `RequiredTranches::Exact(n_tranches)`.
* The amount of assignments in non-empty & taken tranches plus the amount of needed extras equals or exceeds the total number of validators for the approval entry, which can be obtained by measuring the bitfield. In this case we return a special value `RequiredTranches::All` indicating that all validators have effectively been assigned to check.
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think using the bitfield is reasonable in the short term. We'll want something smaller eventually, but asked discussed previously exactly what can be discussed later. In the short term, All could trigger a dispute style 2/3 check, or it could simply trash the candidate and fork the chain, but if we become happy with some lower threshold then maybe trashing the candidate actually becomes more efficient. We'd slash eventually either way.

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 bring up the bitfield here just because it's the easiest way to get n_validators with the data we have available in this scope. A usize would be smaller, but since the ~1000 bits are already referenced by the ApprovalEntry, it's harmless to count the length here.

@burdges
Copy link
Contributor

burdges commented Nov 28, 2020

I prefer this version over my own suggestions in #1930

We've many tranche zero assignments so we'll have multipe tranche zero no-shows occasionally. We delay slightly for broadcasting the second obligatory tranche in my version, while we broadcast both tranches immediately in this version.

It's also exploits this notion of non-empty tranche to simplify the counting logic

@rphmeier
Copy link
Contributor Author

bot merge

@ghost
Copy link

ghost commented Nov 28, 2020

Waiting for commit status.

@ghost ghost merged commit d6e8115 into master Nov 28, 2020
@ghost ghost deleted the rh-approval-counting branch November 28, 2020 18:35
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants