Skip to content

Commit

Permalink
Minor updates to error logs (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim authored Sep 5, 2024
1 parent a0191b8 commit 14ca646
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions disperser/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ func (s *DispersalServer) DisperseBlobAuthenticated(stream pb.Disperser_Disperse
if err != nil {
s.metrics.HandleInvalidArgRpcRequest("DisperseBlobAuthenticated")
s.metrics.HandleInvalidArgRequest("DisperseBlobAuthenticated")
return api.NewInvalidArgError(fmt.Sprintf("failed to decode public key (%v): %v", blob.RequestHeader.AccountID, err))
return api.NewInvalidArgError(fmt.Sprintf("failed to decode account ID (%v): %v", blob.RequestHeader.AccountID, err))
}

pubKey, err := crypto.UnmarshalPubkey(publicKeyBytes)
if err != nil {
s.metrics.HandleInvalidArgRpcRequest("DisperseBlobAuthenticated")
s.metrics.HandleInvalidArgRequest("DisperseBlobAuthenticated")
return api.NewInvalidArgError(fmt.Sprintf("failed to decode public key (%v): %v", blob.RequestHeader.AccountID, err))
return api.NewInvalidArgError(fmt.Sprintf("failed to decode public key (%v): %v", hexutil.Encode(publicKeyBytes), err))
}

authenticatedAddress := crypto.PubkeyToAddress(*pubKey).String()
Expand Down
5 changes: 3 additions & 2 deletions disperser/common/blobstore/blob_metadata_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
"github.com/ethereum/go-ethereum/common/hexutil"
)

const (
Expand Down Expand Up @@ -311,11 +312,11 @@ func (s *BlobMetadataStore) GetBlobMetadataInBatch(ctx context.Context, batchHea
}

if len(items) == 0 {
return nil, fmt.Errorf("%w: there is no metadata for batch %s and blob index %d", disperser.ErrMetadataNotFound, batchHeaderHash, blobIndex)
return nil, fmt.Errorf("%w: there is no metadata for batch %s and blob index %d", disperser.ErrMetadataNotFound, hexutil.Encode(batchHeaderHash[:]), blobIndex)
}

if len(items) > 1 {
s.logger.Error("there are multiple metadata for batch %s and blob index %d", batchHeaderHash, blobIndex)
s.logger.Error("there are multiple metadata for batch %s and blob index %d", hexutil.Encode(batchHeaderHash[:]), blobIndex)
}

metadata, err := UnmarshalBlobMetadata(items[0])
Expand Down

0 comments on commit 14ca646

Please sign in to comment.