From 88affbd0c16f7721affee916e98e0e037909dbcb Mon Sep 17 00:00:00 2001 From: Daniel Wasserman Date: Thu, 28 Dec 2023 14:25:02 -0500 Subject: [PATCH] [goreleaser] set message leaf upon witnessing Sent event --- agents/agents/executor/executor_utils.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/agents/agents/executor/executor_utils.go b/agents/agents/executor/executor_utils.go index a2a073af63..78c200eda2 100644 --- a/agents/agents/executor/executor_utils.go +++ b/agents/agents/executor/executor_utils.go @@ -140,6 +140,12 @@ func (e Executor) processMessage(ctx context.Context, message types.Message, log metrics.EndSpanWithErr(span, err) }() + leaf, err := message.ToLeaf() + if err != nil { + return fmt.Errorf("could not convert message to leaf: %w", err) + } + span.SetAttributes(attribute.String(metrics.MessageLeaf, common.BytesToHash(leaf[:]).String())) + // Sanity check to make sure that the message has come from Origin. if log.Address.String() != e.chainConfigs[message.OriginDomain()].OriginAddress { span.AddEvent("message is not from origin", trace.WithAttributes( @@ -152,11 +158,6 @@ func (e Executor) processMessage(ctx context.Context, message types.Message, log merkleIndex := e.chainExecutors[message.OriginDomain()].merkleTree.NumOfItems() span.SetAttributes(attribute.Int("merkle_index", int(merkleIndex))) - leaf, err := message.ToLeaf() - if err != nil { - return fmt.Errorf("could not convert message to leaf: %w", err) - } - // Make sure the nonce of the message is being inserted at the right index. span.AddEvent("validating message nonce", trace.WithAttributes( attribute.Int(metrics.Nonce, int(message.Nonce())),