@@ -100,6 +100,12 @@ type Executor struct {
100100 blockProducer BlockProducer
101101}
102102
103+ // batchAcknowledger is implemented by sequencers whose drained queue
104+ // entries must be acknowledged after the block is durably committed.
105+ type batchAcknowledger interface {
106+ AckBatch (ctx context.Context ) error
107+ }
108+
103109// NewExecutor creates a new block executor.
104110// The executor is responsible for:
105111// - Block production from sequencer batches
@@ -162,6 +168,17 @@ func NewExecutor(
162168 logger : logger .With ().Str ("component" , "executor" ).Logger (),
163169 }
164170 e .blockProducer = e
171+
172+ // wire the batch ack so drained queue entries are committed after block
173+ // commit. tracing wrappers forward AckBatch to the underlying sequencer.
174+ if acker , ok := sequencer .(batchAcknowledger ); ok {
175+ e .onBatchCommitted = acker .AckBatch
176+ } else if ! config .Node .BasedSequencer {
177+ // without an ack, drained queue entries are rolled back on every
178+ // retrieval and the same transactions would be re-included each block
179+ e .logger .Warn ().Msg ("sequencer does not implement AckBatch; drained batch entries will not be acknowledged after block commit" )
180+ }
181+
165182 return e , nil
166183}
167184
@@ -171,12 +188,6 @@ func (e *Executor) SetBlockProducer(bp BlockProducer) {
171188 e .blockProducer = bp
172189}
173190
174- // SetOnBatchCommitted registers a callback fired after each block commit.
175- // If the callback fails, it is retried before the next block is produced.
176- func (e * Executor ) SetOnBatchCommitted (fn func (ctx context.Context ) error ) {
177- e .onBatchCommitted = fn
178- }
179-
180191// ackCommittedBatch invokes the batch ack callback and tracks failures so
181192// they can be retried before the next block is produced.
182193func (e * Executor ) ackCommittedBatch (ctx context.Context ) error {
0 commit comments