Skip to content

Commit 04868db

Browse files
ljoss17romacsainoeGoodDaisybeer-1
authored
Port Osmosis EIP fee query feature (#3771)
* Fix README badge (#3675) * Fix a bug in `query_next_sequence_receive`, where if we didnt ask for a proof, then the query height was ignored (#3662) * Enable serde feature of ibc-proto (#3678) * Update misbehaviour-ics tests (#3681) * Update light_client_attack_freeze_test.sh Update script to work with ICS `feat/ics-misbehaviour-handling` branch binary at `28e0c14b`. Signed-off-by: Simon Noetzlin <[email protected]> * Update nix flake and remaining misbehaviour tests * Fix env variable increment * Use Cosmos Nix 'master' branch --------- Signed-off-by: Simon Noetzlin <[email protected]> Co-authored-by: Luca Joss <[email protected]> * Bump version to v1.7.1 * Do not perform client update if consensus state already exists (#3555) * Do not perform client update if consensus state already exists On some chains there are a few active channels using the same connection and therefore clients. This PR adds a check in the client update code and not create the message if the consensus state at desired height is already present. This helps with reducing relayer fees, state bloating, etc by eliminating redundant updates. * Improve error message in `update client` command * Add changelog entry for #3521 * Fix guide config files and balance outputs (#3690) * Add per chain `clear_interval` configuration (#3693) * Add per chain clear_interval configuration * Add changelog entry * Add guide entry for packet clearing * Reword config comment Signed-off-by: Romain Ruetschi <[email protected]> --------- Signed-off-by: Romain Ruetschi <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> * Add CompatMode configuration (#3667) * Update test bootstrap to work with Celestia chain * Update Nix flake and add Celestia CI job * Add changelog entry * Add guide section for 'compat_mode' configuration * Apply suggestions from code review Co-authored-by: Romain Ruetschi <[email protected]> Signed-off-by: Luca Joss <[email protected]> * Implement serialization and deserialization for CompatMode * Update crates/relayer/src/util/compat_mode.rs Co-authored-by: Romain Ruetschi <[email protected]> Signed-off-by: Luca Joss <[email protected]> --------- Signed-off-by: Luca Joss <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> * docs: fix typos (#3687) * docs: fix typos * test: fix error because of typo * Fix misbehaviour test --------- Co-authored-by: Luca Joss <[email protected]> Co-authored-by: Luca Joss <[email protected]> * Update changelog * Apply suggestions from code review Co-authored-by: Luca Joss <[email protected]> Signed-off-by: Romain Ruetschi <[email protected]> * Release Hermes v1.7.2 (#3709) * Add metric to count skipped client update messages (#3706) * Add metric to count skipped client update messages * Update guide with new metric * Add changelog entry * Update versions * Fix cargo doc warnings and update version reference in relayer crate * Fix clippy error * Fix relayer-rest test * Fix typo in changelog * Add `broadcast_errors` metric (#3710) * Add metric for broadcast errors * Update the guide with the new broadcast error metric * Add changelog entry * Update release date * Update changelog and summary message * Apply github suggestion and add missing entry in Changelog * Release Hermes v1.7.3 (#3715) * evidence: More reliable evidence reporting + couple of bug fixes (#3702) * evidence: Only fetch counterparty clients of chains present in the config * Harden the evidence reporting code in the face of runtime errors * Fix bug where the counterparty client id returned was actually the original client id * Bump version to v1.7.3 * Release changelog * Release Hermes v1.7.4 (#3729) * Improve `broadcast_errors` metric (#3719) * Use short description for 'broadcast_errors' metric * Add changelog entry * Fix hyperlink in doc comment Signed-off-by: Romain Ruetschi <[email protected]> * Fix hyperlink in doc comment --------- Signed-off-by: Romain Ruetschi <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> * Fetch the light block at trusted_height + 1 when detecting misbehavior (#3727) * fetch the light block at trusted_height+1 when detecting misbehaviour * Add changelog entry * Fix typo --------- Co-authored-by: beer-1 <[email protected]> * Initialise v1.7.4 release * Avoid retrieving a worker which is being removed by the idle worker clean-up process (#3725) * prevent returning stopping workers * clear only the specific worker * Add ibc-go v8 to integration tests (#3694) * Add simapp v8 to CI jobs * Add simapp v8 to nix flake * Handle CLI breaking changes of Cosmos SDK v0.50 in test bootstrap * Handle genesis config 'voting_perdiod' and CLI 'query txs' changes for Cosmos SDK v0.50.1 * Use 'MsgSubmitProposal' instead of deprecated 'UpgradeProposal' to initiate a chain upgrade * Update 'tx upgrade-chain' CLI template * Fix 'tx chain-upgrade' tests * Update chain upgrade for compatibility between different ibc-go versions * Improve assertion for client upgrade tests * Update ibc-proto-rs to v0.39.0 * Add changelog entry * Fix and improve guide section for client upgrade * Wait before querying client state for client upgrade tests * Apply suggestions from code review Co-authored-by: Romain Ruetschi <[email protected]> Signed-off-by: Luca Joss <[email protected]> * Rename method 'ibc_version()' to 'version_specs' * Extract the verification of legacy version in a method * Implement 'FromStr' instead of 'TryFrom<String>' for 'ProposalStatus' * Fix cargo-doc warning * Add changelog entry for CLI * Change the '--gov-account' flag as optional but will fail if trying to upgrade a chain with ibc-go v8+ * Update guide * Move and update changelog entry for CLI * Return a 'Specs' struct in 'version_specs()' method * Fix clippy errors --------- Signed-off-by: Luca Joss <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> * Update Gaia used in tests from v12 to v13 & v14 (#3700) * Update Gaia v12 to v13 and v14 in tests * Fix Celestia CI job * Replace Gaia v12 with v13 and v14 in multi-chain tests (#3701) * Add changelog entry --------- Signed-off-by: Luca Joss <[email protected]> Co-authored-by: beer-1 <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> * Add PR 3703 to patch release * Improve `backlog` metrics (#3722) * Update backlog metric when packet clearing is triggered * Fix update backlog and add unit tests * Uncomment conditional compilation from telemetry tests * Add changelog entry * Update guide section regarding 'backlog_*' metrics * Correctly update the backlog when querying commitments on chain * Update backlog_oldest_timestamp to backlog_latest_update_timestamp * Update changelog entry * Fix bug in backlog update * Guard tests module by test cfg Signed-off-by: Romain Ruetschi <[email protected]> * Update from GitHub suggestions --------- Signed-off-by: Romain Ruetschi <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> * Update changelog * Update release summary --------- Signed-off-by: Romain Ruetschi <[email protected]> Signed-off-by: Luca Joss <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> Co-authored-by: beer-1 <[email protected]> * Fix changelog * add query for eip value * add lcd as optional field * initial integration * using dynamic * dynamic pricing * added better logs * use block_on * remove lcd * Add DynamicGas configuration * Add test for dynamic gas configuration * Fix dynamic gas price computation * Remove test related changes * Remove dynamic gas test * Change dynamic_gas_price to dynamic_gas configuration name * Correctly deserialize DynamicGas config * Fix formatting following merge * dynamic gas price: Add integration test (#3788) * Dynamic gas fee test * Add dynamic gas fee test to CI * Fix issue with nested calls to `block_on` (#3789) * Fix test for dynamic gas price --------- Co-authored-by: Luca Joss <[email protected]> * Avoid depending on `cosmwasm-std` and `osmosis-std` * Cleanup * Use rustls instead of openssl with reqwest * Use same feature flag as tendermint-rpc for reqwest * Cleanup feature flag for reqwest dep in chain-registry * Undo changes to Cargo.lock * Add dynamic gas fees metrics (#3798) * Add simple metric for dynamic gas price after multiplication * Add max gas price configuration to dynamic gas configuration * Apply dynamic max gas configuration * Add 2 new metrics for dynamic gas fees * Add guide entry for Dynamic gas configuration and metrics * Fix EIP query parsing * Use chain id instead of RPC address in emitted metrics --------- Co-authored-by: Romain Ruetschi <[email protected]> * Add changelog entry * Reword changelog entry * Remove lower bound on max dynamic gas price * Small refactor * Fix unused variable warning * Simplify deserialization code * Fix wrong error message * Fixup changelog entry * Add example to the config * Fix integration test framework * Fix typo in config file * Apply suggestions from code review Co-authored-by: Luca Joss <[email protected]> Signed-off-by: Romain Ruetschi <[email protected]> * Use dynamic gas for Osmosis in auto-generated config * Small improvement to `config auto` command output and usage * Fix typo Co-authored-by: Luca Joss <[email protected]> Signed-off-by: Romain Ruetschi <[email protected]> * Update guide template * Fix guide * Rename configuration 'dynamic_gas' to 'dynamic_gas_price' * Rename 'dynamic_gas_price' subconfigurations 'max_gas_price' to 'max' and 'gas_price_multiplier' to 'multiplier' --------- Signed-off-by: Simon Noetzlin <[email protected]> Signed-off-by: Romain Ruetschi <[email protected]> Signed-off-by: Luca Joss <[email protected]> Signed-off-by: Romain Ruetschi <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]> Co-authored-by: Simon Noetzlin <[email protected]> Co-authored-by: GoodDaisy <[email protected]> Co-authored-by: beer-1 <[email protected]> Co-authored-by: Adam Tucker <[email protected]> Co-authored-by: Nicolas Lara <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]>
1 parent d9c939f commit 04868db

File tree

36 files changed

+1166
-213
lines changed

36 files changed

+1166
-213
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- Add a new per-chain configuration table `dynamic_gas_price` which enables
2+
querying the current gas price from the chain instead of the static `gas_price`,
3+
when the chain has [EIP-1559][eip]-like dynamic gas price.
4+
The new configuration setting can be configured per-chain as follows:
5+
```toml
6+
dynamic_gas_price = { enabled = true, multiplier = 1.1, max = 0.6 }
7+
```
8+
At the moment, only chains which support the `osmosis.txfees.v1beta1.Query/GetEipBaseFee`
9+
query can be used with dynamic gas price enabled.
10+
([\#3738](https://github.com/informalsystems/hermes/issues/3738))
11+
12+
[eip]: https://metamask.io/1559/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- Add three metrics related to EIP gas price:
2+
- `dynamic_gas_queried_fees` contains data on the queried values
3+
before applying any filter
4+
- `dynamic_gas_queried_success_fees` contains data on the queried
5+
values if the query was successful and before applying any filter
6+
- `dynamic_gas_paid_fees` contains data on the queried values after
7+
applying the `max` filter
8+
([\#3738](https://github.com/informalsystems/hermes/issues/3738))

.github/workflows/integration.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
command: osmosisd
8080
account_prefix: osmo
8181
native_token: stake
82-
features: ''
82+
features: dynamic-gas-fee
8383
- package: juno
8484
command: junod
8585
account_prefix: juno

Cargo.lock

+1-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config.toml

+12
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,18 @@ gas_price = { price = 0.025, denom = 'stake' }
303303
# Minimum value: 1.0
304304
gas_multiplier = 1.1
305305

306+
# Query the current gas price from the chain instead of using the static `gas_price` from the config.
307+
# Useful for chains which have [EIP-1559][eip]-like dynamic gas price.
308+
#
309+
# At the moment, only chains which support the `osmosis.txfees.v1beta1.Query/GetEipBaseFee`
310+
# query can be used with dynamic gas price enabled.
311+
#
312+
# See this page in the Hermes guide for more information:
313+
# https://hermes.informal.systems/documentation/configuration/dynamic-gas-fees.html
314+
#
315+
# Default: { enabled = false, multiplier = 1.1, max = 0.6 }
316+
dynamic_gas_price = { enabled = false, multiplier = 1.1, max = 0.6 }
317+
306318
# Specify how many IBC messages at most to include in a single transaction.
307319
# Default: 30
308320
max_msg_num = 30

crates/chain-registry/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ flex-error = { version = "0.4.4", default-features = false }
2121
futures = { version = "0.3.27", features = ["executor"] }
2222
http = "0.2"
2323
itertools = "0.10.5"
24-
reqwest = { version = "0.11.13", features = ["rustls-tls", "json"], default-features = false }
24+
reqwest = { version = "0.11.13", features = ["rustls-tls-native-roots", "json"], default-features = false }
2525
serde = "1.0.195"
2626
serde_json = "1"
2727
tokio = "1.17.0"

crates/relayer-cli/src/chain_registry.rs

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::marker::Send;
66

77
use futures::future::join_all;
88
use http::Uri;
9+
use ibc_relayer::config::dynamic_gas::DynamicGasPrice;
910
use tokio::task::{JoinError, JoinHandle};
1011
use tracing::trace;
1112

@@ -120,6 +121,13 @@ where
120121
0.1
121122
};
122123

124+
// Use EIP-1559 dynamic gas price for Osmosis
125+
let dynamic_gas_price = if chain_data.chain_id.as_str() == "osmosis-1" {
126+
DynamicGasPrice::unsafe_new(true, 1.1, 0.6)
127+
} else {
128+
DynamicGasPrice::disabled()
129+
};
130+
123131
Ok(ChainConfig::CosmosSdk(CosmosSdkConfig {
124132
id: chain_data.chain_id,
125133
rpc_addr: rpc_data.rpc_address,
@@ -140,6 +148,7 @@ where
140148
max_gas: Some(400000),
141149
gas_adjustment: None,
142150
gas_multiplier: Some(GasMultiplier::new(1.1).unwrap()),
151+
dynamic_gas_price,
143152
fee_granter: None,
144153
max_msg_num: MaxMsgNum::default(),
145154
max_tx_size: MaxTxSize::default(),

crates/relayer-cli/src/commands/config/auto.rs

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::chain_registry::get_configs;
22
use abscissa_core::clap::Parser;
33
use abscissa_core::{Command, Runnable};
4+
use itertools::Itertools;
45

56
use crate::conclude::Output;
67

@@ -25,7 +26,7 @@ fn find_key(chain_config: &ChainConfig) -> Option<String> {
2526
/// If a is specified then it will be used without verifying that it exists.
2627
#[derive(Clone, Command, Debug, Parser, PartialEq, Eq)]
2728
#[clap(
28-
override_usage = "hermes config auto [OPTIONS] --output <PATH> --chains <CHAIN_NAME:OPTIONAL_KEY_NAME>"
29+
override_usage = "hermes config auto [OPTIONS] --output <PATH> --chain <CHAIN1_NAME:OPTIONAL_KEY_NAME> --chain <CHAIN2_NAME:OPTIONAL_KEY_NAME>"
2930
)]
3031
pub struct AutoCmd {
3132
#[clap(
@@ -39,11 +40,14 @@ pub struct AutoCmd {
3940

4041
#[clap(
4142
long = "chains",
43+
alias = "chain",
4244
required = true,
4345
multiple = true,
4446
value_name = "CHAIN_NAME:OPTIONAL_KEY_NAME",
4547
help_heading = "REQUIRED",
46-
help = "Names of the chains to include in the config. Every chain must be in the chain registry."
48+
help = "Names of the chains to include in the configuration, together with an optional key name. \
49+
Either repeat this argument for every chain or pass a space-separated list of chains. \
50+
Every chain must be found in the chain registry."
4751
)]
4852
chain_names: Vec<String>,
4953

@@ -149,23 +153,22 @@ impl Runnable for AutoCmd {
149153
};
150154

151155
match store(&config, &self.path) {
156+
Ok(_) if missing_chains_set.is_empty() => {
157+
Output::success_msg(format!(
158+
"Config file written successfully at '{}'",
159+
self.path.display()
160+
))
161+
.exit()
162+
},
152163
Ok(_) => {
153-
if missing_chains_set.is_empty() {
154-
Output::success_msg(format!(
155-
"Config file written successfully at '{}'",
156-
self.path.display()
157-
))
158-
.exit()
159-
} else {
160-
Output::success_msg(format!(
161-
"Config file written successfully at '{}'.
162-
However, configurations for the following chains were not able to be generated: {:?}",
163-
self.path.display(),
164-
missing_chains_set,
165-
))
166-
.exit()
167-
}
168-
}
164+
Output::success_msg(format!(
165+
"Config file written successfully at '{}'. \
166+
However, configurations for the following chains were not able to be generated: {}",
167+
self.path.display(),
168+
missing_chains_set.iter().join(", "),
169+
))
170+
.exit()
171+
},
169172
Err(e) => Output::error(format!(
170173
"An error occurred while attempting to write the config file: {}",
171174
e

crates/relayer/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ dirs-next = "2.0.0"
5151
retry = { version = "2.0.0", default-features = false }
5252
async-stream = "0.3.5"
5353
http = "0.2.9"
54+
reqwest = { version = "0.11", features = ["rustls-tls-native-roots", "json"], default-features = false }
5455
flex-error = { version = "0.4.4", default-features = false }
5556
signature = "2.1.0"
5657
anyhow = "1.0"

crates/relayer/src/chain/cosmos.rs

+13
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,16 @@ use crate::util::pretty::{
105105
};
106106
use crate::{chain::client::ClientSettings, config::Error as ConfigError};
107107

108+
use self::gas::dynamic_gas_price;
108109
use self::types::app_state::GenesisAppState;
110+
use self::types::gas::GasConfig;
109111
use self::version::Specs;
110112

111113
pub mod batch;
112114
pub mod client;
113115
pub mod compatibility;
114116
pub mod config;
117+
pub mod eip_base_fee;
115118
pub mod encode;
116119
pub mod estimate;
117120
pub mod fee;
@@ -490,6 +493,16 @@ impl CosmosSdkChain {
490493
Ok(min_gas_price)
491494
}
492495

496+
pub fn dynamic_gas_price(&self) -> GasPrice {
497+
let gas_config = GasConfig::from(self.config());
498+
499+
self.rt.block_on(dynamic_gas_price(
500+
&gas_config,
501+
&self.config.id,
502+
&self.config.rpc_addr,
503+
))
504+
}
505+
493506
/// The unbonding period of this chain
494507
pub fn unbonding_period(&self) -> Result<Duration, Error> {
495508
crate::time!(

0 commit comments

Comments
 (0)