@@ -16,8 +16,14 @@ import (
1616// ErrForceInclusionNotConfigured is returned when the forced inclusion namespace is not configured.
1717var ErrForceInclusionNotConfigured = errors .New ("forced inclusion namespace not configured" )
1818
19- // ForcedInclusionRetriever handles retrieval of forced inclusion transactions from DA.
20- type ForcedInclusionRetriever struct {
19+ // ForcedInclusionRetriever defines the interface for retrieving forced inclusion transactions from DA.
20+ type ForcedInclusionRetriever interface {
21+ RetrieveForcedIncludedTxs (ctx context.Context , daHeight uint64 ) (* ForcedInclusionEvent , error )
22+ Stop ()
23+ }
24+
25+ // forcedInclusionRetriever handles retrieval of forced inclusion transactions from DA.
26+ type forcedInclusionRetriever struct {
2127 client Client
2228 logger zerolog.Logger
2329 daEpochSize uint64
@@ -40,7 +46,7 @@ func NewForcedInclusionRetriever(
4046 logger zerolog.Logger ,
4147 cfg config.Config ,
4248 daStartHeight , daEpochSize uint64 ,
43- ) * ForcedInclusionRetriever {
49+ ) ForcedInclusionRetriever {
4450 retrieverLogger := logger .With ().Str ("component" , "forced_inclusion_retriever" ).Logger ()
4551
4652 // Create async block retriever for background prefetching
@@ -54,24 +60,28 @@ func NewForcedInclusionRetriever(
5460 )
5561 asyncFetcher .Start ()
5662
57- return & ForcedInclusionRetriever {
63+ base := & forcedInclusionRetriever {
5864 client : client ,
5965 logger : retrieverLogger ,
6066 daStartHeight : daStartHeight ,
6167 daEpochSize : daEpochSize ,
6268 asyncFetcher : asyncFetcher ,
6369 }
70+ if cfg .Instrumentation .IsTracingEnabled () {
71+ return withTracingForcedInclusionRetriever (base )
72+ }
73+ return base
6474}
6575
6676// Stop stops the background prefetcher.
67- func (r * ForcedInclusionRetriever ) Stop () {
77+ func (r * forcedInclusionRetriever ) Stop () {
6878 r .asyncFetcher .Stop ()
6979}
7080
7181// RetrieveForcedIncludedTxs retrieves forced inclusion transactions at the given DA height.
7282// It respects epoch boundaries and only fetches at epoch end.
7383// It tries to get blocks from the async fetcher cache first, then falls back to sync fetching.
74- func (r * ForcedInclusionRetriever ) RetrieveForcedIncludedTxs (ctx context.Context , daHeight uint64 ) (* ForcedInclusionEvent , error ) {
84+ func (r * forcedInclusionRetriever ) RetrieveForcedIncludedTxs (ctx context.Context , daHeight uint64 ) (* ForcedInclusionEvent , error ) {
7585 // when daStartHeight is not set or no namespace is configured, we retrieve nothing.
7686 if ! r .client .HasForcedInclusionNamespace () {
7787 return nil , ErrForceInclusionNotConfigured
0 commit comments