Skip to content

Commit

Permalink
upgrade to latest go-sequencing
Browse files Browse the repository at this point in the history
  • Loading branch information
gupadhyaya committed Aug 19, 2024
1 parent 5a22bcf commit 4256c7f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/gogo/protobuf v1.3.2
github.com/ipfs/go-log/v2 v2.5.1
github.com/rollkit/go-da v0.5.0
github.com/rollkit/go-sequencing v0.0.0-20240808122718-9591858f7fc3
github.com/rollkit/go-sequencing v0.0.0-20240819074615-f2daab53104d
github.com/rollkit/rollkit v0.13.6
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rollkit/go-da v0.5.0 h1:sQpZricNS+2TLx3HMjNWhtRfqtvVC/U4pWHpfUz3eN4=
github.com/rollkit/go-da v0.5.0/go.mod h1:VsUeAoPvKl4Y8wWguu/VibscYiFFePkkrvZWyTjZHww=
github.com/rollkit/go-sequencing v0.0.0-20240808122718-9591858f7fc3 h1:f25w4HVAfqM5EDFZ8esHg15m4qwqEt/6RlgIqZz10mo=
github.com/rollkit/go-sequencing v0.0.0-20240808122718-9591858f7fc3/go.mod h1:J6E6NR7tNJ0cKBxtVHnby0hQ+S7RTayuDfG1Llwv800=
github.com/rollkit/go-sequencing v0.0.0-20240819074615-f2daab53104d h1:jf1mG3Jl8jqZS8JH3jezPDVdikUBQKuDpsRhvuaRqZM=
github.com/rollkit/go-sequencing v0.0.0-20240819074615-f2daab53104d/go.mod h1:J6E6NR7tNJ0cKBxtVHnby0hQ+S7RTayuDfG1Llwv800=
github.com/rollkit/rollkit v0.13.6 h1:ZdIBG5D5RuQvnnJSY8s3m46dR3A3F6jHN+01zX+Avt0=
github.com/rollkit/rollkit v0.13.6/go.mod h1:clM4aPsWDJk/IN/SqCBsA+ab0/8gdh+5O4hRkLWKB7s=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
Expand Down
11 changes: 6 additions & 5 deletions sequencing/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (bq *BatchQueue) AddBatch(batch sequencing.Batch) {
// Next ...
func (bq *BatchQueue) Next() *sequencing.Batch {
if len(bq.queue) == 0 {
return nil
return &sequencing.Batch{Transactions: nil}
}
batch := bq.queue[0]
bq.queue = bq.queue[1:]
Expand Down Expand Up @@ -141,6 +141,7 @@ func NewSequencer(daAddress, daAuthToken, daNamespace string, batchTime time.Dur
maxDABlobSize: maxBlobSize,
tq: NewTransactionQueue(),
bq: NewBatchQueue(),
seenBatches: make(map[string]struct{}),
}
go s.batchSubmissionLoop(s.ctx)
return s, nil
Expand Down Expand Up @@ -291,10 +292,10 @@ func (c *Sequencer) SubmitRollupTransaction(ctx context.Context, rollupId []byte
// GetNextBatch implements sequencing.Sequencer.
func (c *Sequencer) GetNextBatch(ctx context.Context, lastBatch *sequencing.Batch) (*sequencing.Batch, error) {
if c.lastBatchHash == nil {
if lastBatch != nil {
if lastBatch.Transactions != nil {
return nil, errors.New("lastBatch is supposed to be nil")
}
} else if lastBatch == nil {
} else if lastBatch.Transactions == nil {
return nil, errors.New("lastBatch is not supposed to be nil")
} else {
lastBatchBytes, err := lastBatch.Marshal()
Expand All @@ -307,8 +308,8 @@ func (c *Sequencer) GetNextBatch(ctx context.Context, lastBatch *sequencing.Batc
}

batch := c.bq.Next()
if batch == nil {
return nil, nil
if batch.Transactions == nil {
return batch, nil
}

batchBytes, err := batch.Marshal()
Expand Down

0 comments on commit 4256c7f

Please sign in to comment.