Skip to content

Commit

Permalink
Add verification on PUT
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyknox committed Jun 6, 2024
1 parent 9492066 commit 2014332
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion store/eigenda.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (e EigenDAStore) Get(ctx context.Context, key []byte, domain common.DomainT
if err != nil {
return nil, fmt.Errorf("EigenDA client failed to retrieve decoded blob: %w", err)
}
// reencode blob because that's what the caller wants
// reencode blob for verification
encodedBlob, err := e.client.GetCodec().EncodeBlob(decodedBlob)
if err != nil {
return nil, fmt.Errorf("EigenDA client failed to reencode blob: %w", err)
Expand Down Expand Up @@ -72,6 +72,15 @@ func (e EigenDAStore) Put(ctx context.Context, value []byte) (comm []byte, err e
return nil, err
}

encodedBlob, err := e.client.GetCodec().EncodeBlob(value)
if err != nil {
return nil, fmt.Errorf("EigenDA client failed to reencode blob: %w", err)
}
err = e.verifier.Verify(cert.BlobHeader.Commitment, encodedBlob)
if err != nil {
return nil, err
}

bytes, err := rlp.EncodeToBytes(cert)
if err != nil {
return nil, fmt.Errorf("failed to encode DA cert to RLP format: %w", err)
Expand Down

0 comments on commit 2014332

Please sign in to comment.