Skip to content

Commit

Permalink
remove double view update from sync task
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeiannucci committed Aug 2, 2024
1 parent 1fb132e commit 8211189
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
6 changes: 0 additions & 6 deletions crates/task-impls/src/view_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,6 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>> ViewSyncReplicaTaskState<TYP
*self.next_view
);

broadcast_event(
Arc::new(HotShotEvent::ViewChange(self.next_view - 1)),
&event_stream,
)
.await;

broadcast_event(
Arc::new(HotShotEvent::ViewChange(self.next_view)),
&event_stream,
Expand Down
40 changes: 38 additions & 2 deletions crates/testing/tests/tests_1/test_with_failures_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#![allow(unused_imports)]

use hotshot_example_types::{
node_types::{Libp2pImpl, MemoryImpl, PushCdnImpl},
state_types::TestTypes,
node_types::{Libp2pImpl, MemoryImpl, PushCdnImpl, TestConsecutiveLeaderTypes},
state_types::TestTypes
};
use hotshot_macros::cross_tests;
use hotshot_testing::{
Expand Down Expand Up @@ -52,3 +52,39 @@ cross_tests!(
metadata
}
);

#[cfg(not(feature = "dependency-tasks"))]
cross_tests!(
TestName: test_with_double_leader_failures,
Impls: [MemoryImpl, Libp2pImpl, PushCdnImpl],
// this lets a node be a leader two views in a row
Types: [TestConsecutiveLeaderTypes],
Ignore: false,
Metadata: {
let mut metadata = TestDescription::default_more_nodes();
metadata.num_bootstrap_nodes = 10;
metadata.num_nodes_with_stake = 12;
metadata.da_staked_committee_size = 12;
metadata.start_nodes = 12;
let dead_nodes = vec![
ChangeNode {
idx: 3,
updown: UpDown::Down,
},
];

// shutdown while node 3 is leader
// we want to trigger `ViewSyncTrigger`
// then ensure we do not fail again as next leader will be leader 2 views also
metadata.spinning_properties = SpinningTaskDescription {
node_changes: vec![(5, dead_nodes)]
};

// node 3 is leader twice when we shut down
metadata.overall_safety_properties.num_failed_views = 2;
// Make sure we keep committing rounds after the bad leaders, but not the full 50 because of the numerous timeouts
metadata.overall_safety_properties.num_successful_views = 13;

metadata
}
);

0 comments on commit 8211189

Please sign in to comment.