Skip to content

Commit

Permalink
fix(consensus): use Duration for max base time
Browse files Browse the repository at this point in the history
  • Loading branch information
therealdannzor committed Jul 29, 2024
1 parent e4dad49 commit 9220cdc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct ConsensusConstants {
pub committee_size: u32,
pub max_base_layer_blocks_ahead: u64,
pub max_base_layer_blocks_behind: u64,
pub pacemaker_max_base_time: u64, // GST in seconds for consensus
pub pacemaker_max_base_time: std::time::Duration,
}

impl ConsensusConstants {
Expand All @@ -36,7 +36,7 @@ impl ConsensusConstants {
committee_size: 7,
max_base_layer_blocks_ahead: 5,
max_base_layer_blocks_behind: 5,
pacemaker_max_base_time: 10,
pacemaker_max_base_time: std::time::Duration::from_secs(10),
}
}
}
2 changes: 1 addition & 1 deletion dan_layer/consensus/src/hotstuff/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
pub struct HotstuffConfig {
pub max_base_layer_blocks_ahead: u64,
pub max_base_layer_blocks_behind: u64,
pub pacemaker_max_base_time: u64,
pub pacemaker_max_base_time: std::time::Duration,
}
4 changes: 2 additions & 2 deletions dan_layer/consensus/src/hotstuff/pacemaker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct PaceMaker {
}

impl PaceMaker {
pub fn new(max_base_time: u64) -> Self {
pub fn new(max_base_time: Duration) -> Self {
let (sender, receiver) = mpsc::channel(100);

let on_beat = OnBeat::new();
Expand All @@ -50,7 +50,7 @@ impl PaceMaker {
),
current_view: current_height,
current_high_qc_height: NodeHeight(0),
block_time: Duration::from_secs(max_base_time),
block_time: max_base_time,
}
}

Expand Down

0 comments on commit 9220cdc

Please sign in to comment.