Skip to content

Commit

Permalink
fix grpc server to handle nil
Browse files Browse the repository at this point in the history
  • Loading branch information
gupadhyaya committed Aug 19, 2024
1 parent b64ac32 commit aac2d1f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions proxy/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,28 @@ func (s *proxyInputSrv) SubmitRollupTransaction(ctx context.Context, req *pbseq.

// GetNextBatch returns the next batch of transactions from sequencer to rollup.
func (s *proxyOutputSrv) GetNextBatch(ctx context.Context, req *pbseq.Batch) (*pbseq.Batch, error) {
lastBatch := &sequencing.Batch{}
lastBatch.FromProto(req)
var lastBatch *sequencing.Batch
if req != nil {
lastBatch = &sequencing.Batch{}
lastBatch.FromProto(req)
}
batch, err := s.SequencerOutput.GetNextBatch(ctx, lastBatch)
if err != nil {
return nil, err
}
if batch == nil {
return nil, nil
}
return batch.ToProto(), nil
}

// VerifyBatch verifies a batch of transactions received from the sequencer.
func (s *proxyVerificationSrv) VerifyBatch(ctx context.Context, req *pbseq.Batch) (*pbseq.VerificationResponse, error) {
batch := &sequencing.Batch{}
batch.FromProto(req)
var batch *sequencing.Batch
if req != nil {
batch = &sequencing.Batch{}
batch.FromProto(req)
}
ok, err := s.BatchVerifier.VerifyBatch(ctx, batch)
if err != nil {
return nil, err
Expand Down

0 comments on commit aac2d1f

Please sign in to comment.