Skip to content

Store transaction pos in batch poster #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
@@ -1315,6 +1315,17 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error)
)
break
}

// If the message is an Espresso message, store the pos in the database to be used later
// to submit the message to hotshot for finalization.
if arbos.IsEspressoMsg(msg.Message) {
err = b.streamer.SubmitEspressoTransactionPos(b.building.msgCount, b.streamer.db.NewBatch())
if err != nil {
log.Error("failed to submit espresso transaction pos", "pos", b.building.msgCount, "err", err)
break
}
}

err = b.addEspressoBlockMerkleProof(ctx, msg)
if err != nil {
return false, fmt.Errorf("error adding hotshot block merkle proof to justification: %w", err)
17 changes: 1 addition & 16 deletions arbnode/transaction_streamer.go
Original file line number Diff line number Diff line change
@@ -1023,16 +1023,6 @@ func (s *TransactionStreamer) WriteMessageFromSequencer(
}

s.broadcastMessages([]arbostypes.MessageWithMetadataAndBlockHash{msgWithBlockHash}, pos)
s.espressoTxnsStateInsertionMutex.Lock()
defer s.espressoTxnsStateInsertionMutex.Unlock()

if arbos.IsEspressoMsg(msgWithMeta.Message) {
err = s.SubmitEspressoTransactionPos(pos, s.db.NewBatch())
if err != nil {
return err
}
}

return nil
}

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

espressoTx := espressoTypes.Transaction{
Payload: bytes[0],
Namespace: s.config().EspressoNamespace,
}

log.Info("submitting transaction to espresso using sovereign sequencer", "tx", espressoTx)
log.Info("submitting transaction to espresso using sovereign sequencer")

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