Skip to content

Commit

Permalink
Node/CCQ/EVM: Logging changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Sep 9, 2024
1 parent 68a7a1e commit 2a22603
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions node/pkg/watchers/evm/ccq.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (w *Watcher) ccqHandleEthCallQueryRequest(ctx context.Context, queryRequest

// Verify that the block read was successful.
if err := w.ccqVerifyBlockResult(blockError, blockResult); err != nil {
w.ccqLogger.Debug("failed to verify block for eth_call query",
w.ccqLogger.Error("failed to verify block for eth_call query",
zap.String("requestId", requestId),
zap.String("block", block),
zap.Any("batch", batch),
Expand All @@ -153,19 +153,10 @@ func (w *Watcher) ccqHandleEthCallQueryRequest(ctx context.Context, queryRequest
return
}

w.ccqLogger.Info("query complete for eth_call",
zap.String("requestId", requestId),
zap.String("block", block),
zap.String("blockNumber", blockResult.Number.String()),
zap.String("blockHash", blockResult.Hash.Hex()),
zap.String("blockTime", blockResult.Time.String()),
zap.Int64("duration", time.Since(start).Milliseconds()),
)

// Verify all the call results and build the batch of results.
results, err := w.ccqVerifyAndExtractQueryResults(requestId, evmCallData)
if err != nil {
w.ccqLogger.Debug("failed to process eth_call query call request",
w.ccqLogger.Error("failed to process eth_call query call request",
zap.String("requestId", requestId),
zap.String("block", block),
zap.Any("batch", batch),
Expand All @@ -175,6 +166,15 @@ func (w *Watcher) ccqHandleEthCallQueryRequest(ctx context.Context, queryRequest
return
}

w.ccqLogger.Info("query complete for eth_call",
zap.String("requestId", requestId),
zap.String("block", block),
zap.String("blockNumber", blockResult.Number.String()),
zap.String("blockHash", blockResult.Hash.Hex()),
zap.String("blockTime", blockResult.Time.String()),
zap.Int64("duration", time.Since(start).Milliseconds()),
)

// Finally, build the response and publish it.
resp := query.EthCallQueryResponse{
BlockNumber: blockResult.Number.ToInt().Uint64(),
Expand Down Expand Up @@ -388,7 +388,7 @@ func (w *Watcher) ccqHandleEthCallByTimestampQueryRequest(ctx context.Context, q

// Verify the following block read was successful.
if err := w.ccqVerifyBlockResult(nextBlockError, nextBlockResult); err != nil {
w.ccqLogger.Debug("failed to verify next block for eth_call_by_timestamp query",
w.ccqLogger.Error("failed to verify next block for eth_call_by_timestamp query",
zap.String("requestId", requestId),
zap.String("block", block),
zap.String("nextBlock", nextBlock),
Expand Down Expand Up @@ -446,6 +446,20 @@ func (w *Watcher) ccqHandleEthCallByTimestampQueryRequest(ctx context.Context, q
return
}

// Verify all the call results and build the batch of results.
results, err := w.ccqVerifyAndExtractQueryResults(requestId, evmCallData)
if err != nil {
w.ccqLogger.Error("failed to process eth_call_by_timestamp query call request",
zap.String("requestId", requestId),
zap.String("block", block),
zap.String("nextBlock", nextBlock),
zap.Any("batch", batch),
zap.Error(err),
)
w.ccqSendQueryResponse(queryRequest, query.QueryRetryNeeded, nil)
return
}

w.ccqLogger.Info("query complete for eth_call_by_timestamp",
zap.String("requestId", requestId),
zap.Uint64("desiredTimestamp", req.TargetTimestamp),
Expand All @@ -460,20 +474,6 @@ func (w *Watcher) ccqHandleEthCallByTimestampQueryRequest(ctx context.Context, q
zap.Int64("duration", time.Since(start).Milliseconds()),
)

// Verify all the call results and build the batch of results.
results, err := w.ccqVerifyAndExtractQueryResults(requestId, evmCallData)
if err != nil {
w.ccqLogger.Debug("failed to process eth_call_by_timestamp query call request",
zap.String("requestId", requestId),
zap.String("block", block),
zap.String("nextBlock", nextBlock),
zap.Any("batch", batch),
zap.Error(err),
)
w.ccqSendQueryResponse(queryRequest, query.QueryRetryNeeded, nil)
return
}

// Finally, build the response and publish it.
resp := query.EthCallByTimestampQueryResponse{
TargetBlockNumber: targetBlockNum,
Expand Down Expand Up @@ -557,7 +557,7 @@ func (w *Watcher) ccqHandleEthCallWithFinalityQueryRequest(ctx context.Context,

// Verify that the block read was successful.
if err := w.ccqVerifyBlockResult(blockError, blockResult); err != nil {
w.ccqLogger.Debug("failed to verify block for eth_call_with_finality query",
w.ccqLogger.Error("failed to verify block for eth_call_with_finality query",
zap.String("requestId", requestId),
zap.String("block", block),
zap.Any("batch", batch),
Expand Down Expand Up @@ -590,20 +590,10 @@ func (w *Watcher) ccqHandleEthCallWithFinalityQueryRequest(ctx context.Context,
return
}

w.ccqLogger.Info("query complete for eth_call_with_finality",
zap.String("requestId", requestId),
zap.String("finality", req.Finality),
zap.Uint64("requestedBlockNumber", blockNumber),
zap.Uint64("latestBlockNumber", latestBlockNum),
zap.String("blockHash", blockResult.Hash.Hex()),
zap.String("blockTime", blockResult.Time.String()),
zap.Int64("duration", time.Since(start).Milliseconds()),
)

// Verify all the call results and build the batch of results.
results, err := w.ccqVerifyAndExtractQueryResults(requestId, evmCallData)
if err != nil {
w.ccqLogger.Debug("failed to process eth_call_with_finality query call request",
w.ccqLogger.Error("failed to process eth_call_with_finality query call request",
zap.String("requestId", requestId),
zap.String("finality", req.Finality),
zap.Uint64("requestedBlockNumber", blockNumber),
Expand All @@ -616,6 +606,16 @@ func (w *Watcher) ccqHandleEthCallWithFinalityQueryRequest(ctx context.Context,
return
}

w.ccqLogger.Info("query complete for eth_call_with_finality",
zap.String("requestId", requestId),
zap.String("finality", req.Finality),
zap.Uint64("requestedBlockNumber", blockNumber),
zap.Uint64("latestBlockNumber", latestBlockNum),
zap.String("blockHash", blockResult.Hash.Hex()),
zap.String("blockTime", blockResult.Time.String()),
zap.Int64("duration", time.Since(start).Milliseconds()),
)

// Finally, build the response and publish it.
resp := query.EthCallWithFinalityQueryResponse{
BlockNumber: blockNumber,
Expand Down

0 comments on commit 2a22603

Please sign in to comment.