Skip to content

Commit

Permalink
Add logging for batch header hash for batcher-node
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix committed May 6, 2024
1 parent 8ec570b commit 1f29c70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions disperser/batcher/grpc/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (c *dispatcher) sendAllChunks(ctx context.Context, state *core.IndexedOpera
return
}

batchHeaderHash, err := batchHeader.GetBatchHeaderHash()
if err != nil {
return
}
requestedAt := time.Now()
sig, err := c.sendChunks(ctx, blobMessages, batchHeader, &op)
if err != nil {
Expand All @@ -79,13 +83,15 @@ func (c *dispatcher) sendAllChunks(ctx context.Context, state *core.IndexedOpera
Signature: nil,
Operator: id,
}
c.logger.Warn("Failed to send chunks to operator", "batchHeaderHash", batchHeaderHash, "operator", op.Socket)
c.metrics.ObserveLatency(false, float64(time.Since(requestedAt).Milliseconds()))
} else {
update <- core.SignerMessage{
Signature: sig,
Operator: id,
Err: nil,
}
c.logger.Debug("Successfully sent chunks to operator", "batchHeaderHash", batchHeaderHash, "operator", op.Socket)
c.metrics.ObserveLatency(true, float64(time.Since(requestedAt).Milliseconds()))
}

Expand Down
12 changes: 6 additions & 6 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,12 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs
start := time.Now()
log := n.Logger

log.Debug("Processing batch", "num of blobs", len(blobs))
batchHeaderHash, err := header.GetBatchHeaderHash()
if err != nil {
return nil, err
}

log.Debug("Processing batch", "num of blobs", len(blobs), "batchHeaderHash", batchHeaderHash)

if len(blobs) == 0 {
return nil, errors.New("ProcessBatch: number of blobs must be greater than zero")
Expand All @@ -301,11 +306,6 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs
}
n.Metrics.AcceptBatches("received", batchSize)

batchHeaderHash, err := header.GetBatchHeaderHash()
if err != nil {
return nil, err
}

// Store the batch.
// Run this in a goroutine so we can parallelize the batch storing and batch
// verifaction work.
Expand Down

0 comments on commit 1f29c70

Please sign in to comment.