Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging for batch header hash for batcher-node #545

Merged
merged 8 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, "err", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also log operator IDs here and below?

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,10 +281,13 @@ 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
}

if len(blobs) == 0 {
return nil, errors.New("ProcessBatch: number of blobs must be greater than zero")
return nil, errors.New("number of blobs must be greater than zero")
}

if len(blobs) != len(rawBlobs) {
Expand All @@ -301,10 +304,7 @@ 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
}
log.Debug("Start processing a batch", "batchHeaderHash", batchHeaderHash, "batchSize (in bytes)", batchSize, "num of blobs", len(blobs), "referenceBlockNumber", header.ReferenceBlockNumber)

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