Skip to content

Commit a1e1ea7

Browse files
committed
Merge branch 'brent/aesthetic-edits' (#2894)
2 parents de416e8 + 20cc041 commit a1e1ea7

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Some edits to logging and strings
2+
([\#2894](https://github.com/anoma/namada/pull/2894))

crates/proof_of_stake/src/rewards.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ where
360360
num_blocks_in_last_epoch,
361361
inflation,
362362
&staking_token,
363+
total_tokens,
363364
)?;
364365

365366
// Write new rewards parameters that will be used for the inflation of
@@ -388,6 +389,7 @@ pub fn update_rewards_products_and_mint_inflation<S>(
388389
num_blocks_in_last_epoch: u64,
389390
inflation: token::Amount,
390391
staking_token: &Address,
392+
total_native_tokens: token::Amount,
391393
) -> namada_storage::Result<()>
392394
where
393395
S: StorageRead + StorageWrite,
@@ -455,11 +457,12 @@ where
455457
let pos_reward_tokens = inflation - reward_tokens_remaining;
456458
tracing::info!(
457459
"Minting tokens for PoS rewards distribution into the PoS account. \
458-
Amount: {}. Total inflation: {}, number of blocks in the last epoch: \
459-
{num_blocks_in_last_epoch}, reward accumulators sum: \
460-
{accumulators_sum}.",
460+
Amount: {}. Total inflation: {}. Total native supply: {}. Number of \
461+
blocks in the last epoch: {num_blocks_in_last_epoch}. Reward \
462+
accumulators sum: {accumulators_sum}.",
461463
pos_reward_tokens.to_string_native(),
462464
inflation.to_string_native(),
465+
total_native_tokens.to_string_native(),
463466
);
464467
credit_tokens(storage, staking_token, &address::POS, pos_reward_tokens)?;
465468

crates/proof_of_stake/src/tests/test_pos.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use proptest::test_runner::Config;
1717
// Use `RUST_LOG=info` (or another tracing level) and `--nocapture` to see
1818
// `tracing` logs from tests
1919
use test_log::test;
20+
use token::storage_key::minted_balance_key;
2021

2122
use crate::parameters::testing::arb_pos_params;
2223
use crate::parameters::OwnedPosParams;
@@ -1414,6 +1415,11 @@ fn test_update_rewards_products_aux(validators: Vec<GenesisValidator>) {
14141415
.unwrap();
14151416
}
14161417

1418+
let total_native_tokens: token::Amount = s
1419+
.read(&minted_balance_key(&staking_token))
1420+
.unwrap()
1421+
.expect("Total NAM balance should exist in storage");
1422+
14171423
// Distribute inflation into rewards
14181424
let last_epoch = current_epoch.prev();
14191425
let inflation = token::Amount::native_whole(10_000_000);
@@ -1424,6 +1430,7 @@ fn test_update_rewards_products_aux(validators: Vec<GenesisValidator>) {
14241430
num_blocks_in_last_epoch,
14251431
inflation,
14261432
&staking_token,
1433+
total_native_tokens,
14271434
)
14281435
.unwrap();
14291436

crates/shielded_token/src/storage_key.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ pub const MASP_TOKEN_MAP_KEY: &str = "tokens";
2323
pub const MASP_ASSETS_HASH_KEY: &str = "assets_hash";
2424
/// Last calculated inflation value handed out
2525
pub const MASP_LAST_INFLATION_KEY: &str = "last_inflation";
26-
/// The last locked ratio
27-
pub const MASP_LAST_LOCKED_AMOUNT_KEY: &str = "last_locked_ratio";
26+
/// The last locked amount
27+
pub const MASP_LAST_LOCKED_AMOUNT_KEY: &str = "last_locked_amount";
2828
/// The key for the nominal proportional gain of a shielded pool for a given
2929
/// asset
3030
pub const MASP_KP_GAIN_KEY: &str = "proportional_gain";
3131
/// The key for the nominal derivative gain of a shielded pool for a given asset
3232
pub const MASP_KD_GAIN_KEY: &str = "derivative_gain";
33-
/// The key for the locked ratio target for a given asset
34-
pub const MASP_LOCKED_AMOUNT_TARGET_KEY: &str = "locked_ratio_target";
33+
/// The key for the locked amount target for a given asset
34+
pub const MASP_LOCKED_AMOUNT_TARGET_KEY: &str = "locked_amount_target";
3535
/// The key for the max reward rate for a given asset
3636
pub const MASP_MAX_REWARD_RATE_KEY: &str = "max_reward_rate";
3737

@@ -51,13 +51,13 @@ pub fn masp_max_reward_rate_key(token_addr: &Address) -> storage::Key {
5151
.with_segment(MASP_MAX_REWARD_RATE_KEY.to_owned())
5252
}
5353

54-
/// Obtain the locked target ratio key for the given token
54+
/// Obtain the locked target amount key for the given token
5555
pub fn masp_locked_amount_target_key(token_addr: &Address) -> storage::Key {
5656
parameter_prefix(token_addr)
5757
.with_segment(MASP_LOCKED_AMOUNT_TARGET_KEY.to_owned())
5858
}
5959

60-
/// Obtain the storage key for the last locked ratio of a token
60+
/// Obtain the storage key for the last locked amount of a token
6161
pub fn masp_last_locked_amount_key(token_address: &Address) -> storage::Key {
6262
parameter_prefix(token_address)
6363
.with_segment(MASP_LAST_LOCKED_AMOUNT_KEY.to_owned())

0 commit comments

Comments
 (0)