diff --git a/.changelog/unreleased/improvements/2670-client-slashed-bonds.md b/.changelog/unreleased/improvements/2670-client-slashed-bonds.md new file mode 100644 index 0000000000..9159108854 --- /dev/null +++ b/.changelog/unreleased/improvements/2670-client-slashed-bonds.md @@ -0,0 +1,2 @@ +- Add slashed bonds/unbonds info to the client. + ([\#2670](https://github.com/anoma/namada/pull/2670)) \ No newline at end of file diff --git a/crates/apps/src/lib/client/rpc.rs b/crates/apps/src/lib/client/rpc.rs index bb5be7d815..23f9344b6a 100644 --- a/crates/apps/src/lib/client/rpc.rs +++ b/crates/apps/src/lib/client/rpc.rs @@ -1846,16 +1846,17 @@ pub async fn query_bonds( display_line!( context.io(), &mut w; - " Remaining active bond from epoch {}: Δ {}", + " Remaining active bond from epoch {}: Δ {} (slashed {})", bond.start, - bond.amount.to_string_native() + bond.amount.to_string_native(), + bond.slashed_amount.unwrap_or_default().to_string_native() )?; } if !details.bonds_total.is_zero() { display_line!( context.io(), &mut w; - "Active (slashed) bonds total: {}", + "Active (slashable) bonds total: {}", details.bonds_total_active().to_string_native() )?; } @@ -1873,10 +1874,11 @@ pub async fn query_bonds( display_line!( context.io(), &mut w; - " Withdrawable from epoch {} (active from {}): Δ {}", + " Withdrawable from epoch {} (active from {}): Δ {} (slashed {})", unbond.withdraw, unbond.start, - unbond.amount.to_string_native() + unbond.amount.to_string_native(), + unbond.slashed_amount.unwrap_or_default().to_string_native() )?; } display_line!( @@ -1908,6 +1910,12 @@ pub async fn query_bonds( "All bonds total: {}", bonds_and_unbonds.bonds_total.to_string_native() )?; + display_line!( + context.io(), + &mut w; + "All bonds total slashed: {}", + bonds_and_unbonds.bonds_total_slashed.to_string_native() + )?; if bonds_and_unbonds.unbonds_total != bonds_and_unbonds.unbonds_total_slashed @@ -1931,6 +1939,12 @@ pub async fn query_bonds( "All unbonds total withdrawable: {}", bonds_and_unbonds.total_withdrawable.to_string_native() )?; + display_line!( + context.io(), + &mut w; + "All unbonds total slashed: {}", + bonds_and_unbonds.unbonds_total_slashed.to_string_native() + )?; Ok(()) } diff --git a/crates/tests/src/e2e/ledger_tests.rs b/crates/tests/src/e2e/ledger_tests.rs index 3ecd4f9bb2..361c555900 100644 --- a/crates/tests/src/e2e/ledger_tests.rs +++ b/crates/tests/src/e2e/ledger_tests.rs @@ -1510,9 +1510,11 @@ fn test_bond_queries() -> Result<()> { client.exp_string( "All bonds total active: 100188.000000\r All bonds total: 100188.000000\r +All bonds total slashed: 0.000000\r All unbonds total active: 412.000000\r All unbonds total: 412.000000\r -All unbonds total withdrawable: 412.000000\r", +All unbonds total withdrawable: 412.000000\r +All unbonds total slashed: 0.000000\r", )?; client.assert_success();