diff --git a/go/enclave/rpc_server.go b/go/enclave/rpc_server.go index 78faf593bf..691cb314d5 100644 --- a/go/enclave/rpc_server.go +++ b/go/enclave/rpc_server.go @@ -311,12 +311,16 @@ func (s *RPCServer) GetBatch(_ context.Context, request *generated.GetBatchReque } encodedBatch, encodingErr := batch.Encoded() - return &generated.GetBatchResponse{ - Batch: encodedBatch, - SystemError: &generated.SystemError{ + var sysErr *generated.SystemError + if encodingErr != nil { + sysErr = &generated.SystemError{ ErrorCode: 2, ErrorString: encodingErr.Error(), - }, + } + } + return &generated.GetBatchResponse{ + Batch: encodedBatch, + SystemError: sysErr, }, err } @@ -329,12 +333,16 @@ func (s *RPCServer) GetBatchBySeqNo(_ context.Context, request *generated.GetBat } encodedBatch, encodingErr := batch.Encoded() - return &generated.GetBatchResponse{ - Batch: encodedBatch, - SystemError: &generated.SystemError{ + var sysErr *generated.SystemError + if encodingErr != nil { + sysErr = &generated.SystemError{ ErrorCode: 2, ErrorString: encodingErr.Error(), - }, + } + } + return &generated.GetBatchResponse{ + Batch: encodedBatch, + SystemError: sysErr, }, err } diff --git a/go/host/enclave/guardian.go b/go/host/enclave/guardian.go index dd00d6adc2..023d786ec6 100644 --- a/go/host/enclave/guardian.go +++ b/go/host/enclave/guardian.go @@ -547,7 +547,7 @@ func (g *Guardian) periodicRollupProduction() { // estimate the size of a compressed rollup availBatchesSumSize, err := g.calculateNonRolledupBatchesSize(fromBatch) if err != nil { - g.logger.Error("Unable to estimate the size of the current rollup", log.ErrKey, err) + g.logger.Error("Unable to estimate the size of the current rollup", log.ErrKey, err, "from_batch", fromBatch) // todo - this should not happen. Is it worth continuing? availBatchesSumSize = 0 }