From ecce2ed2aa787555e18ac7dfa3409ae67cb54a94 Mon Sep 17 00:00:00 2001 From: gupadhyaya Date: Thu, 23 Jan 2025 11:06:36 +0400 Subject: [PATCH 1/5] remove error logging during fore-handling empty datahash case and handle height from the future error sliently --- block/manager.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/block/manager.go b/block/manager.go index 73325b3d73..42b877fb20 100644 --- a/block/manager.go +++ b/block/manager.go @@ -7,6 +7,7 @@ import ( "encoding/hex" "errors" "fmt" + "strings" "sync" "sync/atomic" "time" @@ -80,6 +81,8 @@ var dataHashForEmptyTxs = []byte{110, 52, 11, 156, 255, 179, 122, 152, 156, 165, // ErrNoBatch indicate no batch is available for creating block var ErrNoBatch = errors.New("no batch to process") +var ErrHeightFromFutureStr = "given height is from the future" + // NewHeaderEvent is used to pass header and DA height to headerInCh type NewHeaderEvent struct { Header *types.SignedHeader @@ -582,7 +585,7 @@ func (m *Manager) handleEmptyDataHash(ctx context.Context, header *types.Header) lastDataHash = lastData.Hash() } } - // if err then we cannot populate data, hence just skip and wait for Data to be synced + // if err no error then populate data, otherwise just skip and wait for Data to be synced if err == nil { metadata := &types.Metadata{ ChainID: header.ChainID(), @@ -594,8 +597,6 @@ func (m *Manager) handleEmptyDataHash(ctx context.Context, header *types.Header) Metadata: metadata, } m.dataCache.setData(headerHeight, d) - } else { - m.logger.Error("failed to get block data for", "height", headerHeight-1, "error", err) } } } @@ -892,10 +893,13 @@ func (m *Manager) RetrieveLoop(ctx context.Context) { daHeight := atomic.LoadUint64(&m.daHeight) err := m.processNextDAHeader(ctx) if err != nil && ctx.Err() == nil { - m.logger.Error("failed to retrieve block from DALC", "daHeight", daHeight, "errors", err.Error()) + // if the requested da height is not yet available, wait silently, otherwise log the error and wait + if !strings.Contains(err.Error(), ErrHeightFromFutureStr) { + m.logger.Error("failed to retrieve block from DALC", "daHeight", daHeight, "errors", err.Error()) + } continue } - // Signal the blockFoundCh to try and retrieve the next block + // Signal the headerFoundCh to try and retrieve the next block select { case headerFoundCh <- struct{}{}: default: From 99527d35053d17e35cd20263ef098c0a00eeda18 Mon Sep 17 00:00:00 2001 From: gupadhyaya Date: Thu, 23 Jan 2025 11:13:22 +0400 Subject: [PATCH 2/5] fix lint --- block/manager.go | 1 + 1 file changed, 1 insertion(+) diff --git a/block/manager.go b/block/manager.go index 42b877fb20..5709041423 100644 --- a/block/manager.go +++ b/block/manager.go @@ -81,6 +81,7 @@ var dataHashForEmptyTxs = []byte{110, 52, 11, 156, 255, 179, 122, 152, 156, 165, // ErrNoBatch indicate no batch is available for creating block var ErrNoBatch = errors.New("no batch to process") +// ErrHeightFromFutureStr is the error message for height from future returned by da var ErrHeightFromFutureStr = "given height is from the future" // NewHeaderEvent is used to pass header and DA height to headerInCh From 16420d95f44104450a176af370fce14242339296 Mon Sep 17 00:00:00 2001 From: gupadhyaya Date: Thu, 23 Jan 2025 11:32:51 +0400 Subject: [PATCH 3/5] goreleaser fix --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9f571d9bd3..41ef66b299 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -33,7 +33,7 @@ builds: - -X "{{ .Env.VersioningPath }}.Version={{ .Version }}" dist: ./build/goreleaser archives: - - format: tar.gz + - formats: [ 'tar.gz' ] # this name template makes the OS and Arch compatible with the results of # uname. name_template: >- From d2d1c0e9d5e90874aed268fc6d8a1ec277761283 Mon Sep 17 00:00:00 2001 From: gupadhyaya Date: Thu, 23 Jan 2025 11:36:23 +0400 Subject: [PATCH 4/5] minor --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 41ef66b299..40b5612f16 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -33,7 +33,7 @@ builds: - -X "{{ .Env.VersioningPath }}.Version={{ .Version }}" dist: ./build/goreleaser archives: - - formats: [ 'tar.gz' ] + - formats: ['tar.gz'] # this name template makes the OS and Arch compatible with the results of # uname. name_template: >- From b5de2d3514e15c2d6f0b93573a2a2dbf5425bbbd Mon Sep 17 00:00:00 2001 From: gupadhyaya Date: Thu, 23 Jan 2025 14:12:44 +0400 Subject: [PATCH 5/5] fix --- block/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/manager.go b/block/manager.go index 5709041423..d435c42633 100644 --- a/block/manager.go +++ b/block/manager.go @@ -586,7 +586,7 @@ func (m *Manager) handleEmptyDataHash(ctx context.Context, header *types.Header) lastDataHash = lastData.Hash() } } - // if err no error then populate data, otherwise just skip and wait for Data to be synced + // if no error then populate data, otherwise just skip and wait for Data to be synced if err == nil { metadata := &types.Metadata{ ChainID: header.ChainID(),