Skip to content

Commit

Permalink
CI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoffranca committed Mar 26, 2024
1 parent 8c9f43b commit 683884a
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 27 deletions.
10 changes: 5 additions & 5 deletions node/Cargo.lock

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

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ clap = { version = "4.3.3", features = ["derive"] }
criterion = "0.5.1"
ed25519-dalek = { version = "2.0.0", features = ["rand_core"] }
ff_ce = "0.14.3"
heck = "0.4.1"
heck = "0.5.0"
hex = "0.4.3"
im = "15.1.0"
once_cell = "1.17.1"
Expand Down
4 changes: 2 additions & 2 deletions node/actors/bft/src/leader/replica_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub(crate) enum Error {
NotLeaderInView,
/// Invalid message.
#[error("invalid message: {0:#}")]
InvalidMessage(anyhow::Error),
InvalidMessage(#[source] anyhow::Error),
/// Duplicate message from a replica.
#[error("duplicate message from a replica (existing message: {existing_message:?}")]
DuplicateMessage {
Expand All @@ -46,7 +46,7 @@ pub(crate) enum Error {
},
/// Invalid message signature.
#[error("invalid signature: {0:#}")]
InvalidSignature(#[source] validator::Error),
InvalidSignature(#[source] anyhow::Error),
}

impl StateMachine {
Expand Down
2 changes: 1 addition & 1 deletion node/actors/bft/src/leader/replica_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub(crate) enum Error {
},
/// Invalid message signature.
#[error("invalid signature: {0:#}")]
InvalidSignature(#[source] validator::Error),
InvalidSignature(#[source] anyhow::Error),
/// Invalid message.
#[error(transparent)]
InvalidMessage(validator::ReplicaPrepareVerifyError),
Expand Down
2 changes: 1 addition & 1 deletion node/actors/bft/src/replica/leader_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(crate) enum Error {
},
/// Invalid message signature.
#[error("invalid signature: {0:#}")]
InvalidSignature(validator::Error),
InvalidSignature(#[source] anyhow::Error),
/// Invalid message.
#[error("invalid message: {0:#}")]
InvalidMessage(validator::CommitQCVerifyError),
Expand Down
2 changes: 1 addition & 1 deletion node/actors/bft/src/replica/leader_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(crate) enum Error {
},
/// Invalid message signature.
#[error("invalid signature: {0:#}")]
InvalidSignature(#[source] validator::Error),
InvalidSignature(#[source] anyhow::Error),
/// Invalid message.
#[error("invalid message: {0:#}")]
InvalidMessage(#[source] validator::LeaderPrepareVerifyError),
Expand Down
2 changes: 1 addition & 1 deletion node/actors/network/src/consensus/handshake/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub(super) enum Error {
#[error("unexpected peer")]
PeerMismatch,
#[error("validator signature {0}")]
Signature(#[from] validator::Error),
Signature(#[from] anyhow::Error),
#[error("stream {0}")]
Stream(#[source] anyhow::Error),
}
Expand Down
2 changes: 1 addition & 1 deletion node/actors/sync_blocks/src/peers/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use zksync_consensus_roles::{node, validator::BlockNumber};

/// Events emitted by `PeerStates` actor. Only used for tests so far.
#[derive(Debug)]
#[allow(dead_code, unused_tuple_struct_fields)] // Variant fields are only read in tests
#[allow(dead_code)] // Variant fields are only read in tests
pub(super) enum PeerStateEvent {
/// Node has successfully downloaded the specified block.
GotBlock(BlockNumber),
Expand Down
1 change: 1 addition & 0 deletions node/deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ multiple-versions = "deny"
skip = [
# Old versions required by tempfile and prost-build.
{ name = "bitflags", version = "1.3.2" },
{ name = "heck", version = "0.4.1" },

# Old version required by tracing-subscriber.
{ name = "regex-automata", version = "0.1.10" },
Expand Down
2 changes: 1 addition & 1 deletion node/libs/concurrency/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn abort_on_panic() {

/// Guard which has to be dropped before timeout is reached.
/// Otherwise the test will panic.
#[allow(unused_tuple_struct_fields)]
#[allow(dead_code)]
#[must_use]
pub struct TimeoutGuard(std::sync::mpsc::Sender<()>);

Expand Down
6 changes: 3 additions & 3 deletions node/libs/roles/src/validator/keys/aggregate_signature.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{Error, PublicKey, Signature};
use super::{PublicKey, Signature};
use crate::validator::messages::{Msg, MsgHash};
use std::fmt;
use zksync_consensus_crypto::{bn254, ByteFmt, Text, TextFmt};
Expand All @@ -18,7 +18,7 @@ impl AggregateSignature {
pub(crate) fn verify_messages<'a, V: Variant<Msg>>(
&self,
messages_and_keys: impl Iterator<Item = (V, &'a PublicKey)>,
) -> Result<(), Error> {
) -> anyhow::Result<()> {
let hashes_and_keys =
messages_and_keys.map(|(message, key)| (message.insert().hash(), key));
self.verify_hash(hashes_and_keys)
Expand All @@ -28,7 +28,7 @@ impl AggregateSignature {
pub(crate) fn verify_hash<'a>(
&self,
hashes_and_keys: impl Iterator<Item = (MsgHash, &'a PublicKey)>,
) -> Result<(), Error> {
) -> anyhow::Result<()> {
let bytes_and_pks: Vec<_> = hashes_and_keys
.map(|(hash, pk)| (hash.0.as_bytes().to_owned(), &pk.0))
.collect();
Expand Down
3 changes: 0 additions & 3 deletions node/libs/roles/src/validator/keys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ pub use aggregate_signature::AggregateSignature;
pub use public_key::PublicKey;
pub use secret_key::SecretKey;
pub use signature::Signature;

/// Error type returned by validator key operations.
pub type Error = zksync_consensus_crypto::bn254::Error;
6 changes: 3 additions & 3 deletions node/libs/roles/src/validator/keys/signature.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{Error, PublicKey};
use super::PublicKey;
use crate::validator::messages::{Msg, MsgHash};
use std::fmt;
use zksync_consensus_crypto::{bn254, ByteFmt, Text, TextFmt};
Expand All @@ -9,12 +9,12 @@ pub struct Signature(pub(crate) bn254::Signature);

impl Signature {
/// Verify a message against a public key.
pub fn verify_msg(&self, msg: &Msg, pk: &PublicKey) -> Result<(), Error> {
pub fn verify_msg(&self, msg: &Msg, pk: &PublicKey) -> anyhow::Result<()> {
self.verify_hash(&msg.hash(), pk)
}

/// Verify a message hash against a public key.
pub fn verify_hash(&self, msg_hash: &MsgHash, pk: &PublicKey) -> Result<(), Error> {
pub fn verify_hash(&self, msg_hash: &MsgHash, pk: &PublicKey) -> anyhow::Result<()> {
self.0.verify(&ByteFmt::encode(msg_hash), &pk.0)
}
}
Expand Down
2 changes: 1 addition & 1 deletion node/libs/roles/src/validator/messages/leader_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub enum CommitQCVerifyError {
},
/// Bad signature.
#[error("bad signature: {0:#}")]
BadSignature(#[source] validator::Error),
BadSignature(#[source] anyhow::Error),
}

impl CommitQC {
Expand Down
2 changes: 1 addition & 1 deletion node/libs/roles/src/validator/messages/leader_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub enum PrepareQCVerifyError {
},
/// Bad signature.
#[error("bad signature: {0:#}")]
BadSignature(validator::Error),
BadSignature(#[source] anyhow::Error),
}

impl PrepareQC {
Expand Down
4 changes: 2 additions & 2 deletions node/libs/roles/src/validator/messages/msg.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Generic message types.
use super::{ConsensusMsg, NetAddress};
use crate::{node::SessionId, validator, validator::Error};
use crate::{node::SessionId, validator};
use std::fmt;
use zksync_consensus_crypto::{keccak256, ByteFmt, Text, TextFmt};
use zksync_consensus_utils::enum_util::{BadVariantError, Variant};
Expand Down Expand Up @@ -108,7 +108,7 @@ pub struct Signed<V: Variant<Msg>> {

impl<V: Variant<Msg> + Clone> Signed<V> {
/// Verify the signature on the message.
pub fn verify(&self) -> Result<(), Error> {
pub fn verify(&self) -> anyhow::Result<()> {
self.sig.verify_msg(&self.msg.clone().insert(), &self.key)
}
}
Expand Down

0 comments on commit 683884a

Please sign in to comment.