Skip to content

Commit

Permalink
make() -> new()
Browse files Browse the repository at this point in the history
  • Loading branch information
moshababo committed Nov 21, 2023
1 parent ef8cc5f commit 2f2eff6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions node/actors/bft/src/tests/unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ use zksync_consensus_roles::validator::{
///
#[tokio::test]
async fn replica_prepare_sanity() {
let mut util = Util::make().await;
let mut util = Util::new().await;

let replica_prepare = util.make_replica_prepare(None::<fn(&mut ReplicaPrepare)>);
let res = util.dispatch_replica_prepare(replica_prepare);
Expand All @@ -79,7 +79,7 @@ async fn replica_prepare_sanity() {

#[tokio::test]
async fn replica_prepare_sanity_yield_leader_prepare() {
let mut util = Util::make().await;
let mut util = Util::new().await;

let replica_prepare = util.make_replica_prepare(None::<fn(&mut ReplicaPrepare)>);
let res = util.dispatch_replica_prepare(replica_prepare);
Expand All @@ -89,7 +89,7 @@ async fn replica_prepare_sanity_yield_leader_prepare() {

#[tokio::test]
async fn replica_prepare_old_view() {
let mut util = Util::make().await;
let mut util = Util::new().await;

util.set_replica_view(ViewNumber(1));
util.set_leader_view(ViewNumber(2));
Expand All @@ -109,7 +109,7 @@ async fn replica_prepare_old_view() {

#[tokio::test]
async fn replica_prepare_during_commit() {
let mut util = Util::make().await;
let mut util = Util::new().await;

util.set_leader_phase(Phase::Commit);

Expand All @@ -127,7 +127,7 @@ async fn replica_prepare_during_commit() {

#[tokio::test]
async fn replica_prepare_already_exists() {
let mut util = Util::make_with(2).await;
let mut util = Util::new_with(2).await;

let view = ViewNumber(2);
util.set_replica_view(view);
Expand Down Expand Up @@ -156,7 +156,7 @@ async fn replica_prepare_already_exists() {

#[tokio::test]
async fn replica_prepare_num_received_below_threshold() {
let mut util = Util::make_with(2).await;
let mut util = Util::new_with(2).await;

let view = ViewNumber(2);
util.set_replica_view(view);
Expand All @@ -176,7 +176,7 @@ async fn replica_prepare_num_received_below_threshold() {

#[tokio::test]
async fn leader_prepare_sanity() {
let mut util = Util::make().await;
let mut util = Util::new().await;

let replica_prepare = util.make_replica_prepare(None::<fn(&mut ReplicaPrepare)>);
let res = util.dispatch_replica_prepare(replica_prepare);
Expand All @@ -189,7 +189,7 @@ async fn leader_prepare_sanity() {

#[tokio::test]
async fn leader_prepare_invalid_leader() {
let mut util = Util::make_with(2).await;
let mut util = Util::new_with(2).await;

let view = ViewNumber(2);
util.set_replica_view(view);
Expand Down Expand Up @@ -233,7 +233,7 @@ async fn leader_prepare_invalid_leader() {

#[tokio::test]
async fn leader_prepare_invalid_sig() {
let mut util = Util::make().await;
let mut util = Util::new().await;

let mut leader_prepare = util.make_leader_prepare(None::<fn(&mut LeaderPrepare)>);
leader_prepare.sig = util.rng().gen();
Expand All @@ -249,7 +249,7 @@ async fn leader_prepare_invalid_sig() {

#[tokio::test]
async fn leader_prepare_invalid_prepare_qc_different_views() {
let mut util = Util::make().await;
let mut util = Util::new().await;

let replica_prepare = util.make_replica_prepare(None::<fn(&mut ReplicaPrepare)>);
let res = util.dispatch_replica_prepare(replica_prepare.clone());
Expand Down Expand Up @@ -328,11 +328,11 @@ mod util {
}

impl Util {
pub async fn make() -> Util {
Util::make_with(1).await
pub async fn new() -> Util {
Util::new_with(1).await
}

pub async fn make_with(num_validators: i32) -> Util {
pub async fn new_with(num_validators: i32) -> Util {
let ctx = ctx::test_root(&ctx::RealClock);
let mut rng = StdRng::seed_from_u64(6516565651);
let keys: Vec<_> = (0..num_validators).map(|_| rng.gen()).collect();
Expand Down

0 comments on commit 2f2eff6

Please sign in to comment.