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

Whisk: fix boostraping induced missed slots - zero proof #3481

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

dapplion
Copy link
Collaborator

Whisk on its current spec will induce ~2% missed slot rate on the initial epochs after the fork, and over 12,000 cumulative missed slots during the first year post-fork. I've written this longer form doc that explains the cause of the issue, its likely-hood, and the patch to solve it.

https://hackmd.io/@dapplion/whisk_induced_missed_slots

photo_2023-08-17_20-33-35

assert IsValidWhiskOpeningProof(tracker, k_commitment, block.body.whisk_opening_proof)
if block.body.whisk_opening_proof == WhiskTrackerProof():
# no proof signals tracker is created with insecure initial 'k'
assert tracker.k_r_G == tracker.r_G * get_initial_whisk_k(block.proposer_index, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be get_initial_whisk_k() or get_unique_whisk_k()? What happens if that validator had to increase her counter in get_unique_whisk_k()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point, I think both get_initial_whisk_k(0) and get_unique_whisk_k may not return the correct k. get_unique_whisk_k returns a k that unique among the set of commitments when the validator was onboarded. Now the set of commitments is different. So it may return a different k. An option is for the validator to submit k suffixed to the zero proof

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pushed a fix to allow the proposer to specify the nonce, while still ensuring proof of possession. This whole bootstrapping business is ugly

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I'm not used to "nonce" and "proof of possession" being used in the context of Whisk. Can you describe a bit more what the latest changes aim to do? I also see you are digging into the guts of whisk_opening_proof which is an opaque type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nonce in this context refers to the second argument of the get_initial_whisk_k function. The output of get_unique_whisk_k is dependent of which specific state it is run on. So we can't just call `get_unique_whisk_k(state) with this block state since it can produce a different result than when the validator was on-boarded into the protocol. I've added an illustrative example here https://hackmd.io/@dapplion/expensive_duty_discovery#Appendix-get_unique_whisk_k-non-determinism

So the proposer must tell protocol participants the specific nonce to use on get_unique_whisk_k(). A hacky way to add this data without extra block body fields is to insert it into the zero-ed proof field.

  • If non-zero: check proof
  • If zero (section): read nonce from it

From the POV of the protocol the proof is still an opaque type, a string of bytes to pass to the crypto black box, which if partially zero-ed conveys meaning.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've added the nonce as another property of the block I think it much clearer this way, @asn-d6 bab555a

@dapplion dapplion changed the title Fix Whisk boostraping induced missed slots Whisk: fix boostraping induced missed slots Aug 19, 2023
@dapplion dapplion changed the title Whisk: fix boostraping induced missed slots Whisk: fix boostraping induced missed slots - zero proof Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants