Skip to content

Commit

Permalink
Merge pull request #4292 from anoma/mergify/bp/maint-libs-0.47/pr-4218
Browse files Browse the repository at this point in the history
Display transaction fees in normal mode (backport #4218)
  • Loading branch information
mergify[bot] authored Feb 3, 2025
2 parents 420cd92 + 31861a0 commit 79bb591
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Require the hardware wallet to display transaction fees in normal mode.
([\#4218](https://github.com/anoma/namada/pull/4218))
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ env:
AWS_REGION: us-west-2
NIGHTLY: nightly-2024-09-08
NAMADA_MASP_PARAMS_DIR: /masp/.masp-params
LEDGER_APP_VERSION: "2.0.3"
LEDGER_APP_VERSION: "2.0.4"
ROLE: arn:aws:iam::375643557360:role/github-runners-ci-shared

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ kdam = "0.5.2"
konst = { version = "0.3.8", default-features = false }
lazy_static = "1.4.0"
ledger-lib = { package="nam-ledger-lib", version = "0.1.1-nam.0", default-features = false, features = ["transport_tcp"] }
ledger-namada-rs = { git = "https://github.com/Zondax/ledger-namada", tag = "v2.0.2" }
ledger-namada-rs = { git = "https://github.com/Zondax/ledger-namada", tag = "v2.0.4" }
ledger-transport = "0.10.0"
ledger-transport-hid = "0.10.0"
libc = "0.2.97"
Expand Down
16 changes: 14 additions & 2 deletions crates/sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,8 @@ pub mod testing {
}

prop_compose! {
/// Generate an arbitrary wrapper transaction
pub fn arb_wrapper_tx()(
/// Generate an arbitrary wrapper transaction. Do not check fee validity
pub fn arb_unchecked_wrapper_tx()(
fee in arb_fee(),
pk in arb_common_pk(),
gas_limit in arb_gas_limit(),
Expand All @@ -1051,6 +1051,18 @@ pub mod testing {
}
}

prop_compose! {
/// Generate an arbitrary wrapper transaction with valid fees
pub fn arb_wrapper_tx()(
wrapper in arb_unchecked_wrapper_tx().prop_filter(
"wrapper fees overflow",
|x| x.get_tx_fee().is_ok(),
),
) -> WrapperTx {
wrapper
}
}

prop_compose! {
/// Generate an arbitrary transaction type
pub fn arb_tx_type()(tx_type in prop_oneof![
Expand Down
14 changes: 14 additions & 0 deletions crates/sdk/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,11 @@ pub async fn to_ledger_vector(
let fee_amount_per_gas_unit = to_ledger_decimal_variable_token(
wrapper.fee.amount_per_gas_unit,
);
let fee_limit = to_ledger_decimal_variable_token(
wrapper
.get_tx_fee()
.map_err(|e| Error::Other(format!("{}", e)))?,
);
tv.output_expert.extend(vec![
format!(
"Timestamp : {}",
Expand All @@ -2181,12 +2186,21 @@ pub async fn to_ledger_vector(
format!("Gas limit : {}", u64::from(wrapper.gas_limit)),
]);
if let Some(token) = tokens.get(&wrapper.fee.token) {
tv.output.push(format!(
"Fee : {} {}",
token.to_uppercase(),
fee_limit
));
tv.output_expert.push(format!(
"Fees/gas unit : {} {}",
token.to_uppercase(),
fee_amount_per_gas_unit,
));
} else {
tv.output.extend(vec![
format!("Fee token : {}", wrapper.fee.token),
format!("Fee : {}", fee_limit),
]);
tv.output_expert.extend(vec![
format!("Fee token : {}", wrapper.fee.token),
format!("Fees/gas unit : {}", fee_amount_per_gas_unit),
Expand Down

0 comments on commit 79bb591

Please sign in to comment.