-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2414: Merge Signer-indices to master r=zhangchiqing a=zhangchiqing This PR merges signer indices to master. ## What does signer indices do? Each block header contains a list of signer's identifier in `Header.ParentVoteIDs` field to indicate who have signed (voted) for this block. For instance, for a group of 8 nodes: `[A,B,C,D,E,F,G,H]`, if a block is signed by 6 of them, `[A,C,D,E,G,H]`, then `Header.ParentVoteIDs` could be: ``` Header.ParentVoteIDs = [ "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", "0xDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD", "0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", "0xGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG", "0xHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", ] ``` Although it's straightforward, the problem is it could take lots of space. On mainnet, ParentVoteIDs field takes about half size of a block head. How to optimize? The idea is that instead of indicating who signed by "name" (their identifier), we indicate by "position" (their index). Since the full group identities is known, and there is a canonical order for the full identities, we can simply indicate by saying the block is signed by the "first" node, and the "third" node, and ... Therefore, in our example, we could use 8 bits `[1,0,1,1,1,0,1]` to indicate a block is signed by `A,C,D,E,G,H`. Each bit indicates whether a node at that index in the canonical order signed the block. We call these bits - "signer indices".[ It replaced the `Header.ParentVoteIDs` field](https://github.com/onflow/flow-go/pull/2414/files#diff-399868065526597108c7691678684ed898cf1a394918fd73f18c67324e374897L67-R65), which is `32 bytes * 6` big, with `Header.ParentVoterIndices` field, which is only `1 byte` big. Co-authored-by: Leo Zhang <zhangchiqing@gmail.com> Co-authored-by: Leo Zhang (zhangchiqing) <zhangchiqing@gmail.com>
- Loading branch information
Showing
139 changed files
with
2,730 additions
and
1,299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.