Skip to content

Commit

Permalink
resolve clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Dec 8, 2023
1 parent c14bec8 commit 8607922
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 8 additions & 2 deletions proof_of_stake/src/slashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ where
Ok(())
}

/// Computes how many tokens will be slashed from a redelegated bond,
/// considering that the bond may have been completely or partially unbonded and
/// that the source validator may have misbehaved within the redelegation
/// slashing window.
#[allow(clippy::too_many_arguments)]
pub fn slash_redelegation<S>(
storage: &S,
Expand Down Expand Up @@ -1004,6 +1008,8 @@ pub fn get_slashed_amount(
Ok(final_amount)
}

/// Compute the total amount of tokens from a set of unbonds, both redelegated
/// and not, after applying slashes. Used in `unbond_tokens`.
// `def computeAmountAfterSlashingUnbond`
pub fn compute_amount_after_slashing_unbond<S>(
storage: &S,
Expand Down Expand Up @@ -1057,8 +1063,8 @@ where
Ok(result_slashing)
}

/// Compute from a set of unbonds (both redelegated and not) how much is left
/// after applying all relevant slashes.
/// Compute the total amount of tokens from a set of unbonds, both redelegated
/// and not, after applying slashes. Used in `withdraw_tokens`.
// `def computeAmountAfterSlashingWithdraw`
pub fn compute_amount_after_slashing_withdraw<S>(
storage: &S,
Expand Down
4 changes: 2 additions & 2 deletions proof_of_stake/src/tests/test_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use namada_core::types::dec::Dec;
use namada_core::types::key::testing::{
arb_common_keypair, common_sk_from_simple_seed,
};
use namada_core::types::key::{self, common, RefTo, SecretKey};
use namada_core::types::key::{self, common, RefTo};
use namada_core::types::storage::Epoch;
use namada_core::types::token;
use proptest::prelude::*;
Expand Down Expand Up @@ -619,7 +619,7 @@ fn test_validator_sets() {
// val1 will go below 1 NAM, which is the validator_stake_threshold, so it
// will enter the below-threshold validator set.
let unbond = token::Amount::from_uint(500_000, 0).unwrap();
let stake1 = stake1 - unbond;
// let stake1 = stake1 - unbond;

// Because `update_validator_set` and `update_validator_deltas` are
// effective from pipeline offset, we use pipeline epoch for the rest of the
Expand Down
3 changes: 3 additions & 0 deletions proof_of_stake/src/validator_set_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ where
}))
}

/// Inserts a validator into the provided `handle` within some validator set at
/// the next position. Also updates the validator set position for the
/// validator.
pub fn insert_validator_into_set<S>(
handle: &ValidatorPositionAddresses,
storage: &mut S,
Expand Down

0 comments on commit 8607922

Please sign in to comment.