Skip to content

Commit

Permalink
Log messages with pointers (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
emlautarom1 authored Jul 1, 2024
1 parent 35fed70 commit 3bd142d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion aggregator/message_blsagg.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func (mbas *MessageBlsAggregatorService) verifySignature(
) error {
_, ok := operatorsAvsStateDict[signedMessageDigest.OperatorId]
if !ok {
mbas.logger.Warn("Operator not found. Skipping message", "operator", fmt.Sprintf("%#v", signedMessageDigest.OperatorId))
mbas.logger.Warn("Operator not found. Skipping message", "operator", signedMessageDigest.OperatorId)
return OperatorNotPartOfMessageQuorumErrorFn(signedMessageDigest.OperatorId, signedMessageDigest.MessageDigest)
}

Expand Down
7 changes: 3 additions & 4 deletions aggregator/rpc_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rpc_server

import (
"errors"
"fmt"
"net/http"
"net/rpc"
"strings"
Expand Down Expand Up @@ -93,7 +92,7 @@ func mapErrors(err error) error {
// reply doesn't need to be checked. If there are no errors, the task response is accepted
// rpc framework forces a reply type to exist, so we put bool as a placeholder
func (s *RpcServer) ProcessSignedCheckpointTaskResponse(signedCheckpointTaskResponse *messages.SignedCheckpointTaskResponse, reply *bool) error {
s.logger.Info("Received signed task response", "response", fmt.Sprintf("%#v", signedCheckpointTaskResponse))
s.logger.Info("Received signed task response", "response", signedCheckpointTaskResponse)
s.listener.IncTotalSignedCheckpointTaskResponse()
s.listener.ObserveLastMessageReceivedTime(signedCheckpointTaskResponse.OperatorId, CheckpointTaskResponseLabel)

Expand All @@ -113,7 +112,7 @@ func (s *RpcServer) ProcessSignedCheckpointTaskResponse(signedCheckpointTaskResp
}

func (s *RpcServer) ProcessSignedStateRootUpdateMessage(signedStateRootUpdateMessage *messages.SignedStateRootUpdateMessage, reply *bool) error {
s.logger.Info("Received signed state root update message", "updateMessage", fmt.Sprintf("%#v", signedStateRootUpdateMessage))
s.logger.Info("Received signed state root update message", "updateMessage", signedStateRootUpdateMessage)
s.listener.IncTotalSignedCheckpointTaskResponse()
s.listener.ObserveLastMessageReceivedTime(signedStateRootUpdateMessage.OperatorId, StateRootUpdateMessageLabel)

Expand All @@ -131,7 +130,7 @@ func (s *RpcServer) ProcessSignedStateRootUpdateMessage(signedStateRootUpdateMes
}

func (s *RpcServer) ProcessSignedOperatorSetUpdateMessage(signedOperatorSetUpdateMessage *messages.SignedOperatorSetUpdateMessage, reply *bool) error {
s.logger.Info("Received signed operator set update message", "message", fmt.Sprintf("%#v", signedOperatorSetUpdateMessage))
s.logger.Info("Received signed operator set update message", "message", signedOperatorSetUpdateMessage)

operatorId := signedOperatorSetUpdateMessage.OperatorId
s.listener.ObserveLastMessageReceivedTime(operatorId, OperatorSetUpdateMessageLabel)
Expand Down
9 changes: 4 additions & 5 deletions operator/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package operator

import (
"errors"
"fmt"
"net"
"net/rpc"
"sync"
Expand Down Expand Up @@ -270,7 +269,7 @@ func (c *AggregatorRpcClient) tryResendFromDeque() {

entry.Retries++
if entry.Retries >= MaxRetries {
c.logger.Error("Max retries reached, dropping message", "message", fmt.Sprintf("%#v", message))
c.logger.Error("Max retries reached, dropping message", "message", message)
continue
}

Expand Down Expand Up @@ -331,7 +330,7 @@ func (c *AggregatorRpcClient) sendRequest(sendCb func() error) error {
}

func (c *AggregatorRpcClient) SendSignedCheckpointTaskResponseToAggregator(signedCheckpointTaskResponse *messages.SignedCheckpointTaskResponse) {
c.logger.Info("Sending signed task response header to aggregator", "signedCheckpointTaskResponse", fmt.Sprintf("%#v", signedCheckpointTaskResponse))
c.logger.Info("Sending signed task response header to aggregator", "signedCheckpointTaskResponse", signedCheckpointTaskResponse)

c.sendOperatorMessage(func() error {
var reply bool
Expand All @@ -353,7 +352,7 @@ func (c *AggregatorRpcClient) SendSignedCheckpointTaskResponseToAggregator(signe
}

func (c *AggregatorRpcClient) SendSignedStateRootUpdateToAggregator(signedStateRootUpdateMessage *messages.SignedStateRootUpdateMessage) {
c.logger.Info("Sending signed state root update message to aggregator", "signedStateRootUpdateMessage", fmt.Sprintf("%#v", signedStateRootUpdateMessage))
c.logger.Info("Sending signed state root update message to aggregator", "signedStateRootUpdateMessage", signedStateRootUpdateMessage)

c.sendOperatorMessage(func() error {
var reply bool
Expand All @@ -374,7 +373,7 @@ func (c *AggregatorRpcClient) SendSignedStateRootUpdateToAggregator(signedStateR
}

func (c *AggregatorRpcClient) SendSignedOperatorSetUpdateToAggregator(signedOperatorSetUpdateMessage *messages.SignedOperatorSetUpdateMessage) {
c.logger.Info("Sending operator set update message to aggregator", "signedOperatorSetUpdateMessage", fmt.Sprintf("%#v", signedOperatorSetUpdateMessage))
c.logger.Info("Sending operator set update message to aggregator", "signedOperatorSetUpdateMessage", signedOperatorSetUpdateMessage)

c.sendOperatorMessage(func() error {
var reply bool
Expand Down

0 comments on commit 3bd142d

Please sign in to comment.