Skip to content

Commit

Permalink
Merge branch 'anca/vote_height' into anca/one_round_state
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Nov 14, 2023
2 parents 176eca9 + 14c5b28 commit d1480a0
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions Code/test/tests/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ fn driver_steps_proposer() {
#[test]
fn driver_steps_not_proposer_valid() {
let value = Value::new(9999);
let value_id = value.id();

let sel = RotateProposer::default();
let env = TestEnv::new(move |_, _| Some(value));
Expand Down Expand Up @@ -320,7 +319,7 @@ fn driver_steps_not_proposer_valid() {
desc: "Receive a proposal, prevote for it (v2)",
input_event: Some(Event::Proposal(proposal.clone(), Validity::Valid)),
expected_output: Some(Message::Vote(
Vote::new_prevote(Height::new(1), Round::new(0), Some(value_id), my_addr)
Vote::new_prevote(Height::new(1), Round::new(0), Some(value.id()), my_addr)
.signed(&my_sk),
)),
expected_round: Round::new(0),
Expand Down Expand Up @@ -350,7 +349,7 @@ fn driver_steps_not_proposer_valid() {
TestStep {
desc: "v1 prevotes for its own proposal",
input_event: Some(Event::Vote(
Vote::new_prevote(Height::new(1), Round::new(0), Some(value_id), addr1)
Vote::new_prevote(Height::new(1), Round::new(0), Some(value.id()), addr1)
.signed(&sk1),
)),
expected_output: None,
Expand All @@ -367,11 +366,11 @@ fn driver_steps_not_proposer_valid() {
TestStep {
desc: "v3 prevotes for v1's proposal, it gets +2/3 prevotes, precommit for it (v2)",
input_event: Some(Event::Vote(
Vote::new_prevote(Height::new(1), Round::new(0), Some(value_id), addr3)
Vote::new_prevote(Height::new(1), Round::new(0), Some(value.id()), addr3)
.signed(&sk3),
)),
expected_output: Some(Message::Vote(
Vote::new_precommit(Height::new(1), Round::new(0), Some(value_id), my_addr)
Vote::new_precommit(Height::new(1), Round::new(0), Some(value.id()), my_addr)
.signed(&my_sk),
)),
expected_round: Round::new(0),
Expand Down Expand Up @@ -413,7 +412,7 @@ fn driver_steps_not_proposer_valid() {
TestStep {
desc: "v1 precommits its proposal",
input_event: Some(Event::Vote(
Vote::new_precommit(Height::new(1), Round::new(0), Some(value_id), addr1)
Vote::new_precommit(Height::new(1), Round::new(0), Some(value.id()), addr1)
.signed(&sk1),
)),
expected_output: None,
Expand All @@ -436,7 +435,7 @@ fn driver_steps_not_proposer_valid() {
TestStep {
desc: "v3 precommits for v1's proposal, it gets +2/3 precommits, decide it",
input_event: Some(Event::Vote(
Vote::new_precommit(Height::new(1), Round::new(0), Some(value_id), addr3)
Vote::new_precommit(Height::new(1), Round::new(0), Some(value.id()), addr3)
.signed(&sk3),
)),
expected_output: Some(Message::Decide(Round::new(0), value)),
Expand Down Expand Up @@ -484,7 +483,6 @@ fn driver_steps_not_proposer_valid() {
#[test]
fn driver_steps_not_proposer_invalid() {
let value = Value::new(9999);
let value_id = value.id();

let sel = RotateProposer::default();
let env = TestEnv::new(move |_, _| Some(value));
Expand Down Expand Up @@ -561,7 +559,7 @@ fn driver_steps_not_proposer_invalid() {
TestStep {
desc: "v1 prevotes for its own proposal",
input_event: Some(Event::Vote(
Vote::new_prevote(Height::new(1), Round::new(0), Some(value_id), addr1).signed(&sk1),
Vote::new_prevote(Height::new(1), Round::new(0), Some(value.id()), addr1).signed(&sk1),
)),
expected_output: None,
expected_round: Round::new(0),
Expand All @@ -577,7 +575,7 @@ fn driver_steps_not_proposer_invalid() {
TestStep {
desc: "v3 prevotes for v1's proposal, we have polka for any, schedule prevote timeout (v2)",
input_event: Some(Event::Vote(
Vote::new_prevote(Height::new(1), Round::new(0), Some(value_id), addr3).signed(&sk3),
Vote::new_prevote(Height::new(1), Round::new(0), Some(value.id()), addr3).signed(&sk3),
)),
expected_output: Some(Message::ScheduleTimeout(Timeout::prevote(Round::new(0)))),
expected_round: Round::new(0),
Expand Down Expand Up @@ -634,7 +632,6 @@ fn driver_steps_not_proposer_invalid() {
#[test]
fn driver_steps_not_proposer_timeout_multiple_rounds() {
let value = Value::new(9999);
let value_id = value.id();

let sel = RotateProposer::default();
let env = TestEnv::new(move |_, _| Some(value));
Expand Down Expand Up @@ -713,7 +710,7 @@ fn driver_steps_not_proposer_timeout_multiple_rounds() {
TestStep {
desc: "v1 prevotes for its own proposal",
input_event: Some(Event::Vote(
Vote::new_prevote(Height::new(1), Round::new(0), Some(value_id), addr1)
Vote::new_prevote(Height::new(1), Round::new(0), Some(value.id()), addr1)
.signed(&sk1),
)),
expected_output: None,
Expand Down Expand Up @@ -765,7 +762,7 @@ fn driver_steps_not_proposer_timeout_multiple_rounds() {
TestStep {
desc: "v1 precommits its proposal",
input_event: Some(Event::Vote(
Vote::new_precommit(Height::new(1), Round::new(0), Some(value_id), addr1)
Vote::new_precommit(Height::new(1), Round::new(0), Some(value.id()), addr1)
.signed(&sk1),
)),
expected_output: None,
Expand Down

0 comments on commit d1480a0

Please sign in to comment.