Skip to content

Commit

Permalink
Add mana_bits_exponent field (#1128)
Browse files Browse the repository at this point in the history
* Add mana_bits_exponent field

* Apply suggestions from code review

Co-authored-by: Thibault Martinez <[email protected]>

* Update expected values

---------

Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
Thoralf-M and thibault-martinez authored Sep 5, 2023
1 parent a829d06 commit 7329c4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bindings/nodejs/lib/types/models/info/node-info-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export interface ProtocolParameters {
* The number of slots in an epoch expressed as an exponent of 2.
*/
slotsPerEpochExponent: number;
/**
* The number of bits used to represent Mana expressed as an exponent of 2.
*/
manaBitsExponent: number;
/**
* The amount of potential Mana generated by 1 IOTA in 1 slot.
*/
Expand Down
3 changes: 3 additions & 0 deletions sdk/src/types/block/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub struct ProtocolParameters {
pub(crate) slot_duration_in_seconds: u8,
/// The number of slots in an epoch expressed as an exponent of 2.
pub(crate) slots_per_epoch_exponent: u8,
/// The number of bits used to represent Mana expressed as an exponent of 2.
pub(crate) mana_bits_exponent: u8,
/// The amount of potential Mana generated by 1 IOTA in 1 slot.
pub(crate) mana_generation_rate: u8,
/// The scaling of `mana_generation_rate` expressed as an exponent of 2.
Expand Down Expand Up @@ -105,6 +107,7 @@ impl Default for ProtocolParameters {
slot_duration_in_seconds: 10,
epoch_nearing_threshold: 20.into(),
slots_per_epoch_exponent: Default::default(),
mana_bits_exponent: Default::default(),
mana_generation_rate: Default::default(),
mana_generation_rate_exponent: Default::default(),
mana_decay_factors: Default::default(),
Expand Down
4 changes: 2 additions & 2 deletions sdk/tests/types/block_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ fn compute() {
// TODO: Independently verify this value
assert_eq!(
block_id.to_string(),
"0xf0bd00c717f4a11d3a6381c4c06954b873c7bf1052a0b10465d04ba2de38bd420b00000000000000"
"0x8840fd83fcbc58dfcc6b6e63d3cf8f42694197b77ad7e244c3327af3b6cdd9780b00000000000000"
);
assert_eq!(
block_id.hash().to_string(),
"0xf0bd00c717f4a11d3a6381c4c06954b873c7bf1052a0b10465d04ba2de38bd42"
"0x8840fd83fcbc58dfcc6b6e63d3cf8f42694197b77ad7e244c3327af3b6cdd978"
);
assert_eq!(block_id.slot_index(), slot_index);
}

0 comments on commit 7329c4b

Please sign in to comment.