-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Sassafras Consensus #4600
Sassafras Consensus #4600
Conversation
One of the easiest things to do would be to implement a polite-gossip protocol, where the packet structure is We probably need to make sending to 2 different parties slashable to prevent DoS, though. That, or ensure that we never hold more than one message by the same signer for the same epoch in memory. As long as we don't require agreement on the VRFProof sent by a specific validator. |
I added a simple encryption module for schnorrkel keys in https://github.com/w3f/schnorrkel/blob/master/src/aead.rs and we can do similar with other keys. I have not attempted to be as compatible as possible with stuff other people do, but aead crate should help there, and provide in-place encryption modes. |
I proposed that H(omega || "WHO") mod num_validators should be the publishing validator in https://github.com/w3f/research/blob/master/docs/papers/sass/sass-2-announce.tex#L52 I included the max_winners per block producer that you suggested in https://github.com/w3f/research/blob/master/docs/papers/sass/sass-2-announce.tex#L57 but also max_repeats limits the number each repeater puts into the mempool in https://github.com/w3f/research/blob/master/docs/papers/sass/sass-2-announce.tex#L60 |
Refactored to a separate crate
We noticed some games in which validators reuse keys @sorpaas so we should probably use the same key for both VRFs. I'll make further comments in the write up eventually and need to check the code more carefully. We can chat about it if you want of course. |
As #5788 impact how BABE generates future epoch's randomness, we might consider optimizing our technique for computing the future epoch's randomness too. At present, we concatenate all substrate/frame/babe/src/lib.rs Line 577 in 48b1240
substrate/frame/babe/src/lib.rs Line 509 in 48b1240
If so, you could track some pre_next_randomness that block authors attack add to their block header and iterate like pre_next_randomness = H(pre_next_randomness ++ vrf_io.make_bytes()). We maybe rejected that because it increases the block header size, but not sure anymore. I've made this comment here because we might reject doing that change in BABE just for simplicity but consider this more fully here. Anyway the question is: How expensive is iterating over old block headers? How expensive is an extra 32 bytes in a block header? |
closing because of inactivity. |
We'll adopt this eventually but it just got stuck behind higher priority parachains work. We should update this to #7053 too whenever it gets done. |
This is a draft implementation of HABE/BADASS/SASSY/SASSAFRAS consensus. Validation logic is mostly there but I've yet written proposing logic and runtime helpers. Eventually, the VRF used also need to switch from schnorrkel to ring-vrf. Not quite ready for review as there're millions of TODOs, but please feel free to take a look and leave grumbles.
Overview
This describes the schnorrkel Sassafras as it is currently written. Note that it will switch to ring-vrf and thus some of the specs will change.
Two VRFs are generated at each block. Ticket VRF, which is used for proof of block production rights, and Post-block VRF, which is used for randomness collection. For ticket VRFs, three epochs are tracked:
VRFProof
to another pseudo-random validator, who is expected to broadcast it for inclusion in a block.Three digests are included in the header:
PreDigest
: The pre-runtime digest, which contains the proof of ticket VRF and post-block VRF, generated by consensus.PostBlockDescriptor
: Tracks ticket VRF commitments to be included in current block, generated by runtime.NextEpochDescriptor
: Describes the next epoch, same as in BABE. Note that the enacted validators only start to validate 2 epochs later.Verifier and Block Import Logic
Pre-runtime digest verification:
Post-block digest verification:
Next-epoch descriptor digest verification:
TODOs