Skip to content

Commit

Permalink
Log batch header hash hex (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim authored May 10, 2024
1 parent e662201 commit cb55ffe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions core/aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package core
import (
"bytes"
"context"
"encoding/hex"
"errors"
"fmt"
"math/big"
Expand Down Expand Up @@ -127,8 +128,9 @@ func (a *StdSignatureAggregator) AggregateSignatures(ctx context.Context, state
if op, ok := state.IndexedOperators[r.Operator]; ok {
socket = op.Socket
}
batchHeaderHashHex := hex.EncodeToString(r.BatchHeaderHash[:])
if r.Err != nil {
a.Logger.Warn("error returned from messageChan", "operatorID", operatorIDHex, "operatorAddress", operatorAddr, "socket", socket, "batchHeaderHash", r.BatchHeaderHash, "err", r.Err)
a.Logger.Warn("error returned from messageChan", "operatorID", operatorIDHex, "operatorAddress", operatorAddr, "socket", socket, "batchHeaderHash", batchHeaderHashHex, "err", r.Err)
continue
}

Expand Down Expand Up @@ -171,7 +173,7 @@ func (a *StdSignatureAggregator) AggregateSignatures(ctx context.Context, state
aggPubKeys[ind].Add(op.PubkeyG2)
}
}
a.Logger.Info("received signature from operator", "operatorID", operatorIDHex, "operatorAddress", operatorAddr, "socket", socket, "quorumIDs", fmt.Sprint(operatorQuorums), "batchHeaderHash", r.BatchHeaderHash)
a.Logger.Info("received signature from operator", "operatorID", operatorIDHex, "operatorAddress", operatorAddr, "socket", socket, "quorumIDs", fmt.Sprint(operatorQuorums), "batchHeaderHash", batchHeaderHashHex)
}

// Aggregate Non signer Pubkey Id
Expand Down
6 changes: 4 additions & 2 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package node

import (
"context"
"encoding/hex"
"errors"
"fmt"
"math"
Expand Down Expand Up @@ -304,7 +305,8 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs
}
n.Metrics.AcceptBatches("received", batchSize)

log.Debug("Start processing a batch", "batchHeaderHash", batchHeaderHash, "batchSize (in bytes)", batchSize, "num of blobs", len(blobs), "referenceBlockNumber", header.ReferenceBlockNumber)
batchHeaderHashHex := hex.EncodeToString(batchHeaderHash[:])
log.Debug("Start processing a batch", "batchHeaderHash", batchHeaderHashHex, "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 Expand Up @@ -349,7 +351,7 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs
result := <-storeChan
if result.keys != nil {
if deleteKeysErr := n.Store.DeleteKeys(ctx, result.keys); deleteKeysErr != nil {
log.Error("Failed to delete the invalid batch that should be rolled back", "batchHeaderHash", batchHeaderHash, "err", deleteKeysErr)
log.Error("Failed to delete the invalid batch that should be rolled back", "batchHeaderHash", batchHeaderHashHex, "err", deleteKeysErr)
}
}
return nil, fmt.Errorf("failed to validate batch: %w", err)
Expand Down

0 comments on commit cb55ffe

Please sign in to comment.