Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing of IBC-Go version in health check and improve health check reporting #3888

Merged
merged 6 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix parsing of IBC-Go version in health check and improve health check
reporting ([\#3880](https://github.com/informalsystems/hermes/issues/3880))
21 changes: 13 additions & 8 deletions crates/relayer/src/chain/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ pub mod wait;
///
/// [tm-37-max]: https://github.com/tendermint/tendermint/blob/v0.37.0-rc1/types/params.go#L79
pub const BLOCK_MAX_BYTES_MAX_FRACTION: f64 = 0.9;

pub struct CosmosSdkChain {
config: config::CosmosSdkConfig,
tx_config: TxConfig,
Expand Down Expand Up @@ -292,19 +293,23 @@ impl CosmosSdkChain {
));
}

// Query /genesis RPC endpoint to retrieve the `max_expected_time_per_block` value
// to use as `max_block_time`.
// Query /genesis RPC endpoint to retrieve the `max_expected_time_per_block` value to use as `max_block_time`.
// If it is not found, keep the configured `max_block_time`.
match self.block_on(self.rpc_client.genesis::<GenesisAppState>()) {
Ok(genesis_reponse) => {
let old_max_block_time = self.config.max_block_time;
self.config.max_block_time =
let new_max_block_time =
Duration::from_nanos(genesis_reponse.app_state.max_expected_time_per_block());
info!(
"Updated `max_block_time` using /genesis endpoint. Old value: `{}s`, new value: `{}s`",
old_max_block_time.as_secs(),
self.config.max_block_time.as_secs()
);

if old_max_block_time.as_secs() != new_max_block_time.as_secs() {
self.config.max_block_time = new_max_block_time;

info!(
"Updated `max_block_time` using /genesis endpoint. Old value: `{}s`, new value: `{}s`",
old_max_block_time.as_secs(),
self.config.max_block_time.as_secs()
);
}
}
Err(e) => {
warn!(
Expand Down
7 changes: 4 additions & 3 deletions crates/relayer/src/chain/cosmos/estimate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async fn estimate_gas_with_tx(
gas_config: &GasConfig,
grpc_address: &Uri,
tx: Tx,
account: &Account,
_account: &Account,
) -> Result<EstimatedGas, Error> {
let simulated_gas = send_tx_simulate(grpc_address, tx)
.await
Expand Down Expand Up @@ -169,7 +169,7 @@ async fn estimate_gas_with_tx(

telemetry!(
simulate_errors,
&account.address.to_string(),
&_account.address.to_string(),
true,
get_error_text(&e),
);
Expand All @@ -185,7 +185,7 @@ async fn estimate_gas_with_tx(

telemetry!(
simulate_errors,
&account.address.to_string(),
&_account.address.to_string(),
false,
get_error_text(&e),
);
Expand All @@ -212,6 +212,7 @@ fn can_recover_from_simulation_failure(e: &Error) -> bool {
}
}

#[cfg(feature = "telemetry")]
fn get_error_text(e: &Error) -> String {
use crate::error::ErrorDetail::*;

Expand Down
Loading
Loading