Skip to content

Commit 1f92a17

Browse files
authored
fix: remove error logging during fore-handling empty datahash case and handle height from the future silently (#1952)
Fixes evstack/docs#517 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling for block retrieval from Data Availability Layer. - Enhanced error logging with more precise error type detection. - **Documentation** - Updated code comments to clarify error handling logic. - Added a new constant for future height error messaging. - **Chores** - Updated archive format declaration in configuration for improved structure. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 82321d6 commit 1f92a17

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ builds:
3333
- -X "{{ .Env.VersioningPath }}.Version={{ .Version }}"
3434
dist: ./build/goreleaser
3535
archives:
36-
- format: tar.gz
36+
- formats: ['tar.gz']
3737
# this name template makes the OS and Arch compatible with the results of
3838
# uname.
3939
name_template: >-

block/manager.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/hex"
88
"errors"
99
"fmt"
10+
"strings"
1011
"sync"
1112
"sync/atomic"
1213
"time"
@@ -80,6 +81,9 @@ var dataHashForEmptyTxs = []byte{110, 52, 11, 156, 255, 179, 122, 152, 156, 165,
8081
// ErrNoBatch indicate no batch is available for creating block
8182
var ErrNoBatch = errors.New("no batch to process")
8283

84+
// ErrHeightFromFutureStr is the error message for height from future returned by da
85+
var ErrHeightFromFutureStr = "given height is from the future"
86+
8387
// NewHeaderEvent is used to pass header and DA height to headerInCh
8488
type NewHeaderEvent struct {
8589
Header *types.SignedHeader
@@ -582,7 +586,7 @@ func (m *Manager) handleEmptyDataHash(ctx context.Context, header *types.Header)
582586
lastDataHash = lastData.Hash()
583587
}
584588
}
585-
// if err then we cannot populate data, hence just skip and wait for Data to be synced
589+
// if no error then populate data, otherwise just skip and wait for Data to be synced
586590
if err == nil {
587591
metadata := &types.Metadata{
588592
ChainID: header.ChainID(),
@@ -594,8 +598,6 @@ func (m *Manager) handleEmptyDataHash(ctx context.Context, header *types.Header)
594598
Metadata: metadata,
595599
}
596600
m.dataCache.setData(headerHeight, d)
597-
} else {
598-
m.logger.Error("failed to get block data for", "height", headerHeight-1, "error", err)
599601
}
600602
}
601603
}
@@ -892,10 +894,13 @@ func (m *Manager) RetrieveLoop(ctx context.Context) {
892894
daHeight := atomic.LoadUint64(&m.daHeight)
893895
err := m.processNextDAHeader(ctx)
894896
if err != nil && ctx.Err() == nil {
895-
m.logger.Error("failed to retrieve block from DALC", "daHeight", daHeight, "errors", err.Error())
897+
// if the requested da height is not yet available, wait silently, otherwise log the error and wait
898+
if !strings.Contains(err.Error(), ErrHeightFromFutureStr) {
899+
m.logger.Error("failed to retrieve block from DALC", "daHeight", daHeight, "errors", err.Error())
900+
}
896901
continue
897902
}
898-
// Signal the blockFoundCh to try and retrieve the next block
903+
// Signal the headerFoundCh to try and retrieve the next block
899904
select {
900905
case headerFoundCh <- struct{}{}:
901906
default:

0 commit comments

Comments
 (0)