Skip to content

Commit

Permalink
[review] address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
akichidis committed Dec 19, 2024
1 parent bf7e7f4 commit a9b2f85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion consensus/core/src/commit_observer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ impl CommitObserver {
) -> Self {
let mut observer = Self {
commit_interpreter: Linearizer::new(
context.clone(),
dag_state.clone(),
leader_schedule.clone(),
context.clone(),
),
context,
sender: commit_consumer.commit_sender,
Expand Down
16 changes: 8 additions & 8 deletions consensus/core/src/linearizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ impl BlockStoreAPI
#[derive(Clone)]
pub(crate) struct Linearizer {
/// In memory block store representing the dag state
context: Arc<Context>,
dag_state: Arc<RwLock<DagState>>,
leader_schedule: Arc<LeaderSchedule>,
context: Arc<Context>,
}

impl Linearizer {
pub(crate) fn new(
context: Arc<Context>,
dag_state: Arc<RwLock<DagState>>,
leader_schedule: Arc<LeaderSchedule>,
context: Arc<Context>,
) -> Self {
Self {
dag_state,
Expand Down Expand Up @@ -325,7 +325,7 @@ mod tests {
context.clone(),
LeaderSwapTable::default(),
));
let mut linearizer = Linearizer::new(dag_state.clone(), leader_schedule, context.clone());
let mut linearizer = Linearizer::new(context.clone(), dag_state.clone(), leader_schedule);

// Populate fully connected test blocks for round 0 ~ 10, authorities 0 ~ 3.
let num_rounds: u32 = 10;
Expand Down Expand Up @@ -376,7 +376,7 @@ mod tests {
.with_num_commits_per_schedule(NUM_OF_COMMITS_PER_SCHEDULE),
);
let mut linearizer =
Linearizer::new(dag_state.clone(), leader_schedule.clone(), context.clone());
Linearizer::new(context.clone(), dag_state.clone(), leader_schedule.clone());

// Populate fully connected test blocks for round 0 ~ 20, authorities 0 ~ 3.
let num_rounds: u32 = 20;
Expand Down Expand Up @@ -446,7 +446,7 @@ mod tests {
.with_num_commits_per_schedule(NUM_OF_COMMITS_PER_SCHEDULE),
);
let mut linearizer =
Linearizer::new(dag_state.clone(), leader_schedule.clone(), context.clone());
Linearizer::new(context.clone(), dag_state.clone(), leader_schedule.clone());

// Populate fully connected test blocks for round 0 ~ 20, authorities 0 ~ 3.
let num_rounds: u32 = 20;
Expand Down Expand Up @@ -514,7 +514,7 @@ mod tests {
LeaderSwapTable::default(),
));
let mut linearizer =
Linearizer::new(dag_state.clone(), leader_schedule.clone(), context.clone());
Linearizer::new(context.clone(), dag_state.clone(), leader_schedule.clone());
let wave_length = DEFAULT_WAVE_LENGTH;

let leader_round_wave_1 = 3;
Expand Down Expand Up @@ -633,7 +633,7 @@ mod tests {
context.clone(),
LeaderSwapTable::default(),
));
let mut linearizer = Linearizer::new(dag_state.clone(), leader_schedule, context.clone());
let mut linearizer = Linearizer::new(context.clone(), dag_state.clone(), leader_schedule);

// Authorities of index 0->2 will always creates blocks that see each other, but until round 5 they won't see the blocks of authority 3.
// For authority 3 we create blocks that connect to all the other authorities.
Expand Down Expand Up @@ -747,7 +747,7 @@ mod tests {
context.clone(),
LeaderSwapTable::default(),
));
let mut linearizer = Linearizer::new(dag_state.clone(), leader_schedule, context.clone());
let mut linearizer = Linearizer::new(context.clone(), dag_state.clone(), leader_schedule);

// Authority D will create an "orphaned" block on round 1 as it won't reference to it on the block of round 2. Similar, no other authority will reference to it on round 2.
// Then on round 3 the authorities A, B & C will link to block D1. Once the DAG gets committed we should see the block D1 getting committed as well. Normally ,as block D2 would
Expand Down

0 comments on commit a9b2f85

Please sign in to comment.