Skip to content

Commit

Permalink
Check blob key from disperser against actual key
Browse files Browse the repository at this point in the history
Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
  • Loading branch information
litt3 committed Jan 14, 2025
1 parent 2c7a414 commit e3302ce
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions api/clients/v2/disperser_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,23 @@ func (c *disperserClient) DisperseBlob(
return nil, [32]byte{}, err
}

actualBlobKey, err := blobHeader.BlobKey()
if err != nil {
// this shouldn't be possible, since the blob key has already been used when signing dispersal
return nil, [32]byte{}, fmt.Errorf("computing blob key: %w", err)
}

blobKeyFromDisperser, err := corev2.BytesToBlobKey(reply.GetBlobKey())
if err != nil {
return nil, [32]byte{}, fmt.Errorf("converting returned bytes to blob key: %w", err)
}

if actualBlobKey != blobKeyFromDisperser {
return nil, [32]byte{}, fmt.Errorf(
"blob key returned by disperser (%v) doesn't match blob which was dispersed (%v)",
blobKeyFromDisperser, actualBlobKey)
}

return &blobStatus, corev2.BlobKey(reply.GetBlobKey()), nil
}

Expand Down

0 comments on commit e3302ce

Please sign in to comment.