From 17d834c6d383a520c4a2d898e1c75d5458a16185 Mon Sep 17 00:00:00 2001 From: Jian Xiao Date: Wed, 26 Jun 2024 20:15:02 +0000 Subject: [PATCH] Log the batch validation latency breakdown --- node/node.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node/node.go b/node/node.go index dff4651629..59a4f9c331 100644 --- a/node/node.go +++ b/node/node.go @@ -389,10 +389,12 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs } func (n *Node) ValidateBatch(ctx context.Context, header *core.BatchHeader, blobs []*core.BlobMessage) error { + start := time.Now() operatorState, err := n.ChainState.GetOperatorStateByOperator(ctx, header.ReferenceBlockNumber, n.Config.ID) if err != nil { return err } + getStateDuration := time.Since(start) pool := workerpool.New(n.Config.NumBatchValidators) err = n.Validator.ValidateBatch(header, blobs, operatorState, pool) @@ -408,6 +410,7 @@ func (n *Node) ValidateBatch(ctx context.Context, header *core.BatchHeader, blob } return fmt.Errorf("failed to validate batch with operator state %x: %w", strings.Join(hStr, ","), err) } + n.Logger.Debug("ValidateBatch completed", "get operator state duration", getStateDuration, "total duration", time.Since(start)) return nil }