Skip to content

Commit

Permalink
Log the batch validation latency breakdown (Layr-Labs#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix authored Jul 2, 2024
1 parent 1645ffe commit 745e108
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

Expand Down

0 comments on commit 745e108

Please sign in to comment.