Skip to content

Commit 715491f

Browse files
authored
Store transaction pos in batch poster (#219)
* Move submit transaction pos from tx_streamer to batch poster
1 parent ef2c5cc commit 715491f

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

arbnode/batch_poster.go

+11
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,17 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error)
13151315
)
13161316
break
13171317
}
1318+
1319+
// If the message is an Espresso message, store the pos in the database to be used later
1320+
// to submit the message to hotshot for finalization.
1321+
if arbos.IsEspressoMsg(msg.Message) {
1322+
err = b.streamer.SubmitEspressoTransactionPos(b.building.msgCount, b.streamer.db.NewBatch())
1323+
if err != nil {
1324+
log.Error("failed to submit espresso transaction pos", "pos", b.building.msgCount, "err", err)
1325+
break
1326+
}
1327+
}
1328+
13181329
err = b.addEspressoBlockMerkleProof(ctx, msg)
13191330
if err != nil {
13201331
return false, fmt.Errorf("error adding hotshot block merkle proof to justification: %w", err)

arbnode/transaction_streamer.go

+1-16
Original file line numberDiff line numberDiff line change
@@ -1023,16 +1023,6 @@ func (s *TransactionStreamer) WriteMessageFromSequencer(
10231023
}
10241024

10251025
s.broadcastMessages([]arbostypes.MessageWithMetadataAndBlockHash{msgWithBlockHash}, pos)
1026-
s.espressoTxnsStateInsertionMutex.Lock()
1027-
defer s.espressoTxnsStateInsertionMutex.Unlock()
1028-
1029-
if arbos.IsEspressoMsg(msgWithMeta.Message) {
1030-
err = s.SubmitEspressoTransactionPos(pos, s.db.NewBatch())
1031-
if err != nil {
1032-
return err
1033-
}
1034-
}
1035-
10361026
return nil
10371027
}
10381028

@@ -1454,12 +1444,7 @@ func (s *TransactionStreamer) submitEspressoTransactions(ctx context.Context, ig
14541444
return s.config().EspressoTxnsPollingInterval
14551445
}
14561446

1457-
espressoTx := espressoTypes.Transaction{
1458-
Payload: bytes[0],
1459-
Namespace: s.config().EspressoNamespace,
1460-
}
1461-
1462-
log.Info("submitting transaction to espresso using sovereign sequencer", "tx", espressoTx)
1447+
log.Info("submitting transaction to espresso using sovereign sequencer")
14631448

14641449
hash, err := s.espressoClient.SubmitTransaction(ctx, espressoTypes.Transaction{
14651450
Payload: bytes[0],

0 commit comments

Comments
 (0)