Fix message logs (#1825)

asaj/block-skew
Mattie Conover 2 years ago committed by GitHub
parent 7f439ab446
commit 29f0c78f5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      rust/agents/relayer/src/msg/gas_payment/policies/meets_estimated_cost.rs
  2. 2
      rust/agents/relayer/src/msg/gelato_submitter/sponsored_call_op.rs
  3. 24
      rust/agents/relayer/src/msg/processor.rs
  4. 8
      rust/agents/relayer/src/msg/serial_submitter.rs
  5. 2
      rust/chains/hyperlane-ethereum/src/mailbox.rs
  6. 2
      rust/chains/hyperlane-fuel/src/mailbox.rs
  7. 4
      rust/hyperlane-core/src/db/hyperlane_db.rs

@ -203,7 +203,7 @@ impl GasPaymentPolicy for GasPaymentPolicyMeetsEstimatedCost {
let meets_requirement = *current_payment >= origin_token_tx_cost; let meets_requirement = *current_payment >= origin_token_tx_cost;
if !meets_requirement { if !meets_requirement {
info!( info!(
%message, msg=%message,
?tx_cost_estimate, ?tx_cost_estimate,
?destination_token_tx_cost, ?destination_token_tx_cost,
?origin_token_tx_cost, ?origin_token_tx_cost,
@ -212,7 +212,7 @@ impl GasPaymentPolicy for GasPaymentPolicyMeetsEstimatedCost {
); );
} else { } else {
debug!( debug!(
%message, msg=%message,
?tx_cost_estimate, ?tx_cost_estimate,
?destination_token_tx_cost, ?destination_token_tx_cost,
?origin_token_tx_cost, ?origin_token_tx_cost,

@ -66,7 +66,7 @@ impl SponsoredCallOp {
Self(args) Self(args)
} }
#[instrument(skip(self), fields(message=?self.message.message))] #[instrument(skip(self), fields(msg=?self.message.message))]
pub async fn run(&mut self) { pub async fn run(&mut self) {
loop { loop {
match self.tick().await { match self.tick().await {

@ -107,26 +107,26 @@ impl MessageProcessor {
/// testing purposes. /// testing purposes.
async fn tick(&mut self) -> Result<()> { async fn tick(&mut self) -> Result<()> {
// Scan until we find next nonce without delivery confirmation. // Scan until we find next nonce without delivery confirmation.
if let Some(message) = self.try_get_unprocessed_message()? { if let Some(msg) = self.try_get_unprocessed_message()? {
debug!(?message, "Processor working on message"); debug!(?msg, "Processor working on message");
// Skip if not whitelisted. // Skip if not whitelisted.
if !self.whitelist.msg_matches(&message, true) { if !self.whitelist.msg_matches(&msg, true) {
debug!(?message, whitelist=?self.whitelist, "Message not whitelisted, skipping"); debug!(?msg, whitelist=?self.whitelist, "Message not whitelisted, skipping");
self.message_nonce += 1; self.message_nonce += 1;
return Ok(()); return Ok(());
} }
// Skip if the message is blacklisted // Skip if the message is blacklisted
if self.blacklist.msg_matches(&message, false) { if self.blacklist.msg_matches(&msg, false) {
debug!(?message, blacklist=?self.blacklist, "Message blacklisted, skipping"); debug!(?msg, blacklist=?self.blacklist, "Message blacklisted, skipping");
self.message_nonce += 1; self.message_nonce += 1;
return Ok(()); return Ok(());
} }
// Skip if the message is intended for a destination we do not service // Skip if the message is intended for a destination we do not service
if self.send_channels.get(&message.destination).is_none() { if self.send_channels.get(&msg.destination).is_none() {
debug!(?message, "Message destined for unknown domain, skipping"); debug!(?msg, "Message destined for unknown domain, skipping");
self.message_nonce += 1; self.message_nonce += 1;
return Ok(()); return Ok(());
} }
@ -135,15 +135,15 @@ impl MessageProcessor {
self.prover_sync self.prover_sync
.write() .write()
.await .await
.update_to_index(message.nonce) .update_to_index(msg.nonce)
.await?; .await?;
debug!(%message, "Sending message to submitter"); debug!(%msg, "Sending message to submitter");
// Finally, build the submit arg and dispatch it to the submitter. // Finally, build the submit arg and dispatch it to the submitter.
let submit_args = SubmitMessageArgs::new(message.clone()); let submit_args = SubmitMessageArgs::new(msg.clone());
// Guaranteed to exist as we return early above if it does not. // Guaranteed to exist as we return early above if it does not.
let send_channel = self.send_channels.get(&message.destination).unwrap(); let send_channel = self.send_channels.get(&msg.destination).unwrap();
send_channel.send(submit_args)?; send_channel.send(submit_args)?;
self.message_nonce += 1; self.message_nonce += 1;
} else { } else {

@ -228,17 +228,17 @@ impl SerialSubmitter {
match self.process_message(&msg).await { match self.process_message(&msg).await {
Ok(true) => { Ok(true) => {
info!(message = %msg.message, "Message processed"); info!(msg=%msg.message, "Message processed");
self.record_message_process_success(&msg)?; self.record_message_process_success(&msg)?;
return Ok(()); return Ok(());
} }
Ok(false) => { Ok(false) => {
info!(message = %msg.message, "Message not processed"); info!(msg=%msg.message, "Message not processed");
} }
// We expect this branch to be hit when there is unexpected behavior - // We expect this branch to be hit when there is unexpected behavior -
// defined behavior like gas estimation failing will not hit this branch. // defined behavior like gas estimation failing will not hit this branch.
Err(error) => { Err(error) => {
error!(message = %msg.message, ?error, "Error occurred when attempting to process message"); error!(msg=%msg.message, ?error, "Error occurred when attempting to process message");
} }
} }
@ -256,7 +256,7 @@ impl SerialSubmitter {
/// been processed, Ok(true) is returned. If this message is unable to /// been processed, Ok(true) is returned. If this message is unable to
/// be processed, either due to failed gas estimation or an insufficient gas payment, /// be processed, either due to failed gas estimation or an insufficient gas payment,
/// Ok(false) is returned. /// Ok(false) is returned.
#[instrument(skip(self, msg), fields(message=?msg.message))] #[instrument(skip(self, msg), fields(msg=?msg.message))]
async fn process_message(&self, msg: &SubmitMessageArgs) -> Result<bool> { async fn process_message(&self, msg: &SubmitMessageArgs) -> Result<bool> {
// If the message has already been processed, e.g. due to another relayer having already // If the message has already been processed, e.g. due to another relayer having already
// processed, then mark it as already-processed, and move on to the next tick. // processed, then mark it as already-processed, and move on to the next tick.

@ -302,7 +302,7 @@ where
Ok(receipt.into()) Ok(receipt.into())
} }
#[instrument(err, ret, skip(self), fields(message=%message, metadata=%fmt_bytes(metadata)))] #[instrument(err, ret, skip(self), fields(msg=%message, metadata=%fmt_bytes(metadata)))]
async fn process_estimate_costs( async fn process_estimate_costs(
&self, &self,
message: &HyperlaneMessage, message: &HyperlaneMessage,

@ -124,7 +124,7 @@ impl Mailbox for FuelMailbox {
todo!() todo!()
} }
#[instrument(err, ret, skip(self), fields(message=%message, metadata=%fmt_bytes(metadata)))] #[instrument(err, ret, skip(self), fields(msg=%message, metadata=%fmt_bytes(metadata)))]
async fn process_estimate_costs( async fn process_estimate_costs(
&self, &self,
message: &HyperlaneMessage, message: &HyperlaneMessage,

@ -69,7 +69,7 @@ impl HyperlaneDB {
// If this message is not building off the latest nonce, log it. // If this message is not building off the latest nonce, log it.
if let Some(nonce) = self.retrieve_latest_nonce()? { if let Some(nonce) = self.retrieve_latest_nonce()? {
if nonce != message.nonce - 1 { if nonce != message.nonce - 1 {
debug!(%message, "Attempted to store message not building off latest nonce") debug!(msg=%message, "Attempted to store message not building off latest nonce")
} }
} }
@ -84,7 +84,7 @@ impl HyperlaneDB {
pub fn store_message(&self, message: &HyperlaneMessage) -> Result<()> { pub fn store_message(&self, message: &HyperlaneMessage) -> Result<()> {
let id = message.id(); let id = message.id();
info!(?message, "Storing new message in db",); info!(msg=?message, "Storing new message in db",);
self.store_message_id(message.nonce, message.destination, id)?; self.store_message_id(message.nonce, message.destination, id)?;
self.store_keyed_encodable(MESSAGE, &id, message)?; self.store_keyed_encodable(MESSAGE, &id, message)?;
Ok(()) Ok(())

Loading…
Cancel
Save