@@ -20,10 +20,7 @@ import (
2020 pb "github.com/evstack/ev-node/types/pb/evnode/v1"
2121)
2222
23- const (
24- dAFetcherTimeout = 30 * time .Second
25- dAFetcherRetries = 10
26- )
23+ const dAFetcherTimeout = 10 * time .Second
2724
2825// DARetriever handles DA retrieval operations for syncing
2926type DARetriever struct {
@@ -70,42 +67,23 @@ func NewDARetriever(
7067// RetrieveFromDA retrieves blocks from the specified DA height and returns height events
7168func (r * DARetriever ) RetrieveFromDA (ctx context.Context , daHeight uint64 ) ([]common.DAHeightEvent , error ) {
7269 r .logger .Debug ().Uint64 ("da_height" , daHeight ).Msg ("retrieving from DA" )
73-
74- var err error
75- for retry := 0 ; retry < dAFetcherRetries ; retry ++ {
76- select {
77- case <- ctx .Done ():
78- return nil , ctx .Err ()
79- default :
80- }
81-
82- blobsResp , fetchErr := r .fetchBlobs (ctx , daHeight )
83- if fetchErr == nil {
84- if blobsResp .Code == coreda .StatusNotFound {
85- r .logger .Debug ().Uint64 ("da_height" , daHeight ).Msg ("no blob data found" )
86- return nil , coreda .ErrBlobNotFound
87- }
88-
89- r .logger .Debug ().Int ("blobs" , len (blobsResp .Data )).Uint64 ("da_height" , daHeight ).Msg ("retrieved blob data" )
90- events := r .processBlobs (ctx , blobsResp .Data , daHeight )
91- return events , nil
92- }
93-
94- if strings .Contains (fetchErr .Error (), coreda .ErrHeightFromFuture .Error ()) {
95- return nil , fmt .Errorf ("%w: height from future" , coreda .ErrHeightFromFuture )
70+ blobsResp , fetchErr := r .fetchBlobs (ctx , daHeight )
71+ if fetchErr == nil {
72+ if blobsResp .Code == coreda .StatusNotFound {
73+ r .logger .Debug ().Uint64 ("da_height" , daHeight ).Msg ("no blob data found" )
74+ return nil , coreda .ErrBlobNotFound
9675 }
9776
98- err = errors .Join (err , fetchErr )
77+ r .logger .Debug ().Int ("blobs" , len (blobsResp .Data )).Uint64 ("da_height" , daHeight ).Msg ("retrieved blob data" )
78+ events := r .processBlobs (ctx , blobsResp .Data , daHeight )
79+ return events , nil
80+ }
9981
100- // Delay before retrying
101- select {
102- case <- ctx .Done ():
103- return nil , err
104- case <- time .After (100 * time .Millisecond ):
105- }
82+ if strings .Contains (fetchErr .Error (), coreda .ErrHeightFromFuture .Error ()) {
83+ return nil , fmt .Errorf ("%w: height from future" , coreda .ErrHeightFromFuture )
10684 }
10785
108- return nil , err
86+ return nil , fetchErr
10987}
11088
11189// fetchBlobs retrieves blobs from the DA layer
0 commit comments