From b7a1281c1284ce0aa0298e8d9e7cd6ca0fe8823b Mon Sep 17 00:00:00 2001 From: Kirill Pisarev Date: Thu, 10 Aug 2023 16:00:55 +0200 Subject: [PATCH] feat: add msg.String() to all msg related events --- chains/evm/executor/executor.go | 12 ++++++------ chains/evm/listener/event-handler.go | 2 +- chains/substrate/executor/executor.go | 8 ++++---- chains/substrate/listener/event-handlers.go | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/chains/evm/executor/executor.go b/chains/evm/executor/executor.go index 3e5b0186..69cfb2e9 100644 --- a/chains/evm/executor/executor.go +++ b/chains/evm/executor/executor.go @@ -83,8 +83,8 @@ func (e *Executor) Execute(ctx context.Context, msgs []*message.Message) error { proposals := make([]*chains.Proposal, 0) for _, m := range msgs { - logger.Info().Str("msg.id", m.ID()).Msgf("Message to execute %s", m.String()) - span.AddEvent("Message to execute received", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.type", string(m.Type)))) + logger.Debug().Str("msg.id", m.ID()).Msgf("Message to execute %s", m.String()) + span.AddEvent("Message to execute received", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.full", m.String()))) prop, err := e.mh.HandleMessage(m) if err != nil { return fmt.Errorf("failed to handle message %s with error: %w", m.String(), err) @@ -97,11 +97,11 @@ func (e *Executor) Execute(ctx context.Context, msgs []*message.Message) error { } if isExecuted { logger.Info().Str("msg.id", m.ID()).Msgf("Message already executed %s", m.String()) - span.AddEvent("Message already executed", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.type", string(m.Type)))) + span.AddEvent("Message already executed", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.full", m.String()))) continue } logger.Info().Str("msg.id", m.ID()).Msgf("Executing message %s", m.String()) - span.AddEvent("Executing message", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.type", string(m.Type)))) + span.AddEvent("Executing message", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.full", m.String()))) proposals = append(proposals, evmProposal) } if len(proposals) == 0 { @@ -174,7 +174,7 @@ func (e *Executor) watchExecution(ctx context.Context, cancelExecution context.C return err } - logger.Info().Str("SessionID", sessionID).Msgf("Sent proposals execution with hash: %s", hash) + logger.Debug().Str("SessionID", sessionID).Msgf("Sent proposals execution with hash: %s", hash) } case <-ticker.C: { @@ -182,7 +182,7 @@ func (e *Executor) watchExecution(ctx context.Context, cancelExecution context.C continue } - logger.Info().Str("SessionID", sessionID).Msgf("Successfully executed proposals") + logger.Debug().Str("SessionID", sessionID).Msgf("Successfully executed proposals") span.AddEvent("Proposals executed", traceapi.WithAttributes(attribute.String("tss.session.id", sessionID))) return nil } diff --git a/chains/evm/listener/event-handler.go b/chains/evm/listener/event-handler.go index a2eb029d..177f5130 100644 --- a/chains/evm/listener/event-handler.go +++ b/chains/evm/listener/event-handler.go @@ -98,7 +98,7 @@ func (eh *DepositEventHandler) HandleEvent( } logger.Info().Str("msg.id", m.ID()).Msgf("Resolved deposit message %s in block range: %s-%s", m.String(), startBlock.String(), endBlock.String()) // Events should eventually replace most of the logs - span.AddEvent("Resolved deposit message", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.type", string(m.Type)))) + span.AddEvent("Resolved deposit message", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.full", m.String()))) if m.Type == PermissionlessGenericTransfer { msgChan <- []*message.Message{m} return diff --git a/chains/substrate/executor/executor.go b/chains/substrate/executor/executor.go index 97905b1a..4a12b3be 100644 --- a/chains/substrate/executor/executor.go +++ b/chains/substrate/executor/executor.go @@ -92,8 +92,8 @@ func (e *Executor) Execute(ctx context.Context, msgs []*message.Message) error { proposals := make([]*chains.Proposal, 0) for _, m := range msgs { - logger.Info().Str("msg.id", m.ID()).Msgf("Message to execute %s", m.String()) - span.AddEvent("Message to execute received", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.type", string(m.Type)))) + logger.Debug().Str("msg.id", m.ID()).Msgf("Message to execute %s", m.String()) + span.AddEvent("Message to execute received", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.full", m.String()))) prop, err := e.mh.HandleMessage(m) if err != nil { return fmt.Errorf("failed to handle message %s with error: %w", m.String(), err) @@ -105,8 +105,8 @@ func (e *Executor) Execute(ctx context.Context, msgs []*message.Message) error { return err } if isExecuted { - logger.Info().Str("msg.id", m.ID()).Msgf("Message already executed %s", m.String()) - span.AddEvent("Message already executed", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.type", string(m.Type)))) + logger.Debug().Str("msg.id", m.ID()).Msgf("Message already executed %s", m.String()) + span.AddEvent("Message already executed", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.full", m.String()))) continue } diff --git a/chains/substrate/listener/event-handlers.go b/chains/substrate/listener/event-handlers.go index b879ed5e..a534bb7a 100644 --- a/chains/substrate/listener/event-handlers.go +++ b/chains/substrate/listener/event-handlers.go @@ -98,8 +98,8 @@ func (eh *FungibleTransferEventHandler) HandleEvents(ctx context.Context, evts [ return } - logger.Info().Str("msg.id", m.ID()).Msgf("Resolved deposit message %s", m.String()) - span.AddEvent("Resolved message", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.type", string(m.Type)))) + logger.Debug().Str("msg.id", m.ID()).Msgf("Resolved deposit message %s", m.String()) + span.AddEvent("Resolved message", traceapi.WithAttributes(attribute.String("msg.id", m.ID()), attribute.String("msg.full", m.String()))) domainDeposits[m.Destination] = append(domainDeposits[m.Destination], m) }(*evt) }