fix: use hyp_message as tracing field instead of message (#4721)

### Description

https://docs.rs/tracing/latest/tracing/#shorthand-macros
> unlike other fields, `message`'s shorthand initialization is just the
string itself.

When using tracing::info etc, passing in an explicit `message` field
takes precedence over the message string that's supplied as the second
positional param! So we end up in situations where we see `message:
HyperlaneMessage { id: ....` instead of the log message we want! e.g.
https://cloudlogging.app.goo.gl/Nr8Q5W5KviD6sT8W9

Open to other field names, like `msg` or something, but this felt
explicit

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

<!--
What kind of testing have these changes undergone?

None/Manual/Unit Tests
-->
pull/4659/merge
Trevor Porter 1 week ago committed by GitHub
parent 72c23c0d63
commit 013d3211c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      rust/main/agents/relayer/src/msg/gas_payment/mod.rs
  2. 4
      rust/main/agents/relayer/src/msg/metadata/multisig/base.rs
  3. 2
      rust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rs
  4. 2
      rust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rs
  5. 2
      rust/main/agents/relayer/src/msg/processor.rs
  6. 2
      rust/main/chains/hyperlane-cosmos/src/mailbox/contract.rs
  7. 2
      rust/main/chains/hyperlane-fuel/src/mailbox.rs
  8. 4
      rust/main/hyperlane-base/src/db/rocks/hyperlane_db.rs

@ -105,7 +105,7 @@ impl GasPaymentEnforcer {
for (policy, whitelist) in &self.policies {
if !whitelist.msg_matches(message, true) {
trace!(
msg=%message,
hyp_message=%message,
?policy,
?whitelist,
"Message did not match whitelist for policy"
@ -114,13 +114,13 @@ impl GasPaymentEnforcer {
}
trace!(
msg=%message,
hyp_message=%message,
?policy,
?whitelist,
"Message matched whitelist for policy"
);
debug!(
msg=%message,
hyp_message=%message,
?policy,
?current_payment,
?current_expenditure,
@ -149,7 +149,7 @@ impl GasPaymentEnforcer {
}
error!(
msg=%message,
hyp_message=%message,
policies=?self.policies,
"No gas payment policy matched for message; consider adding a default policy to the end of the policies array which uses a wildcard whitelist."
);
@ -159,7 +159,7 @@ impl GasPaymentEnforcer {
pub fn record_tx_outcome(&self, message: &HyperlaneMessage, outcome: TxOutcome) -> Result<()> {
// This log is required in E2E, hence the use of a `const`
debug!(
msg=%message,
hyp_message=%message,
?outcome,
"{}",
GAS_EXPENDITURE_LOG_MESSAGE,

@ -126,11 +126,11 @@ impl<T: MultisigIsmMetadataBuilder> MetadataBuilder for T {
.await
.context(CTX)?
{
debug!(?message, ?metadata.checkpoint, "Found checkpoint with quorum");
debug!(hyp_message=?message, ?metadata.checkpoint, "Found checkpoint with quorum");
Ok(Some(self.format_metadata(metadata)?))
} else {
info!(
?message, ?validators, threshold, ism=%multisig_ism.address(),
hyp_message=?message, ?validators, threshold, ism=%multisig_ism.address(),
"Could not fetch metadata: Unable to reach quorum"
);
Ok(None)

@ -45,7 +45,7 @@ impl MultisigIsmMetadataBuilder for MerkleRootMultisigMetadataBuilder {
.await
.context(CTX)?,
debug!(
?message,
hyp_message=?message,
"No merkle leaf found for message id, must have not been enqueued in the tree"
)
);

@ -42,7 +42,7 @@ impl MultisigIsmMetadataBuilder for MessageIdMultisigMetadataBuilder {
.await
.context(CTX)?,
debug!(
?message,
hyp_message=?message,
"No merkle leaf found for message id, must have not been enqueued in the tree"
)
);

@ -163,7 +163,7 @@ impl DirectionalNonceIterator {
if let Some(message) = self.indexed_message_with_nonce()? {
Self::update_max_nonce_gauge(&message, metrics);
if !self.is_message_processed()? {
debug!(?message, iterator=?self, "Found processable message");
debug!(hyp_message=?message, iterator=?self, "Found processable message");
return Ok(MessageStatus::Processable(message));
} else {
return Ok(MessageStatus::Processed);

@ -176,7 +176,7 @@ impl Mailbox for CosmosMailbox {
Ok(tx_response_to_outcome(response)?)
}
#[instrument(err, ret, skip(self), fields(msg=%message, metadata=%bytes_to_hex(metadata)))]
#[instrument(err, ret, skip(self), fields(hyp_message=%message, metadata=%bytes_to_hex(metadata)))]
#[allow(clippy::blocks_in_conditions)] // TODO: `rustc` 1.80.1 clippy issue
async fn process_estimate_costs(
&self,

@ -185,7 +185,7 @@ impl Mailbox for FuelMailbox {
}
// Process cost of the `process` method
#[instrument(err, ret, skip(self), fields(msg=%message, metadata=%bytes_to_hex(metadata)))]
#[instrument(err, ret, skip(self), fields(hyp_message=%message, metadata=%bytes_to_hex(metadata)))]
#[allow(clippy::blocks_in_conditions)] // TODO: `rustc` 1.80.1 clippy issue
async fn process_estimate_costs(
&self,

@ -87,12 +87,12 @@ impl HyperlaneRocksDB {
dispatched_block_number: u64,
) -> DbResult<bool> {
if let Ok(Some(_)) = self.retrieve_message_id_by_nonce(&message.nonce) {
trace!(msg=?message, "Message already stored in db");
trace!(hyp_message=?message, "Message already stored in db");
return Ok(false);
}
let id = message.id();
debug!(msg=?message, "Storing new message in db",);
debug!(hyp_message=?message, "Storing new message in db",);
// - `id` --> `message`
self.store_message_by_id(&id, message)?;

Loading…
Cancel
Save