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