Skip to content

Commit

Permalink
Print simulation errors. Trim clear packets output.
Browse files Browse the repository at this point in the history
  • Loading branch information
adizere committed Jun 28, 2021
1 parent cd45364 commit 054ff2a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
10 changes: 7 additions & 3 deletions relayer/src/chain/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use tendermint_rpc::query::Query;
use tendermint_rpc::{endpoint::broadcast::tx_sync::Response, Client, HttpClient, Order};
use tokio::runtime::Runtime as TokioRuntime;
use tonic::codegen::http::Uri;
use tracing::{debug, trace};
use tracing::{debug, trace, error};

use ibc::downcast;
use ibc::events::{from_tx_response_event, IbcEvent};
Expand Down Expand Up @@ -187,14 +187,18 @@ impl CosmosSdkChain {
// [`MsgUpdateClient`, `MsgRecvPacket`, ..., `MsgRecvPacket`]
// if the batch is split in two TX-es, the second one will fail the simulation in `deliverTx` check
// In this case we just leave the gas un-adjusted, i.e. use `self.max_gas()`
let estimated_gas = self
let simulate_result = self
.send_tx_simulate(SimulateRequest {
tx: Some(Tx {
body: Some(body),
auth_info: Some(auth_info),
signatures: vec![signed_doc],
}),
})
});
if let Err(e) = &simulate_result {
error!("send_tx: simulation result: {:?}", e);
};
let estimated_gas = simulate_result
.map_or(self.max_gas(), |sr| {
sr.gas_info.map_or(self.max_gas(), |g| g.gas_used)
});
Expand Down
21 changes: 11 additions & 10 deletions relayer/src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::time::Instant;
use prost_types::Any;
use thiserror::Error;
use tracing::{debug, error, info, trace, warn};
use itertools::Itertools;

use ibc::{
downcast,
Expand Down Expand Up @@ -921,12 +922,12 @@ impl RelayPath {
if packet_commitments.is_empty() {
return Ok((events_result, query_height));
}
let commit_sequences = packet_commitments.iter().map(|p| p.sequence).collect();
let commit_sequences: Vec<u64> = packet_commitments.iter().map(|p| p.sequence).collect();
debug!(
"[{}] packets that still have commitments on {}: {:?}",
"[{}] packets that still have commitments on {}: {} (first 10 shown here; total={})",
self,
self.src_chain().id(),
commit_sequences
commit_sequences.iter().take(10).join(", "), commit_sequences.len()
);

// Get the packets that have not been received on destination chain
Expand All @@ -944,11 +945,11 @@ impl RelayPath {
.collect();

debug!(
"[{}] recv packets to send out to {} of the ones with commitments on source {}: {:?}",
"[{}] recv packets to send out to {} of the ones with commitments on source {}: {} (first 10 shown here; total={})",
self,
self.dst_chain().id(),
self.src_chain().id(),
sequences
sequences.iter().take(10).join(", "), sequences.len()
);

if sequences.is_empty() {
Expand Down Expand Up @@ -1006,12 +1007,12 @@ impl RelayPath {
return Ok((events_result, query_height));
}

let acked_sequences = acks_on_source.iter().map(|p| p.sequence).collect();
let acked_sequences: Vec<u64> = acks_on_source.iter().map(|p| p.sequence).collect();
debug!(
"[{}] packets that have acknowledgments on {} {:?}",
"[{}] packets that have acknowledgments on {} {} (first 10 shown here; total={})",
self,
self.src_chain().id(),
acked_sequences
acked_sequences.iter().take(10).join(", "), acked_sequences.len()
);

let request = QueryUnreceivedAcksRequest {
Expand All @@ -1028,11 +1029,11 @@ impl RelayPath {
.map(From::from)
.collect();
debug!(
"[{}] ack packets to send out to {} of the ones with acknowledgments on {}: {:?}",
"[{}] ack packets to send out to {} of the ones with acknowledgments on {}: {} (first 10 shown here; total={})",
self,
self.dst_chain().id(),
self.src_chain().id(),
sequences
sequences.iter().take(10).join(", "), sequences.len()
);

if sequences.is_empty() {
Expand Down

0 comments on commit 054ff2a

Please sign in to comment.