consensus-engine to carnot-engine. (#551)
* Refactor: consensus-engine to carnot-engine. Move under consensus/carnot-engine * Fuzztests update with carnot-engine * Update missing refactor in tests --------- Co-authored-by: Gusto <bacvinka@gmail.com>
This commit is contained in:
parent
6e718e7bba
commit
6287e554ae
|
@ -20,7 +20,7 @@ members = [
|
|||
"nodes/nomos-node",
|
||||
"nodes/mixnode",
|
||||
"simulations",
|
||||
"consensus-engine",
|
||||
"consensus/carnot-engine",
|
||||
"tests",
|
||||
"mixnet/node",
|
||||
"mixnet/client",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "consensus-engine"
|
||||
name = "carnot-engine"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -15,7 +15,7 @@ rand = "0.8"
|
|||
rand_chacha = "0.3"
|
||||
thiserror = "1"
|
||||
fraction = { version = "0.13" }
|
||||
nomos-utils = { path = "../nomos-utils", optional = true }
|
||||
nomos-utils = { path = "../../nomos-utils", optional = true }
|
||||
|
||||
utoipa = { version = "4.0", optional = true }
|
||||
serde_json = { version = "1.0", optional = true }
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::{BTreeMap, HashSet};
|
||||
|
||||
use consensus_engine::{
|
||||
use carnot_engine::{
|
||||
AggregateQc, Block, BlockId, LeaderProof, NodeId, Qc, StandardQc, TimeoutQc, View,
|
||||
};
|
||||
use proptest::prelude::*;
|
||||
|
@ -14,7 +14,7 @@ use crate::fuzz::transition::Transition;
|
|||
// Also, RefState can be used to check invariants of the real state machine in some cases.
|
||||
//
|
||||
// We should try to design this reference state as simple/intuitive as possible,
|
||||
// so that we don't need to replicate the logic implemented in consensus-engine.
|
||||
// so that we don't need to replicate the logic implemented in carnot-engine.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RefState {
|
||||
pub chain: BTreeMap<View, ViewEntry>,
|
|
@ -1,7 +1,7 @@
|
|||
use std::{collections::HashSet, panic};
|
||||
|
||||
use consensus_engine::overlay::FreezeMembership;
|
||||
use consensus_engine::{
|
||||
use carnot_engine::overlay::FreezeMembership;
|
||||
use carnot_engine::{
|
||||
overlay::{FlatOverlay, FlatOverlaySettings, RoundRobin},
|
||||
*,
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashSet;
|
||||
|
||||
use consensus_engine::{Block, NewView, TimeoutQc};
|
||||
use carnot_engine::{Block, NewView, TimeoutQc};
|
||||
|
||||
// State transtitions that will be picked randomly
|
||||
#[derive(Clone, Debug)]
|
|
@ -32,7 +32,7 @@ nomos-da = { path = "../../nomos-services/data-availability", features = ["libp2
|
|||
nomos-system-sig = { path = "../../nomos-services/system-sig" }
|
||||
metrics = { path = "../../nomos-services/metrics", optional = true }
|
||||
tracing-subscriber = "0.3"
|
||||
consensus-engine = { path = "../../consensus-engine" }
|
||||
carnot-engine = { path = "../../consensus/carnot-engine" }
|
||||
tokio = { version = "1.24", features = ["sync"] }
|
||||
serde_json = "1.0"
|
||||
serde_yaml = "0.9"
|
||||
|
|
|
@ -16,7 +16,7 @@ use tower_http::{
|
|||
use utoipa::OpenApi;
|
||||
use utoipa_swagger_ui::SwaggerUi;
|
||||
|
||||
use consensus_engine::BlockId;
|
||||
use carnot_engine::BlockId;
|
||||
use full_replication::{Blob, Certificate};
|
||||
use nomos_core::{da::blob, tx::Transaction};
|
||||
use nomos_mempool::{network::adapters::libp2p::Libp2pAdapter, openapi::Status, MempoolMetrics};
|
||||
|
|
|
@ -2,8 +2,8 @@ pub mod api;
|
|||
mod config;
|
||||
mod tx;
|
||||
|
||||
use carnot_engine::overlay::{RandomBeaconState, RoundRobin, TreeOverlay};
|
||||
use color_eyre::eyre::Result;
|
||||
use consensus_engine::overlay::{RandomBeaconState, RoundRobin, TreeOverlay};
|
||||
use full_replication::Certificate;
|
||||
use full_replication::{AbsoluteNumber, Attestation, Blob, FullReplication};
|
||||
#[cfg(feature = "metrics")]
|
||||
|
|
|
@ -12,7 +12,7 @@ tracing = "0.1"
|
|||
tracing-subscriber = "0.3"
|
||||
async-trait = "0.1"
|
||||
clap = {version = "4", features = ["derive"] }
|
||||
consensus-engine = { path = "../consensus-engine" }
|
||||
carnot-engine = { path = "../consensus/carnot-engine" }
|
||||
serde_yaml = "0.9"
|
||||
futures = "0.3"
|
||||
tokio = { version = "1", features = ["sync"] }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use super::CLIENT;
|
||||
use consensus_engine::{Block, BlockId};
|
||||
use carnot_engine::{Block, BlockId};
|
||||
use nomos_consensus::CarnotInfo;
|
||||
use reqwest::Url;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use super::CLIENT;
|
||||
use consensus_engine::BlockId;
|
||||
use carnot_engine::BlockId;
|
||||
use full_replication::Certificate;
|
||||
use nomos_core::block::Block;
|
||||
use nomos_node::Tx;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::BlockId;
|
||||
use carnot_engine::BlockId;
|
||||
use full_replication::Blob;
|
||||
use nomos_core::da::certificate::Certificate;
|
||||
use reqwest::Url;
|
||||
|
|
|
@ -12,7 +12,7 @@ authors = [
|
|||
async-trait = { version = "0.1" }
|
||||
blake2 = { version = "0.10" }
|
||||
bytes = "1.3"
|
||||
consensus-engine = { path = "../consensus-engine", features = ["serde"]}
|
||||
carnot-engine = { path = "../consensus/carnot-engine", features = ["serde"]}
|
||||
futures = "0.3"
|
||||
raptorq = { version = "1.7", optional = true }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
|
|
@ -8,8 +8,8 @@ use crate::block::Block;
|
|||
use crate::da::certificate::BlobCertificateSelect;
|
||||
use crate::da::certificate::Certificate;
|
||||
use crate::tx::{Transaction, TxSelect};
|
||||
use consensus_engine::overlay::RandomBeaconState;
|
||||
use consensus_engine::{NodeId, Qc, View};
|
||||
use carnot_engine::overlay::RandomBeaconState;
|
||||
use carnot_engine::{NodeId, Qc, View};
|
||||
|
||||
/// Wrapper over a block building `new` method than holds intermediary state and can be
|
||||
/// passed around. It also compounds the transaction selection and blob selection heuristics to be
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
pub mod builder;
|
||||
|
||||
use consensus_engine::overlay::RandomBeaconState;
|
||||
use carnot_engine::overlay::RandomBeaconState;
|
||||
use indexmap::IndexSet;
|
||||
// std
|
||||
use core::hash::Hash;
|
||||
|
@ -11,8 +11,8 @@ use ::serde::{
|
|||
Deserialize, Serialize, Serializer,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
pub use consensus_engine::BlockId;
|
||||
use consensus_engine::{LeaderProof, NodeId, Qc, View};
|
||||
pub use carnot_engine::BlockId;
|
||||
use carnot_engine::{LeaderProof, NodeId, Qc, View};
|
||||
// internal
|
||||
|
||||
pub type TxHash = [u8; 32];
|
||||
|
@ -20,7 +20,7 @@ pub type TxHash = [u8; 32];
|
|||
/// A block
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Block<Tx: Clone + Eq + Hash, BlobCertificate: Clone + Eq + Hash> {
|
||||
header: consensus_engine::Block,
|
||||
header: carnot_engine::Block,
|
||||
beacon: RandomBeaconState,
|
||||
cl_transactions: IndexSet<Tx>,
|
||||
bl_blobs: IndexSet<BlobCertificate>,
|
||||
|
@ -41,7 +41,7 @@ impl<
|
|||
) -> Self {
|
||||
let transactions = txs.collect();
|
||||
let blobs = blobs.collect();
|
||||
let header = consensus_engine::Block {
|
||||
let header = carnot_engine::Block {
|
||||
id: BlockId::zeros(),
|
||||
view,
|
||||
parent_qc,
|
||||
|
@ -62,7 +62,7 @@ impl<
|
|||
}
|
||||
|
||||
impl<Tx: Clone + Eq + Hash, BlobCertificate: Clone + Eq + Hash> Block<Tx, BlobCertificate> {
|
||||
pub fn header(&self) -> &consensus_engine::Block {
|
||||
pub fn header(&self) -> &carnot_engine::Block {
|
||||
&self.header
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ pub fn block_id_from_wire_content<
|
|||
BlobCertificate: Clone + Eq + Hash + Serialize + DeserializeOwned,
|
||||
>(
|
||||
block: &Block<Tx, BlobCertificate>,
|
||||
) -> consensus_engine::BlockId {
|
||||
) -> carnot_engine::BlockId {
|
||||
use blake2::digest::{consts::U32, Digest};
|
||||
use blake2::Blake2b;
|
||||
let bytes = block.as_bytes();
|
||||
|
@ -147,7 +147,7 @@ mod serde {
|
|||
cl_transactions,
|
||||
bl_blobs,
|
||||
} = StrippedBlock::deserialize(deserializer)?;
|
||||
let header = consensus_engine::Block {
|
||||
let header = carnot_engine::Block {
|
||||
id: BlockId::zeros(),
|
||||
view: header.view,
|
||||
parent_qc: header.parent_qc,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// std
|
||||
// crates
|
||||
use consensus_engine::{Block, View};
|
||||
use carnot_engine::{Block, View};
|
||||
use futures::{Stream, StreamExt};
|
||||
use serde::{Deserialize, Serialize};
|
||||
// internal
|
||||
|
|
|
@ -13,7 +13,7 @@ overwatch-rs = { git = "https://github.com/logos-co/Overwatch", rev = "2f70806"
|
|||
overwatch-derive = { git = "https://github.com/logos-co/Overwatch", rev = "ac28d01" }
|
||||
tracing = "0.1"
|
||||
|
||||
consensus-engine = { path = "../../consensus-engine" }
|
||||
carnot-engine = { path = "../../consensus/carnot-engine" }
|
||||
nomos-core = { path = "../../nomos-core" }
|
||||
nomos-consensus = { path = "../../nomos-services/consensus" }
|
||||
nomos-network = { path = "../../nomos-services/network" }
|
||||
|
|
|
@ -4,7 +4,7 @@ use overwatch_rs::overwatch::handle::OverwatchHandle;
|
|||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use consensus_engine::{
|
||||
use carnot_engine::{
|
||||
overlay::{RandomBeaconState, RoundRobin, TreeOverlay},
|
||||
Block, BlockId,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::BlockId;
|
||||
use carnot_engine::BlockId;
|
||||
use nomos_core::block::Block;
|
||||
use nomos_storage::{
|
||||
backends::{sled::SledBackend, StorageSerde},
|
||||
|
|
|
@ -9,7 +9,7 @@ edition = "2021"
|
|||
async-trait = "0.1"
|
||||
bytes = "1.3"
|
||||
chrono = "0.4"
|
||||
consensus-engine = { path = "../../consensus-engine", features = ["serde"] }
|
||||
carnot-engine = { path = "../../consensus/carnot-engine", features = ["serde"] }
|
||||
futures = "0.3"
|
||||
nomos-network = { path = "../network" }
|
||||
nomos-mempool = { path = "../mempool" }
|
||||
|
|
|
@ -6,10 +6,10 @@ use std::hash::Hash;
|
|||
// crates
|
||||
|
||||
// internal
|
||||
use consensus_engine::overlay::{
|
||||
use carnot_engine::overlay::{
|
||||
CommitteeMembership, Error as RandomBeaconError, FreezeMembership, RandomBeaconState,
|
||||
};
|
||||
use consensus_engine::TimeoutQc;
|
||||
use carnot_engine::TimeoutQc;
|
||||
use nomos_core::block::Block;
|
||||
|
||||
pub trait UpdateableCommitteeMembership: CommitteeMembership {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use consensus_engine::overlay::RoundRobin;
|
||||
use consensus_engine::{
|
||||
use carnot_engine::overlay::RoundRobin;
|
||||
use carnot_engine::{
|
||||
overlay::{Error as RandomBeaconError, LeaderSelection, RandomBeaconState},
|
||||
TimeoutQc,
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ use std::pin::Pin;
|
|||
use std::time::Duration;
|
||||
// crates
|
||||
use bls_signatures::PrivateKey;
|
||||
pub use consensus_engine::NodeId;
|
||||
pub use carnot_engine::NodeId;
|
||||
use futures::{Stream, StreamExt};
|
||||
use leader_selection::UpdateableLeaderSelection;
|
||||
use serde::Deserialize;
|
||||
|
@ -28,7 +28,7 @@ use crate::network::NetworkAdapter;
|
|||
use crate::tally::{
|
||||
happy::CarnotTally, timeout::TimeoutTally, unhappy::NewViewTally, CarnotTallySettings,
|
||||
};
|
||||
use consensus_engine::{
|
||||
use carnot_engine::{
|
||||
overlay::RandomBeaconState, AggregateQc, BlockId, Carnot, Committee, LeaderProof, NewView,
|
||||
Overlay, Payload, Qc, StandardQc, Timeout, TimeoutQc, View, Vote,
|
||||
};
|
||||
|
@ -251,7 +251,7 @@ where
|
|||
} = self.service_state.settings_reader.get_updated_settings();
|
||||
|
||||
let overlay = O::new(overlay_settings);
|
||||
let genesis = consensus_engine::Block {
|
||||
let genesis = carnot_engine::Block {
|
||||
id: BlockId::zeros(),
|
||||
view: View::new(0),
|
||||
parent_qc: Qc::Standard(StandardQc::genesis()),
|
||||
|
@ -351,7 +351,7 @@ where
|
|||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum Output<Tx: Clone + Eq + Hash, BlobCertificate: Clone + Eq + Hash> {
|
||||
Send(consensus_engine::Send),
|
||||
Send(carnot_engine::Send),
|
||||
BroadcastTimeoutQc {
|
||||
timeout_qc: TimeoutQc,
|
||||
},
|
||||
|
@ -866,7 +866,7 @@ where
|
|||
|
||||
async fn gather_timeout_qc(
|
||||
adapter: A,
|
||||
view: consensus_engine::View,
|
||||
view: carnot_engine::View,
|
||||
) -> Event<ClPool::Item, DaPool::Item> {
|
||||
if let Some(timeout_qc) = adapter
|
||||
.timeout_qc_stream(view)
|
||||
|
@ -885,7 +885,7 @@ where
|
|||
async fn gather_votes(
|
||||
adapter: A,
|
||||
committee: Committee,
|
||||
block: consensus_engine::Block,
|
||||
block: carnot_engine::Block,
|
||||
tally: CarnotTallySettings,
|
||||
) -> Event<ClPool::Item, DaPool::Item> {
|
||||
let tally = CarnotTally::new(tally);
|
||||
|
@ -925,7 +925,7 @@ where
|
|||
async fn gather_timeout(
|
||||
adapter: A,
|
||||
committee: Committee,
|
||||
view: consensus_engine::View,
|
||||
view: carnot_engine::View,
|
||||
tally: CarnotTallySettings,
|
||||
) -> Event<ClPool::Item, DaPool::Item> {
|
||||
let tally = TimeoutTally::new(tally);
|
||||
|
@ -941,7 +941,7 @@ where
|
|||
#[instrument(level = "debug", skip(adapter))]
|
||||
async fn gather_block(
|
||||
adapter: A,
|
||||
view: consensus_engine::View,
|
||||
view: carnot_engine::View,
|
||||
) -> Event<ClPool::Item, DaPool::Item> {
|
||||
let stream = adapter
|
||||
.proposal_chunks_stream(view)
|
||||
|
@ -1011,7 +1011,7 @@ where
|
|||
C: Clone + Eq + Hash + Serialize + DeserializeOwned,
|
||||
{
|
||||
match output {
|
||||
Output::Send(consensus_engine::Send { to, payload }) => match payload {
|
||||
Output::Send(carnot_engine::Send { to, payload }) => match payload {
|
||||
Payload::Vote(vote) => {
|
||||
adapter
|
||||
.send(
|
||||
|
@ -1076,7 +1076,7 @@ enum Event<Tx: Clone + Hash + Eq, BlobCertificate: Clone + Eq + Hash> {
|
|||
#[allow(dead_code)]
|
||||
Approve {
|
||||
qc: Qc,
|
||||
block: consensus_engine::Block,
|
||||
block: carnot_engine::Block,
|
||||
votes: HashSet<Vote>,
|
||||
},
|
||||
LocalTimeout {
|
||||
|
@ -1109,7 +1109,7 @@ pub enum ConsensusMsg {
|
|||
GetBlocks {
|
||||
from: Option<BlockId>,
|
||||
to: Option<BlockId>,
|
||||
tx: Sender<Vec<consensus_engine::Block>>,
|
||||
tx: Sender<Vec<carnot_engine::Block>>,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1123,9 +1123,9 @@ pub struct CarnotInfo {
|
|||
pub current_view: View,
|
||||
pub highest_voted_view: View,
|
||||
pub local_high_qc: StandardQc,
|
||||
pub tip: consensus_engine::Block,
|
||||
pub tip: carnot_engine::Block,
|
||||
pub last_view_timeout_qc: Option<TimeoutQc>,
|
||||
pub last_committed_block: consensus_engine::Block,
|
||||
pub last_committed_block: carnot_engine::Block,
|
||||
}
|
||||
|
||||
async fn get_mempool_contents<Item, Key>(
|
||||
|
@ -1160,7 +1160,7 @@ async fn mark_in_block<Item, Key>(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use consensus_engine::Block;
|
||||
use carnot_engine::Block;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::network::{
|
|||
messages::{NetworkMessage, ProposalMsg, VoteMsg},
|
||||
BoxedStream, NetworkAdapter,
|
||||
};
|
||||
use consensus_engine::{BlockId, Committee, CommitteeId, View};
|
||||
use carnot_engine::{BlockId, Committee, CommitteeId, View};
|
||||
use nomos_core::wire;
|
||||
use nomos_network::{
|
||||
backends::libp2p::{Command, Event, EventKind, Libp2p},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
// internal
|
||||
use crate::NodeId;
|
||||
use consensus_engine::{BlockId, NewView, Qc, Timeout, TimeoutQc, View, Vote};
|
||||
use carnot_engine::{BlockId, NewView, Qc, Timeout, TimeoutQc, View, Vote};
|
||||
use nomos_core::wire;
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq, Hash)]
|
||||
|
|
|
@ -8,7 +8,7 @@ use futures::Stream;
|
|||
use crate::network::messages::{
|
||||
NetworkMessage, NewViewMsg, ProposalMsg, TimeoutMsg, TimeoutQcMsg, VoteMsg,
|
||||
};
|
||||
use consensus_engine::{BlockId, Committee, View};
|
||||
use carnot_engine::{BlockId, Committee, View};
|
||||
use nomos_network::backends::NetworkBackend;
|
||||
use nomos_network::NetworkService;
|
||||
use overwatch_rs::services::relay::OutboundRelay;
|
||||
|
|
|
@ -8,7 +8,7 @@ use futures::{Stream, StreamExt};
|
|||
// internal
|
||||
use super::CarnotTallySettings;
|
||||
use crate::network::messages::VoteMsg;
|
||||
use consensus_engine::{Block, Qc, StandardQc, Vote};
|
||||
use carnot_engine::{Block, Qc, StandardQc, Vote};
|
||||
use nomos_core::crypto::PublicKey;
|
||||
use nomos_core::vote::Tally;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ pub mod unhappy;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// internal
|
||||
use consensus_engine::Committee;
|
||||
use carnot_engine::Committee;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct CarnotTallySettings {
|
||||
|
|
|
@ -5,7 +5,7 @@ use futures::{Stream, StreamExt};
|
|||
// internal
|
||||
use super::CarnotTallySettings;
|
||||
use crate::network::messages::TimeoutMsg;
|
||||
use consensus_engine::{Timeout, View};
|
||||
use carnot_engine::{Timeout, View};
|
||||
use nomos_core::vote::Tally;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
|||
// internal
|
||||
use super::CarnotTallySettings;
|
||||
use crate::network::messages::NewViewMsg;
|
||||
use consensus_engine::{NewView, TimeoutQc};
|
||||
use carnot_engine::{NewView, TimeoutQc};
|
||||
use nomos_core::vote::Tally;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
|
|
|
@ -20,7 +20,7 @@ ctrlc = "3.4"
|
|||
chrono = { version = "0.4", features = ["serde"] }
|
||||
crc32fast = "1.3"
|
||||
crossbeam = { version = "0.8.2", features = ["crossbeam-channel"] }
|
||||
consensus-engine = { path = "../consensus-engine", features = ["simulation"] }
|
||||
carnot-engine = { path = "../consensus/carnot-engine", features = ["simulation"] }
|
||||
fixed-slice-deque = "0.1.0-beta2"
|
||||
futures = "0.3"
|
||||
humantime = "2.1"
|
||||
|
|
|
@ -5,9 +5,9 @@ use std::sync::Arc;
|
|||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
// crates
|
||||
use anyhow::Ok;
|
||||
use carnot_engine::overlay::RandomBeaconState;
|
||||
use carnot_engine::{Block, View};
|
||||
use clap::Parser;
|
||||
use consensus_engine::overlay::RandomBeaconState;
|
||||
use consensus_engine::{Block, View};
|
||||
use crossbeam::channel;
|
||||
use parking_lot::Mutex;
|
||||
use rand::rngs::SmallRng;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use consensus_engine::overlay::{BranchOverlay, FisherYatesShuffle, RandomBeaconState};
|
||||
use consensus_engine::Overlay;
|
||||
use consensus_engine::{
|
||||
use carnot_engine::overlay::{BranchOverlay, FisherYatesShuffle, RandomBeaconState};
|
||||
use carnot_engine::Overlay;
|
||||
use carnot_engine::{
|
||||
overlay::{FlatOverlay, FreezeMembership, RoundRobin, TreeOverlay},
|
||||
NodeId,
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ pub fn overlay_info(
|
|||
match &overlay_settings {
|
||||
simulations::settings::OverlaySettings::Flat => {
|
||||
FlatOverlay::<RoundRobin, FisherYatesShuffle>::new(
|
||||
consensus_engine::overlay::FlatOverlaySettings {
|
||||
carnot_engine::overlay::FlatOverlaySettings {
|
||||
nodes: nodes.to_vec(),
|
||||
leader: RoundRobin::new(),
|
||||
leader_super_majority_threshold: None,
|
||||
|
@ -31,7 +31,7 @@ pub fn overlay_info(
|
|||
.info()
|
||||
}
|
||||
simulations::settings::OverlaySettings::Tree(tree_settings) => {
|
||||
TreeOverlay::new(consensus_engine::overlay::TreeOverlaySettings {
|
||||
TreeOverlay::new(carnot_engine::overlay::TreeOverlaySettings {
|
||||
nodes,
|
||||
current_leader: leader,
|
||||
number_of_committees: tree_settings.number_of_committees,
|
||||
|
@ -42,7 +42,7 @@ pub fn overlay_info(
|
|||
.info()
|
||||
}
|
||||
simulations::settings::OverlaySettings::Branch(branch_settings) => {
|
||||
BranchOverlay::new(consensus_engine::overlay::BranchOverlaySettings {
|
||||
BranchOverlay::new(carnot_engine::overlay::BranchOverlaySettings {
|
||||
nodes,
|
||||
current_leader: leader,
|
||||
branch_depth: branch_settings.branch_depth,
|
||||
|
@ -73,7 +73,7 @@ pub fn to_overlay_node<R: Rng>(
|
|||
};
|
||||
match &settings.overlay_settings {
|
||||
simulations::settings::OverlaySettings::Flat => {
|
||||
let overlay_settings = consensus_engine::overlay::FlatOverlaySettings {
|
||||
let overlay_settings = carnot_engine::overlay::FlatOverlaySettings {
|
||||
nodes: nodes.to_vec(),
|
||||
leader: RoundRobin::new(),
|
||||
leader_super_majority_threshold: None,
|
||||
|
@ -94,7 +94,7 @@ pub fn to_overlay_node<R: Rng>(
|
|||
)
|
||||
}
|
||||
simulations::settings::OverlaySettings::Tree(tree_settings) => {
|
||||
let overlay_settings = consensus_engine::overlay::TreeOverlaySettings {
|
||||
let overlay_settings = carnot_engine::overlay::TreeOverlaySettings {
|
||||
nodes,
|
||||
current_leader: leader,
|
||||
number_of_committees: tree_settings.number_of_committees,
|
||||
|
@ -118,7 +118,7 @@ pub fn to_overlay_node<R: Rng>(
|
|||
)
|
||||
}
|
||||
simulations::settings::OverlaySettings::Branch(branch_settings) => {
|
||||
let overlay_settings = consensus_engine::overlay::BranchOverlaySettings {
|
||||
let overlay_settings = carnot_engine::overlay::BranchOverlaySettings {
|
||||
nodes,
|
||||
current_leader: leader,
|
||||
branch_depth: branch_settings.branch_depth,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::NodeId;
|
||||
use carnot_engine::NodeId;
|
||||
// std
|
||||
use rand::{seq::SliceRandom, Rng};
|
||||
use std::{collections::HashMap, str::FromStr};
|
||||
|
@ -157,7 +157,7 @@ pub fn create_regions<R: Rng>(
|
|||
mod tests {
|
||||
use std::collections::HashMap;
|
||||
|
||||
use consensus_engine::NodeId;
|
||||
use carnot_engine::NodeId;
|
||||
use rand::rngs::mock::StepRng;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::node::carnot::{messages::CarnotMessage, tally::Tally, timeout::TimeoutHandler};
|
||||
use consensus_engine::{
|
||||
use carnot_engine::{
|
||||
AggregateQc, Carnot, NewView, Overlay, Qc, StandardQc, Timeout, TimeoutQc, View, Vote,
|
||||
};
|
||||
use nomos_consensus::network::messages::{NewViewMsg, TimeoutMsg, VoteMsg};
|
||||
|
@ -236,7 +236,7 @@ pub enum Event<Tx: Clone + Hash + Eq> {
|
|||
#[allow(dead_code)]
|
||||
Approve {
|
||||
qc: Qc,
|
||||
block: consensus_engine::Block,
|
||||
block: carnot_engine::Block,
|
||||
votes: HashSet<Vote>,
|
||||
},
|
||||
ProposeBlock {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::node::carnot::messages::CarnotMessage;
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub(crate) struct MessageCache {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use nomos_consensus::network::messages::{
|
||||
NewViewMsg, ProposalMsg, TimeoutMsg, TimeoutQcMsg, VoteMsg,
|
||||
};
|
||||
|
|
|
@ -29,8 +29,8 @@ use crate::output_processors::{Record, RecordType, Runtime};
|
|||
use crate::settings::SimulationSettings;
|
||||
use crate::streaming::SubscriberFormat;
|
||||
use crate::warding::SimulationState;
|
||||
use consensus_engine::overlay::RandomBeaconState;
|
||||
use consensus_engine::{
|
||||
use carnot_engine::overlay::RandomBeaconState;
|
||||
use carnot_engine::{
|
||||
Block, BlockId, Carnot, Committee, Overlay, Payload, Qc, StandardQc, TimeoutQc, View, Vote,
|
||||
};
|
||||
use nomos_consensus::committee_membership::UpdateableCommitteeMembership;
|
||||
|
@ -67,7 +67,7 @@ impl CarnotSettings {
|
|||
|
||||
#[allow(dead_code)] // TODO: remove when handling settings
|
||||
pub struct CarnotNode<O: Overlay> {
|
||||
id: consensus_engine::NodeId,
|
||||
id: carnot_engine::NodeId,
|
||||
state: CarnotState,
|
||||
/// A step counter
|
||||
current_step: usize,
|
||||
|
@ -87,7 +87,7 @@ impl<
|
|||
> CarnotNode<O>
|
||||
{
|
||||
pub fn new<R: Rng>(
|
||||
id: consensus_engine::NodeId,
|
||||
id: carnot_engine::NodeId,
|
||||
settings: CarnotSettings,
|
||||
overlay_settings: O::Settings,
|
||||
genesis: nomos_core::block::Block<CarnotTx, CarnotBlob>,
|
||||
|
@ -122,7 +122,7 @@ impl<
|
|||
|
||||
fn handle_output(&self, output: Output<CarnotTx, CarnotBlob>) {
|
||||
match output {
|
||||
Output::Send(consensus_engine::Send {
|
||||
Output::Send(carnot_engine::Send {
|
||||
to,
|
||||
payload: Payload::Vote(vote),
|
||||
}) => {
|
||||
|
@ -140,7 +140,7 @@ impl<
|
|||
);
|
||||
}
|
||||
}
|
||||
Output::Send(consensus_engine::Send {
|
||||
Output::Send(carnot_engine::Send {
|
||||
to,
|
||||
payload: Payload::NewView(new_view),
|
||||
}) => {
|
||||
|
@ -154,7 +154,7 @@ impl<
|
|||
);
|
||||
}
|
||||
}
|
||||
Output::Send(consensus_engine::Send {
|
||||
Output::Send(carnot_engine::Send {
|
||||
to,
|
||||
payload: Payload::Timeout(timeout),
|
||||
}) => {
|
||||
|
@ -226,7 +226,7 @@ impl<
|
|||
"Parent committee of non root committee members should be present",
|
||||
)
|
||||
};
|
||||
output = Some(Output::Send(consensus_engine::Send {
|
||||
output = Some(Output::Send(carnot_engine::Send {
|
||||
to,
|
||||
payload: Payload::Vote(Vote {
|
||||
view: self.engine.current_view(),
|
||||
|
@ -440,7 +440,7 @@ impl<
|
|||
#[derive(Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum Output<Tx: Clone + Eq + Hash, Blob: Clone + Eq + Hash> {
|
||||
Send(consensus_engine::Send),
|
||||
Send(carnot_engine::Send),
|
||||
BroadcastTimeoutQc {
|
||||
timeout_qc: TimeoutQc,
|
||||
},
|
||||
|
|
|
@ -10,7 +10,7 @@ use self::{
|
|||
standard_qc::StandardQcHelper,
|
||||
timeout_qc::TimeoutQcHelper,
|
||||
};
|
||||
use consensus_engine::{AggregateQc, Block, BlockId, Committee, Qc, StandardQc, TimeoutQc, View};
|
||||
use carnot_engine::{AggregateQc, Block, BlockId, Committee, Qc, StandardQc, TimeoutQc, View};
|
||||
|
||||
const NODE_ID: &str = "node_id";
|
||||
const CURRENT_VIEW: &str = "current_view";
|
||||
|
@ -208,7 +208,7 @@ pub(crate) mod qc {
|
|||
|
||||
pub(crate) mod timeout_qc {
|
||||
use super::*;
|
||||
use consensus_engine::NodeId;
|
||||
use carnot_engine::NodeId;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct TimeoutQcHelper<'a> {
|
||||
|
@ -238,7 +238,7 @@ pub(crate) mod timeout_qc {
|
|||
}
|
||||
|
||||
pub(crate) mod serde_id {
|
||||
use consensus_engine::{BlockId, NodeId};
|
||||
use carnot_engine::{BlockId, NodeId};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use serde_block::BlockHelper;
|
|||
serializer!(CarnotStateCsvSerializer);
|
||||
|
||||
pub(crate) mod serde_block {
|
||||
use consensus_engine::LeaderProof;
|
||||
use carnot_engine::LeaderProof;
|
||||
|
||||
use super::{qc::QcHelper, *};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ serializer!(CarnotStateJsonSerializer);
|
|||
pub(super) type LocalHighQcHelper<'a> = super::standard_qc::StandardQcHelper<'a>;
|
||||
|
||||
pub(crate) mod serde_block {
|
||||
use consensus_engine::LeaderProof;
|
||||
use carnot_engine::LeaderProof;
|
||||
|
||||
use super::{qc::QcHelper, *};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
pub(crate) struct Tally<T: core::hash::Hash + Eq + Clone> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
#[cfg(feature = "polars")]
|
||||
use polars::export::ahash::HashMap;
|
||||
#[cfg(not(feature = "polars"))]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// std
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::time::Duration;
|
||||
// crates
|
||||
|
@ -432,7 +432,7 @@ mod tests {
|
|||
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use crossbeam::channel;
|
||||
use parking_lot::RwLock;
|
||||
use rand::{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ pub mod dummy;
|
|||
pub mod dummy_streaming;
|
||||
|
||||
// std
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
ops::{Deref, DerefMut},
|
||||
|
@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
|
|||
// internal
|
||||
use crate::overlay::tests::{Layout, OverlaySettings, SimulationOverlay};
|
||||
|
||||
pub use consensus_engine::NodeId;
|
||||
pub use carnot_engine::NodeId;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::{CommitteeId, NodeId, Overlay};
|
||||
use carnot_engine::{CommitteeId, NodeId, Overlay};
|
||||
use serde::Serialize;
|
||||
use std::collections::{BTreeSet, HashMap, VecDeque};
|
||||
|
||||
|
@ -58,7 +58,7 @@ impl<T: Overlay> OverlayInfoExt for T {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use consensus_engine::{
|
||||
use carnot_engine::{
|
||||
overlay::{
|
||||
BranchOverlay, BranchOverlaySettings, FisherYatesShuffle, RoundRobin, TreeOverlay,
|
||||
TreeOverlaySettings,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::NodeId;
|
||||
use carnot_engine::NodeId;
|
||||
// std
|
||||
// crates
|
||||
use rand::prelude::IteratorRandom;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// std
|
||||
use consensus_engine::NodeId;
|
||||
use carnot_engine::NodeId;
|
||||
use std::collections::HashMap;
|
||||
// crates
|
||||
use rand::seq::IteratorRandom;
|
||||
|
|
|
@ -83,7 +83,7 @@ mod tests {
|
|||
settings::SimulationSettings,
|
||||
streaming::StreamProducer,
|
||||
};
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use crossbeam::channel;
|
||||
use parking_lot::RwLock;
|
||||
use rand::rngs::mock::StepRng;
|
||||
|
|
|
@ -117,7 +117,7 @@ where
|
|||
mod tests {
|
||||
use std::{collections::HashMap, time::Duration};
|
||||
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
|
||||
use crate::{
|
||||
network::{
|
||||
|
|
|
@ -196,7 +196,7 @@ fn write_csv_record<W: std::io::Write, R: Record>(
|
|||
mod tests {
|
||||
use std::{collections::HashMap, time::Duration};
|
||||
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
|
||||
use crate::{
|
||||
network::{
|
||||
|
|
|
@ -103,7 +103,7 @@ where
|
|||
mod tests {
|
||||
use std::{collections::HashMap, time::Duration};
|
||||
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
|
||||
use crate::{
|
||||
network::{
|
||||
|
|
|
@ -103,7 +103,7 @@ where
|
|||
mod tests {
|
||||
use std::{collections::HashMap, time::Duration};
|
||||
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
|
||||
use crate::{
|
||||
network::{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::warding::{SimulationState, SimulationWard};
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// MinMaxView. It monitors the gap between a min view and max view, triggers when surpassing
|
||||
|
@ -29,7 +29,7 @@ impl<S, T> SimulationWard<S, T> for MinMaxViewWard {
|
|||
mod test {
|
||||
use crate::warding::minmax::MinMaxViewWard;
|
||||
use crate::warding::{SimulationState, SimulationWard};
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::warding::{SimulationState, SimulationWard};
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Time to finality ward. It monitors the amount of rounds of the simulations, triggers when surpassing
|
||||
|
@ -25,7 +25,7 @@ impl<S, T> SimulationWard<S, T> for MaxViewWard {
|
|||
mod test {
|
||||
use crate::warding::ttf::MaxViewWard;
|
||||
use crate::warding::{SimulationState, SimulationWard};
|
||||
use consensus_engine::View;
|
||||
use carnot_engine::View;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ nomos-log = { path = "../nomos-services/log" }
|
|||
nomos-api = { path = "../nomos-services/api" }
|
||||
overwatch-rs = { git = "https://github.com/logos-co/Overwatch", rev = "2f70806" }
|
||||
nomos-core = { path = "../nomos-core" }
|
||||
consensus-engine = { path = "../consensus-engine", features = ["serde"] }
|
||||
carnot-engine = { path = "../consensus/carnot-engine", features = ["serde"] }
|
||||
nomos-mempool = { path = "../nomos-services/mempool", features = ["mock", "libp2p"] }
|
||||
nomos-da = { path = "../nomos-services/data-availability" }
|
||||
full-replication = { path = "../nomos-da/full-replication" }
|
||||
|
|
|
@ -4,8 +4,8 @@ use std::process::{Child, Command, Stdio};
|
|||
use std::time::Duration;
|
||||
// internal
|
||||
use crate::{adjust_timeout, get_available_port, ConsensusConfig, MixnetConfig, Node, SpawnConfig};
|
||||
use consensus_engine::overlay::{RandomBeaconState, RoundRobin, TreeOverlay, TreeOverlaySettings};
|
||||
use consensus_engine::{BlockId, NodeId, Overlay};
|
||||
use carnot_engine::overlay::{RandomBeaconState, RoundRobin, TreeOverlay, TreeOverlaySettings};
|
||||
use carnot_engine::{BlockId, NodeId, Overlay};
|
||||
use full_replication::Certificate;
|
||||
use mixnet_client::{MixnetClientConfig, MixnetClientMode};
|
||||
use mixnet_node::MixnetNodeConfig;
|
||||
|
@ -151,7 +151,7 @@ impl NomosNode {
|
|||
&self,
|
||||
from: Option<BlockId>,
|
||||
to: Option<BlockId>,
|
||||
) -> Vec<consensus_engine::Block> {
|
||||
) -> Vec<carnot_engine::Block> {
|
||||
let mut req = CLIENT.get(format!("http://{}/{}", self.addr, GET_BLOCKS_INFO));
|
||||
|
||||
if let Some(from) = from {
|
||||
|
@ -165,7 +165,7 @@ impl NomosNode {
|
|||
req.send()
|
||||
.await
|
||||
.unwrap()
|
||||
.json::<Vec<consensus_engine::Block>>()
|
||||
.json::<Vec<carnot_engine::Block>>()
|
||||
.await
|
||||
.unwrap()
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::{Qc, View};
|
||||
use carnot_engine::{Qc, View};
|
||||
use futures::stream::{self, StreamExt};
|
||||
use std::collections::HashSet;
|
||||
use std::time::Duration;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use consensus_engine::{Block, NodeId, TimeoutQc, View};
|
||||
use carnot_engine::{Block, NodeId, TimeoutQc, View};
|
||||
use fraction::Fraction;
|
||||
use futures::stream::{self, StreamExt};
|
||||
use nomos_consensus::CarnotInfo;
|
||||
|
|
Loading…
Reference in New Issue