Skip to content

Commit

Permalink
[goreleaser] set message leaf upon witnessing Sent event
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasse committed Dec 28, 2023
1 parent 1a62aed commit 88affbd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions agents/agents/executor/executor_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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())),
Expand Down

0 comments on commit 88affbd

Please sign in to comment.