Skip to content

Commit 3ea677d

Browse files
committed
bump
1 parent 8320422 commit 3ea677d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pkg/da/app/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ func (c *Client) Retrieve(ctx context.Context, height uint64, namespace []byte)
155155
// Fetch block from celestia-app
156156
blockResult, err := c.getBlock(ctx, height)
157157
if err != nil {
158-
// Handle specific errors
158+
// Handle specific errors returned by the CometBFT RPC
159+
// If the node is requesting a block that is in the future, we return StatusHeightFromFuture
159160
if strings.Contains(err.Error(), "height") && strings.Contains(err.Error(), "future") {
160161
return datypes.ResultRetrieve{
161162
BaseResult: datypes.BaseResult{
@@ -166,6 +167,9 @@ func (c *Client) Retrieve(ctx context.Context, height uint64, namespace []byte)
166167
},
167168
}
168169
}
170+
171+
// Handle pruned blocks from CometBFT. The underlying error contains:
172+
// "height X is not available, lowest height is Y"
169173
if strings.Contains(err.Error(), "is not available, lowest height is") {
170174
c.logger.Debug().Uint64("height", height).Err(err).Msg("block is pruned or unavailable")
171175
return datypes.ResultRetrieve{

pkg/da/app/client_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,14 +495,22 @@ func TestRPCCall(t *testing.T) {
495495
}
496496

497497
func TestRPCTypes(t *testing.T) {
498-
t.Run("rpcError Error() method", func(t *testing.T) {
498+
t.Run("rpcError Error() method with data", func(t *testing.T) {
499499
err := &rpcError{
500500
Code: -32600,
501501
Message: "Invalid Request",
502502
Data: "extra data",
503503
}
504504
assert.Equal(t, "RPC error -32600: Invalid Request: extra data", err.Error())
505505
})
506+
507+
t.Run("rpcError Error() method without data", func(t *testing.T) {
508+
err := &rpcError{
509+
Code: -32603,
510+
Message: "Internal error",
511+
}
512+
assert.Equal(t, "RPC error -32603: Internal error", err.Error())
513+
})
506514
}
507515

508516
func TestClient_InterfaceCompliance(t *testing.T) {

0 commit comments

Comments
 (0)