Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
pompon0 committed Dec 4, 2023
1 parent 8529fde commit f13fae3
Show file tree
Hide file tree
Showing 10 changed files with 380 additions and 329 deletions.
1 change: 1 addition & 0 deletions node/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node/actors/bft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ vise.workspace = true
[dev-dependencies]
tokio.workspace = true
assert_matches.workspace = true
pretty_assertions.workspace = true
5 changes: 3 additions & 2 deletions node/actors/bft/src/leader/state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
unreachable,
};
use tracing::instrument;
use zksync_concurrency::{ctx, metrics::LatencyHistogramExt as _, time, error::Wrap as _};
use zksync_concurrency::{ctx, error::Wrap as _, metrics::LatencyHistogramExt as _, time};
use zksync_consensus_roles::validator;

/// The StateMachine struct contains the state of the leader. This is a simple state machine. We just store
Expand Down Expand Up @@ -66,7 +66,8 @@ impl StateMachine {
validator::ConsensusMsg::ReplicaPrepare(_) => {
let res = match self
.process_replica_prepare(ctx, consensus, input.cast().unwrap())
.await.wrap("process_replica_prepare()")
.await
.wrap("process_replica_prepare()")
{
Ok(()) => Ok(()),
Err(super::replica_prepare::Error::Internal(err)) => {
Expand Down
292 changes: 148 additions & 144 deletions node/actors/bft/src/leader/tests.rs

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions node/actors/bft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,13 @@ impl Consensus {
.await
}
};

// Notify network actor that the message has been processed.
// Ignore sending error.
let _ = req.ack.send(());
res
}
None => {
self.replica.process_input(ctx, &self.inner, None).await
}
None => self.replica.process_input(ctx, &self.inner, None).await,
};
if let Err(err) = res {
return match err {
Expand Down
6 changes: 5 additions & 1 deletion node/actors/bft/src/replica/leader_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ impl StateMachine {
}

// Payload should be valid.
if let Err(err) = self.storage.verify_payload(ctx, message.proposal.number, payload).await {
if let Err(err) = self
.storage
.verify_payload(ctx, message.proposal.number, payload)
.await
{
return Err(match err {
err @ ctx::Error::Canceled(_) => Error::Internal(err),
ctx::Error::Internal(err) => Error::ProposalInvalidPayload(err),
Expand Down
Loading

0 comments on commit f13fae3

Please sign in to comment.