Skip to content

Commit

Permalink
Lint (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJeremyHe authored Jan 22, 2025
1 parent e1d5300 commit 015239a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ func (s *batchSegments) AddMessage(msg *arbostypes.MessageWithMetadata) (bool, e

if s.isWaitingForEspressoValidation {
log.Info("Current batch is waiting for espresso validation, we won't add more messages")
//if we are waiting for espresso validation return that the batch is full with no error
// if we are waiting for espresso validation return that the batch is full with no error
return false, nil
}
if s.isDone {
Expand Down
1 change: 0 additions & 1 deletion arbnode/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var (
espressoSubmittedTxns []byte = []byte("_espressoSubmittedTxns") // contains the hash and pos of the submitted transactions
espressoPendingTxnsPositions []byte = []byte("_espressoPendingTxnsPos") // contains the index of the pending txns that need to be submitted to espresso
espressoLastConfirmedPos []byte = []byte("_espressoLastConfirmedPos") // contains the position of the last confirmed message
lastPotentialMsgInBatch []byte = []byte("_lastPotentialMsgInBatch") // contains the last potential message
)

const currentDbSchemaVersion uint64 = 1
25 changes: 15 additions & 10 deletions arbnode/transaction_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
lightclient "github.com/EspressoSystems/espresso-sequencer-go/light-client"
tagged_base64 "github.com/EspressoSystems/espresso-sequencer-go/tagged-base64"
espressoTypes "github.com/EspressoSystems/espresso-sequencer-go/types"
"github.com/ccoveille/go-safecast"
flag "github.com/spf13/pflag"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -1103,13 +1104,17 @@ func (s *TransactionStreamer) writeMessages(pos arbutil.MessageIndex, messages [
// Only submit the transaction if escape hatch is not enabled
if s.shouldSubmitEspressoTransaction() {
for i := range messages {
log.Info("Enqueuing pending transaction to Espresso", "pos", pos+arbutil.MessageIndex(i))
err := s.enqueuePendingTransaction(pos + arbutil.MessageIndex(i))
idx, err := safecast.ToUint64(i)
if err != nil {
log.Error("Failed to enqueue pending transaction to Espresso", "pos", pos+arbutil.MessageIndex(i), "err", err)
return err
}
log.Info("Enqueued pending transaction to Espresso was successful", "pos", pos+arbutil.MessageIndex(i))
log.Info("Enqueuing pending transaction to Espresso", "pos", pos+arbutil.MessageIndex(idx))
err = s.enqueuePendingTransaction(pos + arbutil.MessageIndex(idx))
if err != nil {
log.Error("Failed to enqueue pending transaction to Espresso", "pos", pos+arbutil.MessageIndex(idx), "err", err)
return err
}
log.Info("Enqueued pending transaction to Espresso was successful", "pos", pos+arbutil.MessageIndex(idx))
}
}
}
Expand Down Expand Up @@ -1566,7 +1571,7 @@ func (s *TransactionStreamer) submitEspressoTransactions(ctx context.Context) er

payload, err = signHotShotPayload(payload, s.getAttestationQuote)
if err != nil {
return fmt.Errorf("failed to sign the hotshot payload %v", err)
return fmt.Errorf("failed to sign the hotshot payload %w", err)
}

log.Info("submitting transaction to hotshot for finalization")
Expand All @@ -1578,7 +1583,7 @@ func (s *TransactionStreamer) submitEspressoTransactions(ctx context.Context) er
})

if err != nil {
return fmt.Errorf("failed to submit transaction to espresso: %v", err)
return fmt.Errorf("failed to submit transaction to espresso: %w", err)
}

s.espressoTxnsStateInsertionMutex.Lock()
Expand All @@ -1589,7 +1594,7 @@ func (s *TransactionStreamer) submitEspressoTransactions(ctx context.Context) er

submittedTxns, err := s.getEspressoSubmittedTxns()
if err != nil {
return fmt.Errorf("failed to get the submitted txns: %v", err)
return fmt.Errorf("failed to get the submitted txns: %w", err)
}
tx := SubmittedEspressoTx{
Hash: hash.String(),
Expand All @@ -1603,18 +1608,18 @@ func (s *TransactionStreamer) submitEspressoTransactions(ctx context.Context) er
}

if err = s.setEspressoSubmittedTxns(batch, submittedTxns); err != nil {
return fmt.Errorf("failed to set espresso submitted txns: %v", err)
return fmt.Errorf("failed to set espresso submitted txns: %w", err)
}

pendingTxnsPos = pendingTxnsPos[msgCnt:]
err = s.setEspressoPendingTxnsPos(batch, pendingTxnsPos)
if err != nil {
return fmt.Errorf("failed to set the pending txn: %v", err)
return fmt.Errorf("failed to set the pending txn: %w", err)
}

err = batch.Write()
if err != nil {
return fmt.Errorf("failed to write to db: %v", err)
return fmt.Errorf("failed to write to db: %w", err)
}
}
return nil
Expand Down

0 comments on commit 015239a

Please sign in to comment.