From 0b7f6ae4c35f4bae2deb99b7e1b93429ea7ea62c Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Tue, 7 Nov 2023 20:25:41 +0100 Subject: [PATCH] Some protocol parameter fixes (#1594) --- sdk/src/types/block/protocol.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sdk/src/types/block/protocol.rs b/sdk/src/types/block/protocol.rs index 56c73ac7bc..b52242dc92 100644 --- a/sdk/src/types/block/protocol.rs +++ b/sdk/src/types/block/protocol.rs @@ -41,6 +41,9 @@ pub struct ProtocolParameters { pub(crate) rent_structure: RentStructure, /// The work score parameters used by the node/network. pub(crate) work_score_parameters: WorkScoreParameters, + /// The parameters used for mana calculations. + #[getset(skip)] + pub(crate) mana_parameters: ManaParameters, /// TokenSupply defines the current token supply on the network. #[cfg_attr(feature = "serde", serde(with = "crate::utils::serde::string"))] pub(crate) token_supply: u64, @@ -51,18 +54,16 @@ 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 parameters used for mana calculations. - #[getset(skip)] - pub(crate) mana_parameters: ManaParameters, /// The unbonding period in epochs before an account can stop staking. pub(crate) staking_unbonding_period: u32, /// The number of validation blocks that each validator should issue each slot. - pub(crate) validation_blocks_per_slot: u16, + pub(crate) validation_blocks_per_slot: u8, /// The number of epochs worth of Mana that a node is punished with for each additional validation block it issues. pub(crate) punishment_epochs: u32, - /// Liveness Threshold is used by tip-selection to determine if a block is eligible by evaluating issuingTimes and - /// commitments in its past-cone to Accepted Tangle Time and lastCommittedSlot respectively. - pub(crate) liveness_threshold: u32, + /// Used by tip-selection to determine if a block is eligible by evaluating issuing times. + pub(crate) liveness_threshold_lower_bound: u16, + /// Used by tip-selection to determine if a block is eligible by evaluating issuing times + pub(crate) liveness_threshold_upper_bound: u16, /// Minimum age relative to the accepted tangle time slot index that a slot can be committed. pub(crate) min_committable_age: u32, /// Maximum age for a slot commitment to be included in a block relative to the slot index of the block issuing @@ -105,7 +106,8 @@ impl Default for ProtocolParameters { staking_unbonding_period: 10, validation_blocks_per_slot: 10, punishment_epochs: 9, - liveness_threshold: 5, + liveness_threshold_lower_bound: 15, + liveness_threshold_upper_bound: 30, min_committable_age: 10, max_committable_age: 20, congestion_control_parameters: Default::default(),