Skip to content

Commit

Permalink
docs: add missing documentation for BlobKey and BlobHeader.BlobKey()
Browse files Browse the repository at this point in the history
  • Loading branch information
samlaf committed Jan 21, 2025
1 parent c2d7417 commit b52788a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/v2/serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ type abiBlobCommitments struct {
DataLength uint32
}

// BlobKey serializes the BlobHeader into a 32-byte unique identifier.
// This serialization must ALWAYS match the serialization that we perform onchain:
// https://github.com/Layr-Labs/eigenda/blob/a6dd724acdf732af483fd2d9a86325febe7ebdcd/contracts/src/libraries/EigenDAHasher.sol#L119
func (b *BlobHeader) BlobKey() (BlobKey, error) {
versionType, err := abi.NewType("uint16", "", nil)
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions core/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ func (c *Assignment) GetIndices() []uint32 {
return indices
}

// BlobKey is the unique identifier for a blob dispersal.
//
// It is computed as the Keccak256 hash of some serialization of the blob header
// where the PaymentHeader has been replaced with Hash(PaymentHeader), in order
// to be easily verifiable onchain. See the BlobKey method of BlobHeader for more
// details.
//
// It can be used to retrieve a blob from relays.
//
// Note that two blobs can have the same content but different headers,
// so they are allowed to both exist in the system.
type BlobKey [32]byte

func (b BlobKey) Hex() string {
Expand Down

0 comments on commit b52788a

Please sign in to comment.