Skip to content

Commit

Permalink
improve error clarity inside some celestia client helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt committed Apr 30, 2024
1 parent 6feaea6 commit d3d4a73
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions da/celestia/celestia.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"fmt"
"time"

"github.com/dymensionxyz/dymint/gerr"

"github.com/avast/retry-go/v4"
"github.com/celestiaorg/nmt"
"github.com/gogo/protobuf/proto"
Expand Down Expand Up @@ -536,11 +538,11 @@ func (c *DataAvailabilityLayerClient) checkBatchAvailability(daMetaData *da.DASu
func (c *DataAvailabilityLayerClient) submit(daBlob da.Blob) (uint64, da.Commitment, error) {
blobs, commitments, err := c.blobsAndCommitments(daBlob)
if err != nil {
return 0, nil, err
return 0, nil, fmt.Errorf("blobs and commitments: %w", err)
}

if len(commitments) == 0 {
return 0, nil, errors.New("no commitments found")
return 0, nil, fmt.Errorf("zero commitments: %w", gerr.ErrNotFound)
}

options := openrpc.DefaultSubmitOptions()
Expand All @@ -560,7 +562,7 @@ func (c *DataAvailabilityLayerClient) submit(daBlob da.Blob) (uint64, da.Commitm

height, err := c.rpc.Submit(ctx, blobs, options)
if err != nil {
return 0, nil, err
return 0, nil, fmt.Errorf("rpc submit: %w", err)
}
c.logger.Info("Successfully submitted blobs to Celestia", "height", height, "gas", options.GasLimit, "fee", options.Fee)

Expand Down Expand Up @@ -591,7 +593,7 @@ func (c *DataAvailabilityLayerClient) blobsAndCommitments(daBlob da.Blob) ([]*bl

commitment, err := blob.CreateCommitment(b)
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("create commitment: %w", err)
}

commitments = append(commitments, commitment)
Expand Down

0 comments on commit d3d4a73

Please sign in to comment.