Skip to content

Commit

Permalink
chore add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
vgonkivs committed Oct 13, 2023
1 parent 5a0c20f commit b0ce766
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package blob
import (
"bytes"
"encoding/json"
"errors"
"fmt"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
Expand Down Expand Up @@ -144,12 +145,11 @@ func (b *Blob) UnmarshalJSON(data []byte) error {
// It will build blobs either until appShares will be empty or the first incomplete blob will appear, so in this
// specific case it will return all built blobs + remaining shares.
func buildBlobsIfExist(appShares []shares.Share) ([]*Blob, []shares.Share, error) {
if len(appShares) == 0 {
return nil, nil, errors.New("empty shares received")
}
blobs := make([]*Blob, 0, len(appShares))
for {
if len(appShares) == 0 {
return blobs, nil, nil
}

length, err := appShares[0].SequenceLen()
if err != nil {
return nil, nil, err
Expand Down
9 changes: 8 additions & 1 deletion blob/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,14 @@ func (s *Service) getByCommitment(
}
proofs = nil
}
return nil, nil, ErrBlobNotFound

err = ErrBlobNotFound
if len(rawShares) > 0 {
reportErr := fmt.Errorf("THIS IS A BUG: INCOMPLETE BLOB DETECTED at: %d height", height)
err = errors.Join(err, reportErr)
log.Error(err)
}
return nil, nil, err
}

// getBlobs retrieves the DAH and fetches all shares from the requested Namespace and converts
Expand Down

0 comments on commit b0ce766

Please sign in to comment.