Skip to content

Commit

Permalink
Add narwhal- prefix to narwhal package names (MystenLabs/narwhal#1025)
Browse files Browse the repository at this point in the history
Closes MystenLabs/narwhal#757

This makes filtering by narwhal package names easier. Also if we place Narwhal packages along with other packages, we would like to have non-ambiguous package and matching directory names.

Adding narwhal- instead of narwhal_ prefix to match the style in Sui.
  • Loading branch information
mwtian authored Sep 23, 2022
1 parent b5475dc commit ecc7b52
Show file tree
Hide file tree
Showing 24 changed files with 88 additions and 74 deletions.
6 changes: 3 additions & 3 deletions narwhal/config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "config"
name = "narwhal-config"
version = "0.1.0"
license = "Apache-2.0"
authors = ["Mysten Labs <[email protected]>"]
Expand All @@ -16,7 +16,7 @@ tracing = "0.1.36"
arc-swap = { version = "1.5.1", features = ["serde"] }

fastcrypto = "0.1.2"
crypto = { path = "../crypto" }
crypto = { path = "../crypto", package = "narwhal-crypto" }
workspace-hack = { version = "0.1", path = "../workspace-hack" }
rand = "0.8.5"

Expand All @@ -26,4 +26,4 @@ rand = "0.8.5"
tempfile = "3.3.0"
tracing-test = "0.2.3"

test_utils = { path = "../test_utils" }
test_utils = { path = "../test_utils", package = "narwhal-test-utils" }
1 change: 1 addition & 0 deletions narwhal/config/tests/config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use config::{ConsensusAPIGrpcParameters, Import, Parameters, PrometheusMetricsPa
use crypto::PublicKey;
use insta::assert_json_snapshot;
use multiaddr::Multiaddr;
use narwhal_config as config;
use rand::{rngs::StdRng, seq::SliceRandom, SeedableRng};
use std::{
collections::{BTreeMap, HashMap},
Expand Down
14 changes: 7 additions & 7 deletions narwhal/consensus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "consensus"
name = "narwhal-consensus"
version = "0.1.0"
license = "Apache-2.0"
authors = ["Mysten Labs <[email protected]>"]
Expand All @@ -19,13 +19,13 @@ thiserror = "1.0.35"
tokio = { version = "1.20.1", features = ["sync"] }
tracing = "0.1.36"

config = { path = "../config" }
config = { path = "../config", package = "narwhal-config" }
fastcrypto = "0.1.2"
crypto = { path = "../crypto" }
storage = { path = "../storage" }
dag = { path = "../dag" }
crypto = { path = "../crypto", package = "narwhal-crypto" }
storage = { path = "../storage", package = "narwhal-storage" }
dag = { path = "../dag", package = "narwhal-dag" }
prometheus = "0.13.2"
types = { path = "../types" }
types = { path = "../types", package = "narwhal-types" }
workspace-hack = { version = "0.1", path = "../workspace-hack" }
cfg-if = "1.0.0"

Expand All @@ -34,7 +34,7 @@ bincode = "1.3.3"
criterion = "0.3.6"
futures = "0.3.24"
indexmap = { version = "1.9.1", features = ["serde"] }
test_utils = { path = "../test_utils" }
test_utils = { path = "../test_utils", package = "narwhal-test-utils" }

[target.'cfg(unix)'.dev-dependencies]
pprof = { version = "0.10.1", features = ["criterion", "flamegraph"]}
Expand Down
2 changes: 2 additions & 0 deletions narwhal/consensus/benches/process_certificates.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use consensus::{
bullshark::Bullshark,
consensus::{ConsensusProtocol, ConsensusState},
Expand All @@ -9,6 +10,7 @@ use criterion::{
criterion_group, criterion_main, BenchmarkId, Criterion, SamplingMode, Throughput,
};
use fastcrypto::Hash;
use narwhal_consensus as consensus;
use pprof::criterion::{Output, PProfProfiler};
use prometheus::Registry;
use std::{collections::BTreeSet, sync::Arc};
Expand Down
2 changes: 1 addition & 1 deletion narwhal/crypto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "crypto"
name = "narwhal-crypto"
version = "0.1.0"
license = "Apache-2.0"
authors = ["Mysten Labs <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion narwhal/dag/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "dag"
name = "narwhal-dag"
version = "0.1.0"
license = "Apache-2.0"
authors = ["Mysten Labs <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion narwhal/dag/src/bft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::collections::{BTreeSet, VecDeque};
/// # Example
///
/// ```
/// use dag::bft::Bft;
/// use narwhal_dag::bft::Bft;
///
/// #[derive(PartialEq, Eq, Hash)]
/// struct Node(&'static str, &'static [Node]);
Expand Down
12 changes: 6 additions & 6 deletions narwhal/dag/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<T> NodeRef<T> {
/// # Example
///
/// ```
/// use dag::{ Node, NodeRef };
/// use narwhal_dag::{ Node, NodeRef };
///
/// let node = Node::new_leaf(1, false);
/// // Note the 2 derefs: one for the newtype, one for the Arc
Expand Down Expand Up @@ -111,7 +111,7 @@ impl<T> Node<T> {
/// # Example
///
/// ```
/// use dag::{ Node, NodeRef };
/// use narwhal_dag::{ Node, NodeRef };
///
/// let node = Node::new_leaf(1, false);
/// ```
Expand Down Expand Up @@ -140,7 +140,7 @@ impl<T> Node<T> {
/// # Example
///
/// ```
/// use dag::Node;
/// use narwhal_dag::Node;
///
/// let node = Node::new_leaf(1, false);
/// assert_eq!(*node.value(), 1);
Expand All @@ -154,7 +154,7 @@ impl<T> Node<T> {
/// # Examples
///
/// ```
/// use dag::Node;
/// use narwhal_dag::Node;
///
/// let node = Node::new_leaf(1, false);
/// assert_eq!(node.is_leaf(), true);
Expand All @@ -168,7 +168,7 @@ impl<T> Node<T> {
/// # Examples
///
/// ```
/// use dag::Node;
/// use narwhal_dag::Node;
///
/// let node = Node::new_leaf(1, true);
/// assert_eq!(node.is_compressible(), true);
Expand All @@ -185,7 +185,7 @@ impl<T> Node<T> {
/// # Examples
///
/// ```
/// use dag::Node;
/// use narwhal_dag::Node;
///
/// let node = Node::new_leaf(1, false);
/// assert_eq!(node.make_compressible(), true);
Expand Down
2 changes: 1 addition & 1 deletion narwhal/examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "demo"
name = "narwhal-examples"
version = "0.1.0"
license = "Apache-2.0"
authors = ["Mysten Labs <[email protected]>"]
Expand Down
18 changes: 9 additions & 9 deletions narwhal/executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "executor"
name = "narwhal-executor"
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
Expand All @@ -10,12 +10,12 @@ async-trait = "0.1.57"
bincode = "1.3.3"
blake2 = "0.9"
bytes = "1.2.1"
config = { path = "../config" }
consensus = { path = "../consensus" }
config = { path = "../config", package = "narwhal-config" }
consensus = { path = "../consensus", package = "narwhal-consensus" }
fastcrypto = "0.1.2"
futures = "0.3.24"
multiaddr = "0.14.0"
primary = { path = "../primary" }
primary = { path = "../primary", package = "narwhal-primary" }
serde = { version = "1.0.144", features = ["derive"] }
thiserror = "1.0.35"
tokio = { version = "1.20.1", features = ["sync"] }
Expand All @@ -24,10 +24,10 @@ tonic = "0.7.2"
tracing = "0.1.36"
prometheus = "0.13.2"
backoff = { version = "0.4.0", features = ["tokio"] }
storage = { path = "../storage" }
storage = { path = "../storage", package = "narwhal-storage" }
itertools = "0.10.4"

types = { path = "../types" }
types = { path = "../types", package = "narwhal-types" }
mysten-network = "0.1.0"

store = { version = "0.1.0", package = "typed-store" }
Expand All @@ -38,7 +38,7 @@ match_opt = "0.1.2"
indexmap = { version = "1.9.1", features = ["serde"] }
rand = "0.8.5"
tempfile = "3.3.0"
primary = { path = "../primary" }
test_utils = { path = "../test_utils" }
types = { path = "../types" }
primary = { path = "../primary", package = "narwhal-primary" }
test_utils = { path = "../test_utils", package = "narwhal-test-utils" }
types = { path = "../types", package = "narwhal-types" }
telemetry-subscribers = "0.1.0"
8 changes: 4 additions & 4 deletions narwhal/network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "network"
name = "narwhal-network"
version = "0.1.0"
license = "Apache-2.0"
authors = ["Mysten Labs <[email protected]>"]
Expand All @@ -20,8 +20,8 @@ tokio = { version = "1.20.1", features = ["rt", "net", "sync", "macros", "time"]
tokio-util = { version = "0.7.4", features = ["codec"] }
tonic = { version = "0.7.2", features = ["tls"] }
tracing = "0.1.36"
types = { path = "../types" }
crypto = { path = "../crypto" }
types = { path = "../types", package = "narwhal-types" }
crypto = { path = "../crypto", package = "narwhal-crypto" }

serde = "1.0.144"
workspace-hack = { version = "0.1", path = "../workspace-hack" }
Expand All @@ -32,4 +32,4 @@ anyhow = "1.0.65"

[dev-dependencies]
bincode = "1.3.3"
test_utils = { path = "../test_utils" }
test_utils = { path = "../test_utils", package = "narwhal-test-utils" }
26 changes: 15 additions & 11 deletions narwhal/node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "node"
name = "narwhal-node"
version = "0.1.0"
license = "Apache-2.0"
authors = ["Mysten Labs <[email protected]>"]
Expand Down Expand Up @@ -30,17 +30,17 @@ url = "2.3.1"
axum = "0.5.16"
itertools = "0.10.4"

config = { path = "../config" }
consensus = { path = "../consensus" }
config = { path = "../config", package = "narwhal-config" }
consensus = { path = "../consensus", package = "narwhal-consensus" }
fastcrypto = "0.1.2"
crypto = { path = "../crypto" }
executor = { path = "../executor" }
network = { path = "../network" }
primary = { path = "../primary" }
crypto = { path = "../crypto", package = "narwhal-crypto" }
executor = { path = "../executor", package = "narwhal-executor" }
network = { path = "../network", package = "narwhal-network" }
primary = { path = "../primary", package = "narwhal-primary" }
prometheus = "0.13.2"
storage = { path = "../storage" }
types = { path = "../types" }
worker = { path = "../worker" }
storage = { path = "../storage", package = "narwhal-storage" }
types = { path = "../types", package = "narwhal-types" }
worker = { path = "../worker", package = "narwhal-worker" }
workspace-hack = { version = "0.1", path = "../workspace-hack" }
eyre = "0.6.8"

Expand All @@ -52,13 +52,17 @@ pretty_assertions = "1.3.0"
serde-reflection = "0.3.6"
serde_yaml = "0.8.26"
structopt = "0.3.26"
test_utils = { path = "../test_utils" }
test_utils = { path = "../test_utils", package = "narwhal-test-utils" }

[features]
benchmark = ["worker/benchmark", "primary/benchmark", "consensus/benchmark"]
dhat-heap = ["dhat"] # if you are doing heap profiling
trace_transaction = ["worker/trace_transaction"]

[[bin]]
name = "node"
path = "src/main.rs"

[[bin]]
name = "benchmark_client"
path = "src/benchmark_client.rs"
Expand Down
1 change: 1 addition & 0 deletions narwhal/node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use executor::{SerializedTransaction, SubscriberResult};
use eyre::Context;
use fastcrypto::{generate_production_keypair, traits::KeyPair as _};
use futures::future::join_all;
use narwhal_node as node;
use node::{
execution_state::SimpleExecutionState,
metrics::{primary_metrics_registry, start_prometheus_server, worker_metrics_registry},
Expand Down
1 change: 1 addition & 0 deletions narwhal/node/tests/reconfigure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crypto::{KeyPair, NetworkKeyPair, PublicKey};
use executor::{ExecutionIndices, ExecutionState, ExecutionStateError};
use fastcrypto::traits::KeyPair as _;
use futures::future::join_all;
use narwhal_node as node;
use network::{P2pNetwork, ReliableNetwork};
use node::{restarter::NodeRestarter, Node, NodeStorage};
use primary::PrimaryWorkerMessage;
Expand Down
24 changes: 12 additions & 12 deletions narwhal/primary/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "primary"
name = "narwhal-primary"
version = "0.1.0"
license = "Apache-2.0"
authors = ["Mysten Labs <[email protected]>"]
Expand All @@ -14,7 +14,7 @@ base64 = "0.13.0"
bincode = "1.3.3"
blake2 = "0.9"
bytes = "1.2.1"
config = { path = "../config" }
config = { path = "../config", package = "narwhal-config" }
dashmap = "5.4.0"
derive_builder = "0.11.2"
dhat = { version = "0.3.0", optional = true }
Expand All @@ -35,12 +35,12 @@ tower = { version = "0.4.13", features = ["full"] }
tracing = "0.1.36"
tap = "1.0.1"

consensus = { path = "../consensus" }
consensus = { path = "../consensus", package = "narwhal-consensus" }
fastcrypto = "0.1.2"
crypto = { path = "../crypto" }
network = { path = "../network" }
types = { path = "../types" }
storage = { path = "../storage" }
crypto = { path = "../crypto", package = "narwhal-crypto" }
network = { path = "../network", package = "narwhal-network" }
types = { path = "../types", package = "narwhal-types" }
storage = { path = "../storage", package = "narwhal-storage" }
mysten-network = "0.1.0"

store = { version = "0.1.0", package = "typed-store" }
Expand All @@ -51,20 +51,20 @@ anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "6278d0fa78147a
[dev-dependencies]
arc-swap = { version = "1.5.1", features = ["serde"] }
async-trait = "0.1.57"
executor = { path = "../executor" }
executor = { path = "../executor", package = "narwhal-executor" }
indexmap = { version = "1.9.1", features = ["serde"] }
itertools = "0.10.4"
mockall = "0.11.2"
node = { path = "../node" }
node = { path = "../node", package = "narwhal-node" }
proptest = "1.0.0"
tempfile = "3.3.0"
telemetry-subscribers = "0.1.0"
test_utils = { path = "../test_utils" }
test_utils = { path = "../test_utils", package = "narwhal-test-utils" }
thiserror = "1.0.35"
tracing = "0.1.36"
tracing-test = "0.2.3"
worker = { path = "../worker" }
storage = { path = "../storage" }
worker = { path = "../worker", package = "narwhal-worker" }
storage = { path = "../storage", package = "narwhal-storage" }

[features]
benchmark = []
Expand Down
2 changes: 1 addition & 1 deletion narwhal/primary/src/block_remover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ pub struct DeleteBatchMessage {
/// # use config::{Committee, WorkerCache, SharedWorkerCache};
/// # use consensus::dag::Dag;
/// # use futures::future::join_all;
/// # use narwhal_primary::{BlockRemover, BlockRemoverCommand, DeleteBatchMessage, PayloadToken};
/// # use std::collections::BTreeMap;
/// # use std::sync::Arc;
/// # use types::ReconfigureNotification;
/// # use config::WorkerId;
/// # use tempfile::tempdir;
/// # use primary::{BlockRemover, BlockRemoverCommand, DeleteBatchMessage, PayloadToken};
/// # use test_utils::test_channel;
/// # use types::{Round, BatchDigest, Certificate, CertificateDigest, HeaderDigest, Header};
/// # use prometheus::Registry;
Expand Down
2 changes: 1 addition & 1 deletion narwhal/primary/src/block_waiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ type RequestKey = Vec<u8>;
/// # use std::env::temp_dir;
/// # use config::{Committee, WorkerCache, SharedWorkerCache};
/// # use crypto::PublicKey;
/// # use narwhal_primary::{BlockWaiter, BlockHeader, BlockCommand, block_synchronizer::{BlockSynchronizeResult, handler::{Error, Handler}}};
/// # use std::collections::BTreeMap;
/// # use types::Certificate;
/// # use primary::{BlockWaiter, BlockHeader, BlockCommand, block_synchronizer::{BlockSynchronizeResult, handler::{Error, Handler}}};
/// # use types::{BatchMessage, BatchDigest, CertificateDigest, Batch};
/// # use mockall::*;
/// # use test_utils::test_channel;
Expand Down
1 change: 1 addition & 0 deletions narwhal/primary/tests/epoch_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use arc_swap::ArcSwap;
use config::{Committee, Parameters};
use fastcrypto::traits::KeyPair;
use futures::future::join_all;
use narwhal_primary as primary;
use network::{CancelOnDropHandler, P2pNetwork, ReliableNetwork};
use node::NodeStorage;
use primary::{NetworkModel, Primary, CHANNEL_CAPACITY};
Expand Down
Loading

0 comments on commit ecc7b52

Please sign in to comment.