Try   HackMD

Accompany Notes Updating Sync Pkg to 3531

Pre-req: https://github.com/ethereum/consensus-specs#3531
PR: https://github.com/prysmaticlabs/prysm/compare/update-sync

Key Design Decisions and Open Questions

First-Class Citizenship of ROBlob

  • Transitioned from using the protobuf format ethpb.BlobSidecar to ROBlob.
  • Benefits: Efficiently handles hash tree root headers. Enables caching of verification results.
    Open Question: Are there any downsides or limitations to making ROBlob a first-class citizen?

Direct Alignment Check Using ROBlob and ROBlock

  • Utilizes blob.Root()==block.Root() for direct alignment checks.
    Benefits: Simplifies the verification process.

Database Dependency in Sync Package

Sync package depends on the DB package, which in turn affects other packages.
Current State: Commented out DB-related code to prepare for the next PR. Which is ok, the feature is not ready for the 'develop' branch until all aspects are completed.
Open Question: What is the most efficient way to manage these cross-package dependencies while updating the sync package?

P2P Layer

  • Replace usage of BlobSidecar with SignedBlobSidecar in BlobSubnetTopicFormat.
  • Update BroadcastBlob to broadcast SignedBlobSidecar.
    • The existing proposer code will be modified to fulfill this; a TODO has been added for tracking.

Gossip Layer

  • Receive BlobSidecar over the network, instead of SignedBlobSidecar.
  • Upon receipt, immediately convert SignedBlobSidecar to ROBlob to optimize header hash tree root calculations.
  • Apply REJECT label if conversion to ROBlob fails, as this indicates an incorrect blob sidecar format. REJECT makes more sense than IGNORE
  • Implement a direct getter for RoBlock.Slot(), ParentRoot(), ProposerIndex() to simplify calls.
  • Update hasSeenBlobIndex to take slot, proposer_index, and index as parameters, in line with spec updates.
    • Accept only the first valid sidecar for the tuple (block_header.slot, block_header.proposer_index, blob_sidecar.index).

RPC Layer

  • SendBlobSidecarByRoot and SendBlobsByRangeRequest will now return blobs in the new format.
  • Update readChunkEncodedBlobs and fetchBlobsFromPeer to use ROBlob.
  • Modify verifyAndPopulateBlobs to work with ROBlob.
  • Ensure WriteBlobSidecarChunk writes the updated blob sidecar format.

Blob vs. Block Alignment check

  • Update BlobAlignsWithBlock function to use hash tree roots for comparison, thereby reducing verification steps like slot, and proposer index. Hash tree root of block and header should be the same. (Yay)
    • Design note: 1.) We need to inclusde blob and kzg commitments are valid. 2.) We also need to ensure the inclusion proofs are valid

Database Handling

  • WARNING: I've commented out existing DB methods and add TODOs to update them for the new blob sidecar format. I'm not entirely sure if we want to do everything in one PR. Happy to do that though.

Initial Sync

  • Revise BlockWithVerifiedBlobs to use ROBlob, thereby ensuring alignment between blocks and blobs. This is a very neat change imo.

Chain Service

  • ReceiveBlob functionality will be updated once the DB methods like SaveBlobSidecar are revised.