Skip to content

Commit

Permalink
Log batch header hash in hex instead of bytes (Layr-Labs#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim authored Jun 4, 2024
1 parent 43b4e97 commit acce810
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (n *Node) Start(ctx context.Context) error {
if n.Config.RegisterNodeAtStart {
n.Logger.Info("Registering node on chain with the following parameters:", "operatorId",
n.Config.ID.Hex(), "hostname", n.Config.Hostname, "dispersalPort", n.Config.DispersalPort,
"retrievalPort", n.Config.RetrievalPort, "churnerUrl", n.Config.ChurnerUrl, "quorumIds", n.Config.QuorumIDList)
"retrievalPort", n.Config.RetrievalPort, "churnerUrl", n.Config.ChurnerUrl, "quorumIds", fmt.Sprint(n.Config.QuorumIDList))
socket := string(core.MakeOperatorSocket(n.Config.Hostname, n.Config.DispersalPort, n.Config.RetrievalPort))
privateKey, err := crypto.HexToECDSA(n.Config.EthClientConfig.PrivateKeyString)
if err != nil {
Expand Down Expand Up @@ -355,7 +355,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)
log.Debug("Batch validation failed, rolling back the key/value entries stored in database", "number of entires", len(*result.keys), "batchHeaderHash", batchHeaderHashHex)
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 @@ -368,14 +368,14 @@ 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)
log.Error("Store batch failed", "batchHeaderHash", batchHeaderHashHex, "err", result.err)
return nil, err
}
if result.keys != nil {
n.Metrics.RecordStoreChunksStage("stored", batchSize, result.latency)
n.Logger.Debug("Store batch succeeded", "batchHeaderHash", batchHeaderHash, "duration:", result.latency)
n.Logger.Debug("Store batch succeeded", "batchHeaderHash", batchHeaderHashHex, "duration:", result.latency)
} else {
n.Logger.Warn("Store batch skipped because the batch already exists in the store", "batchHeaderHash", batchHeaderHash)
n.Logger.Warn("Store batch skipped because the batch already exists in the store", "batchHeaderHash", batchHeaderHashHex)
}

// Sign batch header hash if all validation checks pass and data items are written to database.
Expand Down
2 changes: 1 addition & 1 deletion node/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func RegisterOperator(ctx context.Context, operator *Operator, transactor core.T
return nil
}

logger.Info("Quorums to register for", "quorums", quorumsToRegister)
logger.Info("Quorums to register for", "quorums", fmt.Sprint(quorumsToRegister))

// register for quorums
shouldCallChurner := false
Expand Down

0 comments on commit acce810

Please sign in to comment.