Skip to content

Commit

Permalink
refactor: introduce name for magic constant
Browse files Browse the repository at this point in the history
  • Loading branch information
karbyshev committed Jul 10, 2023
1 parent 363aa47 commit c7dab48
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions proof_of_stake/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ use crate::parameters::PosParams;
// core::types::token::NATIVE_MAX_DECIMAL_PLACES??
const U64_MAX: u64 = u64::MAX;

/// Number of epochs below the current epoch for which validator deltas and
/// slashes are stored
const VALIDATOR_DELTAS_SLASHES_LEN: u64 = 23;

// TODO: add this to the spec
/// Stored positions of validators in validator sets
pub type ValidatorSetPositions = crate::epoched::NestedEpoched<
Expand Down Expand Up @@ -129,14 +133,14 @@ pub type TotalConsensusStakes =
pub type ValidatorDeltas = crate::epoched::EpochedDelta<
token::Change,
crate::epoched::OffsetUnbondingLen,
23,
VALIDATOR_DELTAS_SLASHES_LEN,
>;

/// Epoched total deltas.
pub type TotalDeltas = crate::epoched::EpochedDelta<
token::Change,
crate::epoched::OffsetUnbondingLen,
23,
VALIDATOR_DELTAS_SLASHES_LEN,
>;

/// Epoched validator commission rate
Expand Down Expand Up @@ -168,7 +172,7 @@ pub type ValidatorSlashes = NestedMap<Address, Slashes>;
pub type EpochedSlashes = crate::epoched::NestedEpoched<
ValidatorSlashes,
crate::epoched::OffsetUnbondingLen,
23,
VALIDATOR_DELTAS_SLASHES_LEN,
>;

/// Epoched validator's unbonds
Expand Down

0 comments on commit c7dab48

Please sign in to comment.