Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ManaParameters::annual_decay_factor_percentage #1755

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions sdk/src/types/block/mana/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ use crate::types::block::{
pub struct ManaParameters {
/// The number of bits used to represent Mana.
pub(crate) bits_count: u8,
/// The amount of potential Mana generated by 1 IOTA in 1 slot.
/// The amount of potential Mana generated by 1 microIOTA in 1 slot multiplied by 2^generation_rate_exponent.
pub(crate) generation_rate: u8,
/// The scaling of `mana_generation_rate` expressed as an exponent of 2.
/// The scaling of `generation_rate` expressed as an exponent of 2.
/// The actual generation rate of Mana is given by generation_rate * 2^(-generation_rate_exponent).
Alex6323 marked this conversation as resolved.
Show resolved Hide resolved
pub(crate) generation_rate_exponent: u8,
/// A lookup table of epoch index diff to mana decay factor.
/// The actual decay factor is given by decay_factors[epoch_diff] * 2^(-decay_factors_exponent).
Alex6323 marked this conversation as resolved.
Show resolved Hide resolved
#[packable(unpack_error_with = |_| Error::InvalidManaDecayFactors)]
#[cfg_attr(feature = "serde", serde(with = "crate::utils::serde::boxed_slice_prefix"))]
#[getset(skip)]
Expand All @@ -34,8 +36,10 @@ pub struct ManaParameters {
pub(crate) decay_factors_exponent: u8,
/// An integer approximation of the sum of decay over epochs.
pub(crate) decay_factor_epochs_sum: u32,
/// The scaling of `mana_decay_factor_epochs_sum` expressed as an exponent of 2.
/// The scaling of `decay_factor_epochs_sum` expressed as an exponent of 2.
pub(crate) decay_factor_epochs_sum_exponent: u8,
// Decay factor for 1 year.
pub(crate) annual_decay_factor_percentage: u8,
}

impl ManaParameters {
Expand Down Expand Up @@ -99,6 +103,7 @@ impl Default for ManaParameters {
decay_factors_exponent: Default::default(),
decay_factor_epochs_sum: Default::default(),
decay_factor_epochs_sum_exponent: Default::default(),
annual_decay_factor_percentage: Default::default(),
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion sdk/src/types/block/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ pub struct ProtocolParameters {
/// Defines the target size of the committee. If there's fewer candidates the actual committee size could be
/// smaller in a given epoch.
pub(crate) target_committee_size: u8,
/// Defines the number of heavier slots that a chain needs to be ahead of the current chain to be considered for switching.
/// Defines the number of heavier slots that a chain needs to be ahead of the current chain to be considered for
/// switching.
pub(crate) chain_switching_threshold: u8,
}

Expand Down
Loading