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

Misc node log fixes #515

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions node/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func (s *Server) StoreChunks(ctx context.Context, in *pb.StoreChunksRequest) (*p
s.node.Logger.Error("StoreChunks failed", "err", err)
} else {
s.node.Metrics.RecordRPCRequest("StoreChunks", "success")
s.node.Logger.Info("StoreChunks succeeded")
}

return reply, err
Expand Down
11 changes: 6 additions & 5 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs
// revert all the keys for that batch.
result := <-storeChan
if result.keys != nil {
log.Debug("Batch validation failed, rolling back the key/value entries stored in database", "number of entires", len(*result.keys), "batchHeaderHash", batchHeaderHash)
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 use batchHeaderHashHex instead

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment for below logs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"batchHeaderHash" is what is used elsewhere, I'm keeping it for consistency

if deleteKeysErr := n.Store.DeleteKeys(ctx, result.keys); deleteKeysErr != nil {
log.Error("Failed to delete the invalid batch that should be rolled back", "batchHeaderHash", batchHeaderHashHex, "err", deleteKeysErr)
}
Expand All @@ -363,23 +364,23 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs
// Before we sign the batch, we should first complete the batch storing successfully.
result := <-storeChan
if result.err != nil {
log.Error("Store batch failed", "batchHeaderHash", batchHeaderHash, "err", result.err)
return nil, err
}
if result.keys != nil {
n.Metrics.AcceptBatches("stored", batchSize)
n.Metrics.ObserveLatency("StoreChunks", "stored", result.latency)
n.Logger.Debug("Store batch took", "duration:", time.Duration(result.latency*float64(time.Millisecond)))
n.Logger.Debug("Store batch succeeded", "batchHeaderHash", batchHeaderHash, "duration:", time.Duration(result.latency*float64(time.Millisecond)))
} else {
n.Logger.Warn("Store batch skipped because the batch already exists in the store", "batchHeaderHash", batchHeaderHash)
}

// Sign batch header hash if all validation checks pass and data items are written to database.
stageTimer = time.Now()
sig := n.KeyPair.SignMessage(batchHeaderHash)
log.Debug("Signed batch header hash", "pubkey", hexutil.Encode(n.KeyPair.GetPubKeyG2().Serialize()))
n.Metrics.AcceptBatches("signed", batchSize)
n.Metrics.ObserveLatency("StoreChunks", "signed", float64(time.Since(stageTimer).Milliseconds()))
log.Debug("Sign batch took", "duration", time.Since(stageTimer))

log.Info("StoreChunks succeeded")
log.Debug("Sign batch succeeded", "pubkey", hexutil.Encode(n.KeyPair.GetPubKeyG2().Serialize()), "duration", time.Since(stageTimer))

log.Debug("Exiting process batch", "duration", time.Since(start))
return sig, nil
Expand Down
Loading