@@ -13,9 +13,10 @@ import (
1313 "github.com/evstack/ev-node/block/internal/cache"
1414 "github.com/evstack/ev-node/block/internal/common"
1515 "github.com/evstack/ev-node/block/internal/da"
16- coreda "github.com/evstack/ev-node/core/da "
16+ "github.com/evstack/ev-node/pkg/blob "
1717 "github.com/evstack/ev-node/pkg/config"
1818 pkgda "github.com/evstack/ev-node/pkg/da"
19+ datypes "github.com/evstack/ev-node/pkg/da/types"
1920 "github.com/evstack/ev-node/pkg/genesis"
2021 "github.com/evstack/ev-node/pkg/rpc/server"
2122 "github.com/evstack/ev-node/pkg/signer"
@@ -119,7 +120,21 @@ func NewDASubmitter(
119120
120121 if config .RPC .EnableDAVisualization {
121122 visualizerLogger := logger .With ().Str ("component" , "da_visualization" ).Logger ()
122- server .SetDAVisualizationServer (server .NewDAVisualizationServer (client .GetDA (), visualizerLogger , config .Node .Aggregator ))
123+ server .SetDAVisualizationServer (
124+ server .NewDAVisualizationServer (
125+ func (ctx context.Context , id []byte , ns []byte ) ([]datypes.Blob , error ) {
126+ // minimal fetch: derive height from ID and use namespace provided
127+ height , _ := blob .SplitID (id )
128+ res := client .Retrieve (ctx , height , ns )
129+ if res .Code != datypes .StatusSuccess || len (res .Data ) == 0 {
130+ return nil , fmt .Errorf ("blob not found" )
131+ }
132+ return res .Data , nil
133+ },
134+ visualizerLogger ,
135+ config .Node .Aggregator ,
136+ ),
137+ )
123138 }
124139
125140 // Use NoOp metrics if nil to avoid nil checks throughout the code
@@ -184,7 +199,7 @@ func (s *DASubmitter) SubmitHeaders(ctx context.Context, cache cache.Manager) er
184199 }
185200 return proto .Marshal (headerPb )
186201 },
187- func (submitted []* types.SignedHeader , res * coreda .ResultSubmit ) {
202+ func (submitted []* types.SignedHeader , res * datypes .ResultSubmit ) {
188203 for _ , header := range submitted {
189204 cache .SetHeaderDAIncluded (header .Hash ().String (), res .Height , header .Height ())
190205 }
@@ -227,7 +242,7 @@ func (s *DASubmitter) SubmitData(ctx context.Context, cache cache.Manager, signe
227242 func (signedData * types.SignedData ) ([]byte , error ) {
228243 return signedData .MarshalBinary ()
229244 },
230- func (submitted []* types.SignedData , res * coreda .ResultSubmit ) {
245+ func (submitted []* types.SignedData , res * datypes .ResultSubmit ) {
231246 for _ , sd := range submitted {
232247 cache .SetDataDAIncluded (sd .Data .DACommitment ().String (), res .Height , sd .Height ())
233248 }
@@ -343,7 +358,7 @@ func submitToDA[T any](
343358 ctx context.Context ,
344359 items []T ,
345360 marshalFn func (T ) ([]byte , error ),
346- postSubmit func ([]T , * coreda .ResultSubmit ),
361+ postSubmit func ([]T , * datypes .ResultSubmit ),
347362 itemType string ,
348363 namespace []byte ,
349364 options []byte ,
@@ -406,7 +421,7 @@ func submitToDA[T any](
406421
407422 // Perform submission
408423 start := time .Now ()
409- res := s .client .Submit (submitCtx , marshaled , - 1 , namespace , mergedOptions )
424+ res := s .client .Submit (submitCtx , marshaled , namespace , mergedOptions )
410425 s .logger .Debug ().Int ("attempts" , rs .Attempt ).Dur ("elapsed" , time .Since (start )).Uint64 ("code" , uint64 (res .Code )).Msg ("got SubmitWithHelpers response from celestia" )
411426
412427 // Record submission result for observability
@@ -415,7 +430,7 @@ func submitToDA[T any](
415430 }
416431
417432 switch res .Code {
418- case coreda .StatusSuccess :
433+ case datypes .StatusSuccess :
419434 submitted := items [:res .SubmittedCount ]
420435 postSubmit (submitted , & res )
421436 s .logger .Info ().Str ("itemType" , itemType ).Uint64 ("count" , res .SubmittedCount ).Msg ("successfully submitted items to DA layer" )
@@ -436,7 +451,7 @@ func submitToDA[T any](
436451 s .metrics .DASubmitterPendingBlobs .Set (float64 (getTotalPendingFn ()))
437452 }
438453
439- case coreda .StatusTooBig :
454+ case datypes .StatusTooBig :
440455 // Record failure metric
441456 s .recordFailure (common .DASubmitterFailureReasonTooBig )
442457 // Iteratively halve until it fits or single-item too big
@@ -460,19 +475,19 @@ func submitToDA[T any](
460475 s .metrics .DASubmitterPendingBlobs .Set (float64 (getTotalPendingFn ()))
461476 }
462477
463- case coreda .StatusNotIncludedInBlock :
478+ case datypes .StatusNotIncludedInBlock :
464479 // Record failure metric
465480 s .recordFailure (common .DASubmitterFailureReasonNotIncludedInBlock )
466481 s .logger .Info ().Dur ("backoff" , pol .MaxBackoff ).Msg ("retrying due to mempool state" )
467482 rs .Next (reasonMempool , pol )
468483
469- case coreda .StatusAlreadyInMempool :
484+ case datypes .StatusAlreadyInMempool :
470485 // Record failure metric
471486 s .recordFailure (common .DASubmitterFailureReasonAlreadyInMempool )
472487 s .logger .Info ().Dur ("backoff" , pol .MaxBackoff ).Msg ("retrying due to mempool state" )
473488 rs .Next (reasonMempool , pol )
474489
475- case coreda .StatusContextCanceled :
490+ case datypes .StatusContextCanceled :
476491 // Record failure metric
477492 s .recordFailure (common .DASubmitterFailureReasonContextCanceled )
478493 s .logger .Info ().Msg ("DA layer submission canceled due to context cancellation" )
0 commit comments