-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use gRPC query
ConnectionParams
instead of /genesis
to verify `ma…
…x_block_time` (#4144) * Use gRPC query to retrieve 'max_block_time' instead of querying the entire genesis data * Add changelog entry * Apply suggestions from code review Co-authored-by: Romain Ruetschi <[email protected]> Co-authored-by: Anca Zamfir <[email protected]> Signed-off-by: Luca Joss <[email protected]> * Override configured if it differs from queried value * Add debug log with queried value for 'max_expected_time_per_block' --------- Signed-off-by: Luca Joss <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> Co-authored-by: Anca Zamfir <[email protected]>
- Loading branch information
1 parent
39689c7
commit f69a6d7
Showing
7 changed files
with
59 additions
and
66 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...eased/improvements/ibc-relayer/4143-use-connection-params-in-validate-params.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- Use the `ibc.core.connection.v1.ConnectionParams` gRPC query to retrieve `maxExpectedTimePerBlock` | ||
and check it against the configured `max_block_time` instead of using the `/genesis` endpoint. | ||
This improves both startup times and reliability for most chains. | ||
([\#4143](https://github.com/informalsystems/hermes/issues/4143)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use http::uri::Uri; | ||
|
||
use ibc_proto::ibc::core::connection::v1::query_client::QueryClient; | ||
use ibc_proto::ibc::core::connection::v1::Params; | ||
use ibc_proto::ibc::core::connection::v1::QueryConnectionParamsRequest; | ||
|
||
use crate::config::default::max_grpc_decoding_size; | ||
use crate::error::Error; | ||
|
||
/// Uses the GRPC client to retrieve the connection params | ||
pub async fn query_connection_params(grpc_address: &Uri) -> Result<Params, Error> { | ||
let mut client = QueryClient::connect(grpc_address.clone()) | ||
.await | ||
.map_err(Error::grpc_transport)?; | ||
|
||
client = client.max_decoding_message_size(max_grpc_decoding_size().get_bytes() as usize); | ||
|
||
let request = tonic::Request::new(QueryConnectionParamsRequest {}); | ||
|
||
let response = client | ||
.connection_params(request) | ||
.await | ||
.map(|r| r.into_inner()) | ||
.map_err(|e| Error::grpc_status(e, "query_connection_params".to_owned()))?; | ||
|
||
// Querying connection params might not be found | ||
let params = response.params.ok_or_else(Error::empty_connection_params)?; | ||
|
||
Ok(params) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
pub mod account; | ||
pub mod app_state; | ||
pub mod config; | ||
pub mod events; | ||
pub mod gas; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters