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

Cosmos gas price config #3042

Merged
merged 9 commits into from
Dec 19, 2023
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
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

## Problem
Expand Down
105 changes: 64 additions & 41 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async-trait = "0.1"
auto_impl = "1.0"
backtrace = "0.3"
base64 = "0.21.2"
bigdecimal = "0.4.2"
bincode = "1.3"
borsh = "0.9"
bs58 = "0.5.0"
Expand Down
1 change: 1 addition & 0 deletions rust/agents/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ hyperlane-base = { path = "../../hyperlane-base" }
hyperlane-ethereum = { path = "../../chains/hyperlane-ethereum" }

[dev-dependencies]
once_cell.workspace = true
tokio-test.workspace = true
hyperlane-test = { path = "../../hyperlane-test" }
hyperlane-base = { path = "../../hyperlane-base", features = ["test-utils"] }
Expand Down
7 changes: 4 additions & 3 deletions rust/agents/relayer/src/msg/gas_payment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use async_trait::async_trait;
use eyre::Result;
use hyperlane_base::db::HyperlaneRocksDB;
use hyperlane_core::{
GasPaymentKey, HyperlaneMessage, InterchainGasExpenditure, InterchainGasPayment,
TxCostEstimate, TxOutcome, U256,
FixedPointNumber, GasPaymentKey, HyperlaneMessage, InterchainGasExpenditure,
InterchainGasPayment, TxCostEstimate, TxOutcome, U256,
};
use tracing::{debug, error, trace};

Expand Down Expand Up @@ -135,7 +135,8 @@ impl GasPaymentEnforcer {
self.db.process_gas_expenditure(InterchainGasExpenditure {
message_id: message.id(),
gas_used: outcome.gas_used,
tokens_used: outcome.gas_used * outcome.gas_price,
tokens_used: (FixedPointNumber::try_from(outcome.gas_used)? * outcome.gas_price)
.try_into()?,
})?;
Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions rust/agents/relayer/src/msg/gas_payment/policies/minimum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async fn test_gas_payment_policy_minimum() {
&current_expenditure,
&TxCostEstimate {
gas_limit: U256::from(100000u32),
gas_price: U256::from(100000u32),
gas_price: U256::from(100000u32).try_into().unwrap(),
l2_gas_limit: None,
},
)
Expand All @@ -83,7 +83,7 @@ async fn test_gas_payment_policy_minimum() {
&current_expenditure,
&TxCostEstimate {
gas_limit: U256::from(100000u32),
gas_price: U256::from(100001u32),
gas_price: U256::from(100001u32).try_into().unwrap(),
l2_gas_limit: None,
},
)
Expand All @@ -101,7 +101,7 @@ async fn test_gas_payment_policy_minimum() {
&current_expenditure,
&TxCostEstimate {
gas_limit: U256::from(100000u32),
gas_price: U256::from(100001u32),
gas_price: U256::from(100001u32).try_into().unwrap(),
l2_gas_limit: Some(U256::from(22222u32)),
},
)
Expand Down
Loading
Loading