Skip to content

Commit

Permalink
update tingz
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Apr 3, 2024
1 parent 88e33f8 commit ad5e8ca
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 25 deletions.
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.

4 changes: 2 additions & 2 deletions crates/controller/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use namada_core::types::dec::Dec;
use namada_core::types::uint::Uint;
use namada_core::dec::Dec;
use namada_core::uint::Uint;

#[derive(Clone, Debug)]
pub struct PDController {
Expand Down
32 changes: 16 additions & 16 deletions crates/proof_of_stake/src/rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use crate::storage::{
validator_state_handle, write_last_pos_inflation_amount,
write_last_staked_ratio,
};
use crate::token::credit_tokens;
use crate::token::storage_key::minted_balance_key;
use crate::token::{credit_tokens, inflation};
use crate::types::{into_tm_voting_power, BondId, ValidatorState, VoteInfo};
use crate::{
bond_amounts_for_rewards, get_total_consensus_stake, staking_token_address,
Expand Down Expand Up @@ -385,13 +385,13 @@ where
num_blocks_in_last_epoch,
inflation,
&staking_token,
total_tokens,
total_amount,
)?;

// Write new rewards parameters that will be used for the inflation of
// the current new epoch
let locked_amount = Dec::try_from(locked_amount).into_storage_result()?;
let total_amount = Dec::try_from(total_amount).into_storage_result()?;
let locked_amount = Dec::from(locked_amount);
let total_amount = Dec::from(total_amount);
let locked_ratio = locked_amount / total_amount;

write_last_staked_ratio(storage, locked_ratio)?;
Expand Down Expand Up @@ -648,8 +648,8 @@ mod tests {
Dec::from_str("0.5").unwrap(),
)
.unwrap();
let locked_ratio_0 = Dec::try_from(locked_amount).unwrap()
/ Dec::try_from(total_native_amount).unwrap();
let locked_ratio_0 =
Dec::from(locked_amount) / Dec::from(total_native_amount);

println!(
"Round 0: Locked ratio: {locked_ratio_0}, inflation: {inflation_0}"
Expand All @@ -676,8 +676,8 @@ mod tests {

// BUG: DIDN'T ADD TO TOTAL AMOUNT

let locked_ratio_1 = Dec::try_from(locked_amount).unwrap()
/ Dec::try_from(total_native_amount).unwrap();
let locked_ratio_1 =
Dec::from(locked_amount) / Dec::from(total_native_amount);

println!(
"Round 1: Locked ratio: {locked_ratio_1}, inflation: {inflation_1}"
Expand All @@ -704,8 +704,8 @@ mod tests {
)
.unwrap();

let locked_ratio_2 = Dec::try_from(locked_amount).unwrap()
/ Dec::try_from(total_native_amount).unwrap();
let locked_ratio_2 =
Dec::from(locked_amount) / Dec::from(total_native_amount);
println!(
"Round 2: Locked ratio: {locked_ratio_2}, inflation: {inflation_2}",
);
Expand Down Expand Up @@ -738,8 +738,8 @@ mod tests {
Dec::from_str("0.9").unwrap(),
)
.unwrap();
let locked_ratio_0 = Dec::try_from(locked_amount).unwrap()
/ Dec::try_from(total_native_amount).unwrap();
let locked_ratio_0 =
Dec::from(locked_amount) / Dec::from(total_native_amount);

println!(
"Round 0: Locked ratio: {locked_ratio_0}, inflation: {inflation_0}"
Expand All @@ -766,8 +766,8 @@ mod tests {

// BUG: DIDN'T ADD TO TOTAL AMOUNT

let locked_ratio_1 = Dec::try_from(locked_amount).unwrap()
/ Dec::try_from(total_native_amount).unwrap();
let locked_ratio_1 =
Dec::from(locked_amount) / Dec::from(total_native_amount);

println!(
"Round 1: Locked ratio: {locked_ratio_1}, inflation: {inflation_1}"
Expand All @@ -794,8 +794,8 @@ mod tests {
)
.unwrap();

let locked_ratio_2 = Dec::try_from(locked_amount).unwrap()
/ Dec::try_from(total_native_amount).unwrap();
let locked_ratio_2 =
Dec::from(locked_amount) / Dec::from(total_native_amount);
println!(
"Round 2: Locked ratio: {locked_ratio_2}, inflation: {inflation_2}",
);
Expand Down
3 changes: 0 additions & 3 deletions crates/shielded_token/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ use namada_core::hash::Hash;
use namada_core::uint::Uint;
use namada_parameters as parameters;
use namada_storage::{StorageRead, StorageWrite};
use namada_trans_token::inflation::{
ShieldedRewardsController, ShieldedValsToUpdate,
};
use namada_trans_token::storage_key::{balance_key, minted_balance_key};
use namada_trans_token::{read_denom, Amount, DenominatedAmount, Denomination};

Expand Down
1 change: 0 additions & 1 deletion crates/trans_token/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Transparent token types, storage functions, and validation.
pub mod inflation;
mod storage;
pub mod storage_key;

Expand Down
2 changes: 1 addition & 1 deletion wasm/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 wasm_for_tests/wasm_source/Cargo.lock

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

0 comments on commit ad5e8ca

Please sign in to comment.