Skip to content

Commit

Permalink
Add validationBlocksPerSlot to ProtocolParameters (#1189)
Browse files Browse the repository at this point in the history
* Add validationBlocksPerSlot to ProtocolParameters

* Fix block ID test
  • Loading branch information
thibault-martinez authored Sep 11, 2023
1 parent aa0d554 commit e0af5a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions sdk/src/types/block/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub struct ProtocolParameters {
pub(crate) mana_structure: ManaStructure,
/// The unbonding period in epochs before an account can stop staking.
pub(crate) staking_unbonding_period: EpochIndex,
/// The number of validation blocks that each validator should issue each slot.
pub(crate) validation_blocks_per_slot: u16,
/// The slot index used by tip-selection to determine if a block is eligible by evaluating issuing times
/// and commitments in its past-cone against accepted tangle time and last committed slot respectively.
pub(crate) liveness_threshold: SlotIndex,
Expand Down Expand Up @@ -93,6 +95,7 @@ impl Default for ProtocolParameters {
slots_per_epoch_exponent: Default::default(),
mana_structure: Default::default(),
staking_unbonding_period: 10.into(),
validation_blocks_per_slot: 10,
liveness_threshold: 5.into(),
min_committable_age: 10.into(),
max_committable_age: 20.into(),
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(),
"0x5e3d8befccbd36860a589cf9427efa108bcc781f630ebfdf6f57cef7eed8b5bb0b00000000000000"
"0x7ac622307277e700e4161d805d22dfb03f89904657a6353f985bd6e78ed267550b00000000000000"
);
assert_eq!(
block_id.hash().to_string(),
"0x5e3d8befccbd36860a589cf9427efa108bcc781f630ebfdf6f57cef7eed8b5bb"
"0x7ac622307277e700e4161d805d22dfb03f89904657a6353f985bd6e78ed26755"
);
assert_eq!(block_id.slot_index(), slot_index);
}

0 comments on commit e0af5a5

Please sign in to comment.