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

adds a new shred variant embedding merkle tree hashes of the erasure batch #25237

Merged
merged 1 commit into from
Jun 7, 2022

Commits on Jun 7, 2022

  1. adds a new shred variant embedding merkle tree hashes of the erasure …

    …batch
    
    Coding shreds can only be signed once erasure codings are already
    generated. Therefore coding shreds recovered from erasure codings lack
    slot leader's signature and so cannot be retransmitted to the rest of
    the cluster.
    
    shred/merkle.rs implements a new shred variant where we generate merkle
    tree for each erasure encoded batch and each shred includes:
    * root of the merkle tree (which is 32-byte Hash).
    * slot leader's signature of the root of the merkle tree.
    * merkle tree nodes along the branch the shred belongs to, where hashes
      are trimmed to 20 bytes during tree construction.
    
    This schema results in the same signature for all shreds within an
    erasure batch.
    
    When recovering shreds from erasure codes, we can reconstruct merkle
    tree for the batch and for each recovered shred also recover respective
    merkle tree branch; then snap the slot leader's signature from any of
    the shreds received from turbine and retransmit all recovered code or
    data shreds.
    
    Backward compatibility is achieved by encoding shred variant at byte 65
    of payload (previously shred-type at this position):
    * 0b0101_1010 indicates a legacy coding shred, which is also equal to
      ShredType::Code for backward compatibility.
    * 0b1010_0101 indicates a legacy data shred, which is also equal to
      ShredType::Data for backward compatibility.
    * 0b0100_???? indicates a merkle coding shred with merkle branch size
      indicated by the last 4 bits.
    * 0b1000_???? indicates a merkle data shred with merkle branch size
      indicated by the last 4 bits.
    
    Merkle root and branch are encoded at the end of the shred payload.
    behzadnouri committed Jun 7, 2022
    Configuration menu
    Copy the full SHA
    751bb10 View commit details
    Browse the repository at this point in the history