Skip to content

Commit

Permalink
chore(code): Rename malachite-consensus to `malachite-core-consensu…
Browse files Browse the repository at this point in the history
…s` (#691)

* chore(code): Rename `malachite-consensus` to `malachite-core-consensus`

* Fix MSRV workflow
  • Loading branch information
romac authored Dec 18, 2024
1 parent 5879ab9 commit 889e616
Show file tree
Hide file tree
Showing 61 changed files with 51 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
with:
tool: cargo-msrv
- name: Check MSRV
run: cargo msrv verify --manifest-path crates/consensus/Cargo.toml --output-format minimal -- cargo check --all-features
run: cargo msrv verify --manifest-path crates/engine/Cargo.toml --output-format minimal -- cargo check --all-features

standalone:
name: Standalone
Expand Down
12 changes: 6 additions & 6 deletions code/Cargo.lock

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

4 changes: 2 additions & 2 deletions code/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
"crates/app-channel",
"crates/codec",
"crates/config",
"crates/consensus",
"crates/core-consensus",
"crates/core-driver",
"crates/core-state-machine",
"crates/core-types",
Expand Down Expand Up @@ -68,7 +68,7 @@ malachite-app-channel = { version = "0.1.0", path = "crates/app-channel"
malachite-test-cli = { version = "0.1.0", path = "crates/test/cli" }
malachite-codec = { version = "0.1.0", path = "crates/codec" }
malachite-config = { version = "0.1.0", path = "crates/config" }
malachite-consensus = { version = "0.1.0", path = "crates/consensus" }
malachite-core-consensus = { version = "0.1.0", path = "crates/core-consensus" }
malachite-core-driver = { version = "0.1.0", path = "crates/core-driver" }
malachite-core-state-machine = { version = "0.1.0", path = "crates/core-state-machine" }
malachite-core-types = { version = "0.1.0", path = "crates/core-types" }
Expand Down
2 changes: 1 addition & 1 deletion code/crates/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ malachite-engine.workspace = true
malachite-codec.workspace = true
malachite-core-types.workspace = true
malachite-config.workspace = true
malachite-consensus.workspace = true
malachite-core-consensus.workspace = true
malachite-network.workspace = true
malachite-metrics.workspace = true
malachite-peer.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion code/crates/app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub mod host {
}

pub mod consensus {
pub use malachite_consensus::*;
pub use malachite_core_consensus::*;
}

pub mod metrics {
Expand Down
2 changes: 1 addition & 1 deletion code/crates/app/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Re-export of all types required to build a Malachite application.
pub use malachite_consensus::{ConsensusMsg, ProposedValue, SignedConsensusMsg, ValuePayload};
pub use malachite_core_consensus::{ConsensusMsg, ProposedValue, SignedConsensusMsg, ValuePayload};
pub use malachite_engine::host::LocallyProposedValue;
pub use malachite_peer::PeerId;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "malachite-consensus"
name = "malachite-core-consensus"
version.workspace = true
edition.workspace = true
repository.workspace = true
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.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// # Example
///
/// ```rust,ignore
/// malachite_consensus::process!(
/// malachite_core_consensus::process!(
/// // Input to process
/// input: input,
/// // Consensus state
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.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use malachite_consensus::{FullProposal, FullProposalKeeper, Input, ProposedValue};
use malachite_core_consensus::{FullProposal, FullProposalKeeper, Input, ProposedValue};
use malachite_core_types::{
Context, Round, SignedProposal, SigningProvider, Validity, ValueOrigin,
};
Expand Down
3 changes: 2 additions & 1 deletion code/crates/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true
rust-version.workspace = true
publish.workspace = true

[lints]
Expand All @@ -12,7 +13,7 @@ workspace = true
[dependencies]
malachite-codec.workspace = true
malachite-config.workspace = true
malachite-consensus.workspace = true
malachite-core-consensus.workspace = true
malachite-core-types.workspace = true
malachite-network.workspace = true
malachite-metrics.workspace = true
Expand Down
16 changes: 9 additions & 7 deletions code/crates/engine/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use tracing::{debug, error, info, warn};

use malachite_codec as codec;
use malachite_config::TimeoutConfig;
use malachite_consensus::{Effect, PeerId, Resumable, Resume, SignedConsensusMsg, ValueToPropose};
use malachite_core_consensus::{
Effect, PeerId, Resumable, Resume, SignedConsensusMsg, ValueToPropose,
};
use malachite_core_types::{
Context, Round, SignedExtension, SigningProvider, SigningProviderExt, Timeout, TimeoutKind,
ValidatorSet, ValueOrigin,
Expand All @@ -28,9 +30,9 @@ use crate::util::streaming::StreamMessage;
use crate::util::timers::{TimeoutElapsed, TimerScheduler};
use crate::wal::{Msg as WalMsg, WalEntry, WalRef};

pub use malachite_consensus::Error as ConsensusError;
pub use malachite_consensus::Params as ConsensusParams;
pub use malachite_consensus::State as ConsensusState;
pub use malachite_core_consensus::Error as ConsensusError;
pub use malachite_core_consensus::Params as ConsensusParams;
pub use malachite_core_consensus::State as ConsensusState;

/// Codec for consensus messages.
///
Expand Down Expand Up @@ -102,7 +104,7 @@ impl<Ctx: Context> From<NetworkEvent<Ctx>> for Msg<Ctx> {
}
}

type ConsensusInput<Ctx> = malachite_consensus::Input<Ctx>;
type ConsensusInput<Ctx> = malachite_core_consensus::Input<Ctx>;

impl<Ctx: Context> From<TimeoutElapsed<Timeout>> for Msg<Ctx> {
fn from(msg: TimeoutElapsed<Timeout>) -> Self {
Expand Down Expand Up @@ -224,7 +226,7 @@ where
) -> Result<(), ConsensusError<Ctx>> {
let height = state.height();

malachite_consensus::process!(
malachite_core_consensus::process!(
input: input,
state: &mut state.consensus,
metrics: &self.metrics,
Expand Down Expand Up @@ -834,7 +836,7 @@ where
}

Effect::VerifySignature(msg, pk, r) => {
use malachite_consensus::ConsensusMsg as Msg;
use malachite_core_consensus::ConsensusMsg as Msg;

let start = Instant::now();

Expand Down
4 changes: 2 additions & 2 deletions code/crates/engine/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use std::time::Duration;
use derive_where::derive_where;
use ractor::{ActorRef, RpcReplyPort};

use malachite_consensus::PeerId;
use malachite_core_consensus::PeerId;
use malachite_core_types::{CommitCertificate, Context, Round, SignedExtension, ValueId};
use malachite_sync::DecidedValue;

use crate::consensus::ConsensusRef;
use crate::util::streaming::StreamMessage;

/// A value to propose that has just been received.
pub use malachite_consensus::ProposedValue;
pub use malachite_core_consensus::ProposedValue;

/// This is the value that the application constructed
/// and has finished streaming on gossip.
Expand Down
2 changes: 1 addition & 1 deletion code/crates/engine/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use malachite_sync::{
};

use malachite_codec as codec;
use malachite_consensus::SignedConsensusMsg;
use malachite_core_consensus::SignedConsensusMsg;
use malachite_core_types::{Context, SignedProposal, SignedVote};
use malachite_metrics::SharedRegistry;
use malachite_network::handle::CtrlHandle;
Expand Down
2 changes: 1 addition & 1 deletion code/crates/engine/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tokio::task::JoinHandle;
use tracing::{debug, error, info, warn};

use malachite_codec as codec;
use malachite_consensus::PeerId;
use malachite_core_consensus::PeerId;
use malachite_core_types::{CertificateError, CommitCertificate, Context, Height, Round};
use malachite_sync::{self as sync, InboundRequestId, OutboundRequestId, Response};
use malachite_sync::{DecidedValue, Request};
Expand Down
2 changes: 1 addition & 1 deletion code/crates/engine/src/util/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::fmt;
use derive_where::derive_where;
use tokio::sync::broadcast;

use malachite_consensus::{ProposedValue, SignedConsensusMsg, ValueToPropose};
use malachite_core_consensus::{ProposedValue, SignedConsensusMsg, ValueToPropose};
use malachite_core_types::{CommitCertificate, Context, Round, Timeout, ValueOrigin};

pub type RxEvent<Ctx> = broadcast::Receiver<Event<Ctx>>;
Expand Down
2 changes: 1 addition & 1 deletion code/crates/engine/src/wal/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use byteorder::{ReadBytesExt, WriteBytesExt, BE};
use derive_where::derive_where;

use malachite_codec::Codec;
use malachite_consensus::SignedConsensusMsg;
use malachite_core_consensus::SignedConsensusMsg;
use malachite_core_types::{Context, Round, Timeout};

/// Codec for encoding and decoding WAL entries.
Expand Down
2 changes: 1 addition & 1 deletion code/crates/metrics/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl Metrics {
pub fn register(registry: &SharedRegistry) -> Self {
let metrics = Self::new();

registry.with_prefix("malachite_consensus", |registry| {
registry.with_prefix("malachite_core_consensus", |registry| {
registry.register(
"finalized_blocks",
"Number of blocks finalized",
Expand Down
2 changes: 1 addition & 1 deletion code/crates/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub use channel::Channel;
use behaviour::{Behaviour, NetworkEvent};
use handle::Handle;

const PROTOCOL: &str = "/malachite-consensus/v1beta1";
const PROTOCOL: &str = "/malachite-core-consensus/v1beta1";
const METRICS_PREFIX: &str = "malachite_network";
const DISCOVERY_METRICS_PREFIX: &str = "malachite_discovery";

Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ malachite-engine = { workspace = true }
malachite-app = { workspace = true }
malachite-codec = { workspace = true }
malachite-config = { workspace = true }
malachite-consensus = { workspace = true, features = ["debug"] }
malachite-core-consensus = { workspace = true, features = ["debug"] }
malachite-core-types = { workspace = true }
malachite-network = { workspace = true }
malachite-metrics = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/host/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rand::SeedableRng;
use tokio::time::Instant;
use tracing::{debug, error, info, trace, warn};

use malachite_consensus::PeerId;
use malachite_core_consensus::PeerId;
use malachite_core_types::{CommitCertificate, Round, Validity, ValueOrigin};
use malachite_engine::consensus::{ConsensusMsg, ConsensusRef};
use malachite_engine::host::{LocallyProposedValue, ProposedValue};
Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/host/src/block_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use thiserror::Error;
use tracing::error;

use malachite_codec::Codec;
use malachite_consensus::ProposedValue;
use malachite_core_consensus::ProposedValue;
use malachite_core_types::{CommitCertificate, Round};
use malachite_proto::Protobuf;

Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/host/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use malachite_core_types::{
use malachite_engine::util::streaming::{StreamContent, StreamMessage};
use malachite_sync::{self as sync, ValueRequest, ValueResponse, VoteSetRequest, VoteSetResponse};

use malachite_consensus::{PeerId, ProposedValue, SignedConsensusMsg};
use malachite_core_consensus::{PeerId, ProposedValue, SignedConsensusMsg};
use malachite_starknet_p2p_proto::ConsensusMessage;

use crate::proto::consensus_message::Messages;
Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/host/src/host/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use tokio::time::Instant;
use tracing::{debug, Instrument};

use malachite_config::VoteExtensionsConfig;
use malachite_consensus::ValuePayload;
use malachite_core_consensus::ValuePayload;
use malachite_core_types::{CommitCertificate, Extension, Round, SignedExtension, SignedVote};

use crate::host::Host;
Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/host/src/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use tokio::task::JoinHandle;
use malachite_config::{
self as config, Config as NodeConfig, MempoolConfig, SyncConfig, TestConfig, TransportProtocol,
};
use malachite_consensus::ValuePayload;
use malachite_core_consensus::ValuePayload;
use malachite_engine::consensus::{Consensus, ConsensusParams, ConsensusRef};
use malachite_engine::host::HostRef;
use malachite_engine::network::{Network, NetworkRef};
Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/host/src/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BinaryHeap, HashSet};

use derive_where::derive_where;

use malachite_consensus::PeerId;
use malachite_core_consensus::PeerId;
use malachite_core_types::Round;
use malachite_engine::util::streaming::{Sequence, StreamId, StreamMessage};

Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ publish = false
malachite-engine.workspace = true
malachite-core-types.workspace = true
malachite-config.workspace = true
malachite-consensus.workspace = true
malachite-core-consensus.workspace = true
malachite-metrics.workspace = true
malachite-starknet-host.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use malachite_config::{
Config as NodeConfig, Config, DiscoveryConfig, LoggingConfig, PubSubProtocol, SyncConfig,
TestConfig, TransportProtocol,
};
use malachite_consensus::{SignedConsensusMsg, ValueToPropose};
use malachite_core_consensus::{SignedConsensusMsg, ValueToPropose};
use malachite_core_types::{SignedVote, VotingPower};
use malachite_engine::util::events::{Event, RxEvent, TxEvent};
use malachite_starknet_host::spawn::spawn_node_actor;
Expand Down
2 changes: 1 addition & 1 deletion code/crates/starknet/test/tests/wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use eyre::bail;
use tracing::info;

use malachite_config::ValuePayload;
use malachite_consensus::ValueToPropose;
use malachite_core_consensus::ValueToPropose;
use malachite_core_types::SignedVote;
use malachite_engine::util::events::Event;
use malachite_starknet_host::types::MockContext;
Expand Down
2 changes: 1 addition & 1 deletion code/crates/sync/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// # Example
///
/// ```rust,ignore
/// malachite_consensus::process!(
/// malachite_core_consensus::process!(
/// // Input to process
/// input: input,
/// // Consensus state
Expand Down
2 changes: 1 addition & 1 deletion code/crates/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ malachite-app = { workspace = true }
malachite-codec = { workspace = true }
malachite-core-types = { workspace = true }
malachite-config = { workspace = true }
malachite-consensus = { workspace = true }
malachite-core-consensus = { workspace = true }
malachite-proto = { workspace = true }
malachite-signing-ed25519 = { workspace = true, features = ["rand", "serde"] }
malachite-sync = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions code/crates/test/mbt/tests/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const RANDOM_SEED: u64 = 0x42;

#[test]
fn test_itf() {
let temp_dir =
tempfile::TempDir::with_prefix("malachite-consensus-").expect("Failed to create temp dir");
let temp_dir = tempfile::TempDir::with_prefix("malachite-core-consensus-")
.expect("Failed to create temp dir");
let temp_path = temp_dir.path().to_owned();

if std::env::var("KEEP_TEMP").is_ok() {
Expand Down
2 changes: 1 addition & 1 deletion code/crates/test/src/codec/json/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bytes::Bytes;
use malachite_codec::Codec;

use malachite_consensus::SignedConsensusMsg;
use malachite_core_consensus::SignedConsensusMsg;
use malachite_engine::util::streaming::StreamMessage;
use malachite_sync::{Request, Response, Status};

Expand Down
Loading

0 comments on commit 889e616

Please sign in to comment.