@@ -63,7 +63,7 @@ const (
6363
6464var (
6565 // dataHashForEmptyTxs to be used while only syncing headers from DA and no p2p to get the Data for no txs scenarios, the syncing can proceed without getting stuck forever.
66- dataHashForEmptyTxs = []byte {110 , 52 , 11 , 156 , 255 , 179 , 122 , 152 , 156 , 165 , 68 , 230 , 187 , 120 , 10 , 44 , 120 , 144 , 29 , 63 , 179 , 55 , 56 , 118 , 133 , 17 , 163 , 6 , 23 , 175 , 160 , 29 }
66+ DataHashForEmptyTxs = []byte {110 , 52 , 11 , 156 , 255 , 179 , 122 , 152 , 156 , 165 , 68 , 230 , 187 , 120 , 10 , 44 , 120 , 144 , 29 , 63 , 179 , 55 , 56 , 118 , 133 , 17 , 163 , 6 , 23 , 175 , 160 , 29 }
6767
6868 // initialBackoff defines initial value for block submission backoff
6969 initialBackoff = 100 * time .Millisecond
@@ -158,6 +158,9 @@ type Manager struct {
158158
159159 // txNotifyCh is used to signal when new transactions are available
160160 txNotifyCh chan struct {}
161+
162+ // batchSubmissionChan is used to submit batches to the sequencer
163+ batchSubmissionChan chan coresequencer.Batch
161164}
162165
163166// getInitialState tries to load lastState from Store, and if it's not available it reads genesis.
@@ -339,37 +342,38 @@ func NewManager(
339342 dalc : dalc ,
340343 daHeight : & daH ,
341344 // channels are buffered to avoid blocking on input/output operations, buffer sizes are arbitrary
342- HeaderCh : make (chan * types.SignedHeader , channelLength ),
343- DataCh : make (chan * types.Data , channelLength ),
344- headerInCh : make (chan NewHeaderEvent , eventInChLength ),
345- dataInCh : make (chan NewDataEvent , eventInChLength ),
346- headerStoreCh : make (chan struct {}, 1 ),
347- dataStoreCh : make (chan struct {}, 1 ),
348- headerStore : headerStore ,
349- dataStore : dataStore ,
350- lastStateMtx : new (sync.RWMutex ),
351- lastBatchData : lastBatchData ,
352- headerCache : cache .NewCache [types.SignedHeader ](),
353- dataCache : cache .NewCache [types.Data ](),
354- retrieveCh : make (chan struct {}, 1 ),
355- daIncluderCh : make (chan struct {}, 1 ),
356- logger : logger ,
357- txsAvailable : false ,
358- pendingHeaders : pendingHeaders ,
359- metrics : seqMetrics ,
360- sequencer : sequencer ,
361- exec : exec ,
362- gasPrice : gasPrice ,
363- gasMultiplier : gasMultiplier ,
364- txNotifyCh : make (chan struct {}, 1 ), // Non-blocking channel
345+ HeaderCh : make (chan * types.SignedHeader , channelLength ),
346+ DataCh : make (chan * types.Data , channelLength ),
347+ headerInCh : make (chan NewHeaderEvent , eventInChLength ),
348+ dataInCh : make (chan NewDataEvent , eventInChLength ),
349+ headerStoreCh : make (chan struct {}, 1 ),
350+ dataStoreCh : make (chan struct {}, 1 ),
351+ headerStore : headerStore ,
352+ dataStore : dataStore ,
353+ lastStateMtx : new (sync.RWMutex ),
354+ lastBatchData : lastBatchData ,
355+ headerCache : cache .NewCache [types.SignedHeader ](),
356+ dataCache : cache .NewCache [types.Data ](),
357+ retrieveCh : make (chan struct {}, 1 ),
358+ daIncluderCh : make (chan struct {}, 1 ),
359+ logger : logger ,
360+ txsAvailable : false ,
361+ pendingHeaders : pendingHeaders ,
362+ metrics : seqMetrics ,
363+ sequencer : sequencer ,
364+ exec : exec ,
365+ gasPrice : gasPrice ,
366+ gasMultiplier : gasMultiplier ,
367+ txNotifyCh : make (chan struct {}, 1 ), // Non-blocking channel
368+ batchSubmissionChan : make (chan coresequencer.Batch , eventInChLength ),
365369 }
366370 agg .init (ctx )
367371 // Set the default publishBlock implementation
368372 agg .publishBlock = agg .publishBlockInternal
369-
370- // Set the manager pointer in the sequencer if it is a *single.Sequencer
371- if s , ok := sequencer .( interface { SetManager ( * Manager ) }); ok {
372- s .SetManager (agg )
373+ if s , ok := agg . sequencer .( interface {
374+ SetBatchSubmissionChan ( chan coresequencer. Batch )
375+ }); ok {
376+ s .SetBatchSubmissionChan (agg . batchSubmissionChan )
373377 }
374378
375379 return agg , nil
@@ -478,7 +482,7 @@ func (m *Manager) retrieveBatch(ctx context.Context) (*BatchData, error) {
478482 if len (res .Batch .Transactions ) == 0 {
479483 errRetrieveBatch = ErrNoBatch
480484 }
481- // Even if there are no transactions, update lastBatchData so we don’ t
485+ // Even if there are no transactions, update lastBatchData so we don' t
482486 // repeatedly emit the same empty batch, and persist it to metadata.
483487 if err := m .store .SetMetadata (ctx , LastBatchDataKey , convertBatchDataToBytes (res .BatchData )); err != nil {
484488 m .logger .Error ("error while setting last batch hash" , "error" , err )
@@ -780,7 +784,7 @@ func (m *Manager) execCreateBlock(_ context.Context, height uint64, lastSignatur
780784 Time : uint64 (batchData .UnixNano ()), //nolint:gosec // why is time unix? (tac0turtle)
781785 },
782786 LastHeaderHash : lastHeaderHash ,
783- DataHash : dataHashForEmptyTxs , // Use batchDataIDs when available
787+ DataHash : DataHashForEmptyTxs , // Use batchDataIDs when available
784788 ConsensusHash : make (types.Hash , 32 ),
785789 AppHash : m .lastState .AppHash ,
786790 ProposerAddress : m .genesis .ProposerAddress ,
@@ -923,6 +927,11 @@ func (m *Manager) NotifyNewTransactions() {
923927 }
924928}
925929
930+ // HeaderCache returns the headerCache used by the manager.
931+ func (m * Manager ) HeaderCache () * cache.Cache [types.SignedHeader ] {
932+ return m .headerCache
933+ }
934+
926935// DataCache returns the dataCache used by the manager.
927936func (m * Manager ) DataCache () * cache.Cache [types.Data ] {
928937 return m .dataCache
0 commit comments