Skip to content

Commit

Permalink
Renaming. Also deleted an empty file.
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoffranca committed Nov 8, 2024
1 parent cd1c1c6 commit 17e69d9
Show file tree
Hide file tree
Showing 100 changed files with 37 additions and 38 deletions.
12 changes: 6 additions & 6 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[workspace]
members = [
"actors/bft",
"actors/executor",
"actors/network",
"components/bft",
"components/executor",
"components/network",
"libs/concurrency",
"libs/crypto",
"libs/protobuf",
Expand All @@ -26,10 +26,10 @@ version = "0.5.0"

[workspace.dependencies]
# Crates from this repo.
zksync_consensus_bft = { version = "=0.5.0", path = "actors/bft" }
zksync_consensus_bft = { version = "=0.5.0", path = "components/bft" }
zksync_consensus_crypto = { version = "=0.5.0", path = "libs/crypto" }
zksync_consensus_executor = { version = "=0.5.0", path = "actors/executor" }
zksync_consensus_network = { version = "=0.5.0", path = "actors/network" }
zksync_consensus_executor = { version = "=0.5.0", path = "components/executor" }
zksync_consensus_network = { version = "=0.5.0", path = "components/network" }
zksync_consensus_roles = { version = "=0.5.0", path = "libs/roles" }
zksync_consensus_storage = { version = "=0.5.0", path = "libs/storage" }
zksync_consensus_tools = { version = "=0.5.0", path = "tools" }
Expand Down
1 change: 0 additions & 1 deletion node/actors/network/src/state.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors.workspace = true
description = "ZKsync consensus bft actor"
description = "ZKsync consensus BFT component"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl StateMachine {
};
metrics::METRICS.message_processing_latency[&label].observe_latency(ctx.now() - now);

// Notify network actor that the message has been processed.
// Notify network component that the message has been processed.
// Ignore sending error.
let _ = req.ack.send(());
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::sync::Arc;
use zksync_consensus_roles::validator;
use zksync_consensus_storage as storage;

/// Configuration of the bft actor.
/// Configuration of the bft component.
#[derive(Debug)]
pub struct Config {
/// The validator's secret key.
Expand Down
6 changes: 3 additions & 3 deletions node/actors/bft/src/lib.rs → node/components/bft/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! This crate contains the consensus actor, which is responsible for handling the logic that allows us to reach agreement on blocks.
//! This crate contains the consensus component, which is responsible for handling the logic that allows us to reach agreement on blocks.
//! It uses a new cosnensus algorithm developed at Matter Labs, called ChonkyBFT. You can find the specification of the algorithm [here](../../../../spec).
use anyhow::Context;
Expand Down Expand Up @@ -48,7 +48,7 @@ pub trait PayloadManager: std::fmt::Debug + Send + Sync {
}

impl Config {
/// Starts the bft actor. It will start running, processing incoming messages and
/// Starts the bft component. It will start running, processing incoming messages and
/// sending output messages.
pub async fn run(
self,
Expand Down Expand Up @@ -79,7 +79,7 @@ impl Config {
.await?;

let res = scope::run!(ctx, |ctx, s| async {
tracing::info!("Starting consensus actor {:?}", cfg.secret_key.public());
tracing::info!("Starting consensus component {:?}", cfg.secret_key.public());

s.spawn(async { replica.run(ctx).await.wrap("replica.run()") });
s.spawn_bg(async {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ impl Node {
consensus_sender: channel::UnboundedSender<ToNetworkMessage>,
) -> anyhow::Result<()> {
scope::run!(ctx, |ctx, s| async {
// Create a channel for consensus actor to send messages to the network.
// Create a channel for the consensus component to send messages to the network.
// We will use this extra channel to filter messages depending on the nodes
// behavior.
let (net_send, mut net_recv) = channel::unbounded();

// Run the consensus actor
// Run the consensus component
s.spawn(async {
let validator_key = self.net.validator_key.clone().unwrap();
crate::Config {
Expand All @@ -65,7 +65,7 @@ impl Node {
.context("consensus.run()")
});

// Forward output messages from the actor to the network;
// Forward output messages from the consensus to the network;
// turns output from this to inputs for others.
// Get the next message from the channel. Our response depends on what type of replica we are.
while let Ok(msg) = net_recv.recv(ctx).await {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ async fn run_nodes_twins(
.await
}

/// Receive input messages from the consensus actor and send them to the others
/// Receive input messages from the consensus component and send them to the others
/// according to the partition schedule of the port associated with this instance.
///
/// We have to simulate the gossip layer which isn't instantiated by these tests.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors.workspace = true
description = "ZKsync consensus executor actor"
description = "ZKsync consensus executor component"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Config {
}
}

/// Executor allowing to spin up all actors necessary for a consensus node.
/// Executor allowing to spin up all components necessary for a consensus node.
#[derive(Debug)]
pub struct Executor {
/// General-purpose executor configuration.
Expand Down Expand Up @@ -110,11 +110,11 @@ impl Executor {
pub async fn run(self, ctx: &ctx::Ctx) -> anyhow::Result<()> {
let network_config = self.network_config();

// Generate the communication pipes. We have one for each actor.
// Generate the communication channels. We have one for each component.
let (consensus_send, consensus_recv) = bft::Config::create_input_channel();
let (network_send, network_recv) = ctx::channel::unbounded();

tracing::debug!("Starting actors in separate threads.");
tracing::debug!("Starting components in separate threads.");
scope::run!(ctx, |ctx, s| async {
let (net, runner) = network::Network::new(
network_config,
Expand All @@ -135,7 +135,7 @@ impl Executor {
});
}

// Run the bft actor iff this node is an active validator.
// Run the bft component iff this node is an active validator.
let Some(validator) = self.validator else {
tracing::info!("Running the node in non-validator mode.");
return Ok(());
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors.workspace = true
description = "ZKsync consensus network actor"
description = "ZKsync consensus network component"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Network actor configs.
//! Network component configs.
use std::collections::{HashMap, HashSet};
use zksync_concurrency::{limiter, net, time};
use zksync_consensus_roles::{node, validator};
Expand Down Expand Up @@ -82,7 +82,7 @@ pub struct GossipConfig {
pub static_outbound: HashMap<node::PublicKey, net::Host>,
}

/// Network actor config.
/// Network component config.
#[derive(Debug, Clone)]
pub struct Config {
/// Label identifying the build version of the binary that this node is running.
Expand Down Expand Up @@ -116,7 +116,7 @@ pub struct Config {
/// Set it to `false` in tests to simulate node behavior before pre-genesis support.
pub enable_pregenesis: bool,
/// Maximum number of not-yet-persisted blocks fetched from the network.
/// If reached, network actor will wait for more blocks to get persisted
/// If reached, network component will wait for more blocks to get persisted
/// before fetching the next ones. It is useful for limiting memory consumption
/// when the block persisting rate is low.
pub max_block_queue_size: usize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl rpc::Handler<rpc::consensus::Rpc> for &Network {
ack: send,
});
// TODO(gprusak): disconnection means that there message was rejected OR
// that bft actor is missing (in tests), which leads to unnecessary disconnects.
// that bft component is missing (in tests), which leads to unnecessary disconnects.
let _ = recv.recv_or_disconnected(ctx).await?;
Ok(rpc::consensus::Resp)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub(crate) struct Network {
pub(crate) validator_addrs: ValidatorAddrsWatch,
/// Block store to serve `get_block` requests from.
pub(crate) block_store: Arc<BlockStore>,
/// Sender of the channel to the consensus actor.
/// Sender of the channel to the consensus component.
pub(crate) consensus_sender: sync::prunable_mpsc::Sender<io::ConsensusReq>,
/// Queue of block fetching requests.
///
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use zksync_concurrency::oneshot;
use zksync_consensus_roles::validator;

/// Message types from the Consensus actor.
/// Message types from the Consensus component.
#[derive(Debug, PartialEq)]
pub struct ConsensusInputMessage {
pub message: validator::Signed<validator::ConsensusMsg>,
Expand All @@ -13,7 +13,7 @@ pub struct ConsensusInputMessage {
pub struct ConsensusReq {
/// Payload.
pub msg: validator::Signed<validator::ConsensusMsg>,
/// Channel that should be used to notify network actor that
/// Channel that should be used to notify the network component that
/// processing of this message has been completed.
/// Used for rate limiting.
pub ack: oneshot::Sender<()>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Network actor maintaining a pool of outbound and inbound connections to other nodes.
//! Network component maintaining a pool of outbound and inbound connections to other nodes.
use anyhow::Context as _;
use gossip::attestation;
use std::sync::Arc;
Expand Down Expand Up @@ -31,7 +31,7 @@ mod watch;
pub use config::*;
pub use metrics::MeteredStreamStats;

/// State of the network actor observable outside of the actor.
/// State of the network component observable outside of the component.
pub struct Network {
/// Consensus network state.
pub(crate) consensus: Option<Arc<consensus::Network>>,
Expand All @@ -49,8 +49,8 @@ pub struct Runner {
}

impl Network {
/// Constructs a new network actor state.
/// Call `run_network` to run the actor.
/// Constructs a new network component state.
/// Call `run_network` to run the component.
pub fn new(
cfg: Config,
block_store: Arc<BlockStore>,
Expand Down Expand Up @@ -93,7 +93,7 @@ impl Network {
}

impl Runner {
/// Runs the network actor.
/// Runs the network component.
pub async fn run(mut self, ctx: &ctx::Ctx) -> anyhow::Result<()> {
let res: ctx::Result<()> = scope::run!(ctx, |ctx, s| async {
let mut listener = self
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub(crate) async fn forward(
let _ = io::shutdown(ctx, &mut write).await;
}

/// Node instance, wrapping the network actor state and the
/// Node instance, wrapping the network component state and the
/// events channel.
pub struct Instance {
/// State of the instance.
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion node/libs/roles/src/validator/messages/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl TryFrom<u32> for ProtocolVersion {

fn try_from(value: u32) -> Result<Self, Self::Error> {
// Currently, consensus doesn't define restrictions on the possible version. Unsupported
// versions are filtered out on the BFT actor level instead.
// versions are filtered out on the BFT component level instead.
Ok(Self(value))
}
}
Expand Down
2 changes: 1 addition & 1 deletion node/tools/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Main binary for the consensus node. It reads the configuration, initializes all parts of the node and
//! manages communication between the actors. It is the main executable in this workspace.
//! manages communication between the components. It is the main executable in this workspace.
use anyhow::Context as _;
use clap::Parser;
use std::{fs, fs::Permissions, io::IsTerminal as _, os::unix::fs::PermissionsExt, path::PathBuf};
Expand Down

0 comments on commit 17e69d9

Please sign in to comment.