From 10c3879cd30bf0172996cfbf48ab5c991e767eaf Mon Sep 17 00:00:00 2001 From: Simon Paitrault Date: Thu, 8 Feb 2024 18:43:30 +0100 Subject: [PATCH] refactor: tce-broadcast config (#444) Signed-off-by: Simon Paitrault --- Cargo.lock | 21 +----- crates/topos-config/Cargo.toml | 7 +- crates/topos-config/src/tce.rs | 70 +++---------------- crates/topos-config/src/tce/broadcast.rs | 24 +++++++ crates/topos-config/src/tce/p2p.rs | 64 +++++++++++++++++ crates/topos-tce-broadcast/Cargo.toml | 2 +- .../benches/task_manager.rs | 2 +- .../src/double_echo/broadcast_state.rs | 2 +- .../src/double_echo/mod.rs | 3 +- .../src/event.rs} | 33 --------- crates/topos-tce-broadcast/src/lib.rs | 4 +- .../src/task_manager/mod.rs | 3 +- crates/topos-tce-broadcast/src/tests/mod.rs | 2 +- .../src/tests/task_manager.rs | 2 +- crates/topos-tce-proxy/Cargo.toml | 1 - crates/topos-tce-transport/Cargo.toml | 17 ----- crates/topos-tce/Cargo.toml | 1 - crates/topos-tce/src/app_context.rs | 2 +- crates/topos-tce/src/app_context/protocol.rs | 11 +-- crates/topos-tce/src/tests/mod.rs | 4 +- crates/topos-test-sdk/Cargo.toml | 2 +- crates/topos-test-sdk/src/tce/protocol.rs | 3 +- crates/topos/Cargo.toml | 2 - .../src/components/node/services/process.rs | 2 +- 24 files changed, 119 insertions(+), 165 deletions(-) create mode 100644 crates/topos-config/src/tce/broadcast.rs create mode 100644 crates/topos-config/src/tce/p2p.rs rename crates/{topos-tce-transport/src/lib.rs => topos-tce-broadcast/src/event.rs} (51%) delete mode 100644 crates/topos-tce-transport/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index a1bfac207..973cb7ffa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7719,7 +7719,6 @@ dependencies = [ "topos-tce-gatekeeper", "topos-tce-storage", "topos-tce-synchronizer", - "topos-tce-transport", "topos-test-sdk", "topos-wallet", "tower", @@ -7807,16 +7806,13 @@ dependencies = [ "tokio-util", "toml 0.7.8", "tonic 0.10.2", - "topos-certificate-spammer", "topos-core", "topos-p2p", - "topos-sequencer", "topos-tce-api", "topos-tce-broadcast", "topos-tce-gatekeeper", "topos-tce-storage", "topos-tce-synchronizer", - "topos-tce-transport", "topos-test-sdk", "topos-wallet", "tower", @@ -8030,7 +8026,6 @@ dependencies = [ "topos-tce-gatekeeper", "topos-tce-storage", "topos-tce-synchronizer", - "topos-tce-transport", "topos-telemetry", "topos-test-sdk", "tracing", @@ -8103,11 +8098,11 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", + "topos-config", "topos-core", "topos-crypto", "topos-metrics", "topos-tce-storage", - "topos-tce-transport", "topos-test-sdk", "tracing", "tracing-subscriber", @@ -8157,7 +8152,6 @@ dependencies = [ "topos-core", "topos-tce", "topos-tce-storage", - "topos-tce-transport", "topos-telemetry", "topos-test-sdk", "tracing", @@ -8220,17 +8214,6 @@ dependencies = [ "uuid 1.7.0", ] -[[package]] -name = "topos-tce-transport" -version = "0.1.0" -dependencies = [ - "clap 4.4.18", - "serde", - "topos-core", - "topos-crypto", - "tracing", -] - [[package]] name = "topos-telemetry" version = "0.1.0" @@ -8262,6 +8245,7 @@ dependencies = [ "tokio-util", "tonic 0.10.2", "tonic-build", + "topos-config", "topos-core", "topos-crypto", "topos-p2p", @@ -8271,7 +8255,6 @@ dependencies = [ "topos-tce-gatekeeper", "topos-tce-storage", "topos-tce-synchronizer", - "topos-tce-transport", "tower", "tracing", ] diff --git a/crates/topos-config/Cargo.toml b/crates/topos-config/Cargo.toml index e29b523de..b6b40c83d 100644 --- a/crates/topos-config/Cargo.toml +++ b/crates/topos-config/Cargo.toml @@ -7,11 +7,7 @@ edition = "2021" [dependencies] topos-p2p = { path = "../topos-p2p" } -topos-tce-transport = { path = "../topos-tce-transport" } -topos-sequencer = { path = "../topos-sequencer" } -topos-core = { workspace = true, features = ["api"] } -topos-certificate-spammer = { path = "../topos-certificate-spammer" } -topos-tce-broadcast = { path = "../topos-tce-broadcast", optional = true } +topos-core = { path = "../topos-core" } topos-wallet = { path = "../topos-wallet" } async-stream.workspace = true @@ -48,7 +44,6 @@ openssl = { version = "0.10.61", features = ["vendored"] } [dev-dependencies] topos-tce-broadcast = { path = "../topos-tce-broadcast" } -topos-tce-transport = { path = "../topos-tce-transport" } topos-tce-synchronizer = { path = "../topos-tce-synchronizer" } topos-tce-gatekeeper = { path = "../topos-tce-gatekeeper" } topos-tce-api = { path = "../topos-tce-api" } diff --git a/crates/topos-config/src/tce.rs b/crates/topos-config/src/tce.rs index 22f208c0f..f2c2dec18 100644 --- a/crates/topos-config/src/tce.rs +++ b/crates/topos-config/src/tce.rs @@ -9,11 +9,16 @@ use figment::{ use serde::{Deserialize, Serialize}; use topos_core::types::ValidatorId; use topos_p2p::config::NetworkConfig; -use topos_tce_transport::ReliableBroadcastParams; use crate::Config; use topos_p2p::{Multiaddr, PeerId}; +use self::broadcast::ReliableBroadcastParams; +use self::p2p::P2PConfig; + +pub mod broadcast; +pub mod p2p; + const DEFAULT_IP: std::net::Ipv4Addr = std::net::Ipv4Addr::new(0, 0, 0, 0); #[derive(Debug)] @@ -83,72 +88,13 @@ pub struct TceConfig { pub network_bootstrap_timeout: u64, } -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "kebab-case")] -pub struct P2PConfig { - /// List of multiaddresses to listen for incoming connections - #[serde(default = "default_listen_addresses")] - pub listen_addresses: Vec, - /// List of multiaddresses to advertise to the network - #[serde(default = "default_public_addresses")] - pub public_addresses: Vec, - - #[serde(skip)] - pub is_bootnode: bool, -} - -impl Default for P2PConfig { - fn default() -> Self { - Self { - listen_addresses: default_listen_addresses(), - public_addresses: default_public_addresses(), - is_bootnode: false, - } - } -} - -fn default_db_path() -> PathBuf { - PathBuf::from("./tce_rocksdb") -} - const fn default_network_bootstrap_timeout() -> u64 { 90 } -const fn default_libp2p_api_addr() -> SocketAddr { - SocketAddr::V4(std::net::SocketAddrV4::new(DEFAULT_IP, 9090)) -} - -fn default_listen_addresses() -> Vec { - vec![format!( - "/ip4/{}/tcp/{}", - default_libp2p_api_addr().ip(), - default_libp2p_api_addr().port() - ) - .parse() - .expect( - r#" - Listen multiaddresses generation failure. - This is a critical bug that need to be report on `https://github.com/topos-protocol/topos/issues` - "#, - )] -} - -fn default_public_addresses() -> Vec { - vec![format!( - "/ip4/{}/tcp/{}", - default_libp2p_api_addr().ip(), - default_libp2p_api_addr().port() - ) - .parse() - .expect( - r#" - Public multiaddresses generation failure. - This is a critical bug that need to be report on `https://github.com/topos-protocol/topos/issues` - "#, - )] +fn default_db_path() -> PathBuf { + PathBuf::from("./tce_rocksdb") } - const fn default_minimum_tce_cluster_size() -> usize { NetworkConfig::MINIMUM_CLUSTER_SIZE } diff --git a/crates/topos-config/src/tce/broadcast.rs b/crates/topos-config/src/tce/broadcast.rs new file mode 100644 index 000000000..8a4121110 --- /dev/null +++ b/crates/topos-config/src/tce/broadcast.rs @@ -0,0 +1,24 @@ +use serde::{Deserialize, Serialize}; + +/// Broadcast threshold configurations +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct ReliableBroadcastParams { + /// Echo threshold + pub echo_threshold: usize, + /// Ready threshold + pub ready_threshold: usize, + /// Delivery threshold + pub delivery_threshold: usize, +} + +impl ReliableBroadcastParams { + pub const fn new(n: usize) -> Self { + let f: usize = n / 3; + + Self { + echo_threshold: 1 + (n + f) / 2, + ready_threshold: 1 + f, + delivery_threshold: 2 * f + 1, + } + } +} diff --git a/crates/topos-config/src/tce/p2p.rs b/crates/topos-config/src/tce/p2p.rs new file mode 100644 index 000000000..3c109099d --- /dev/null +++ b/crates/topos-config/src/tce/p2p.rs @@ -0,0 +1,64 @@ +use std::net::SocketAddr; + +use serde::{Deserialize, Serialize}; +use topos_p2p::Multiaddr; + +use super::DEFAULT_IP; + +#[derive(Serialize, Deserialize, Debug, Clone)] +#[serde(rename_all = "kebab-case")] +pub struct P2PConfig { + /// List of multiaddresses to listen for incoming connections + #[serde(default = "default_listen_addresses")] + pub listen_addresses: Vec, + /// List of multiaddresses to advertise to the network + #[serde(default = "default_public_addresses")] + pub public_addresses: Vec, + + #[serde(skip)] + pub is_bootnode: bool, +} + +impl Default for P2PConfig { + fn default() -> Self { + Self { + listen_addresses: default_listen_addresses(), + public_addresses: default_public_addresses(), + is_bootnode: false, + } + } +} + +const fn default_libp2p_api_addr() -> SocketAddr { + SocketAddr::V4(std::net::SocketAddrV4::new(DEFAULT_IP, 9090)) +} + +fn default_listen_addresses() -> Vec { + vec![format!( + "/ip4/{}/tcp/{}", + default_libp2p_api_addr().ip(), + default_libp2p_api_addr().port() + ) + .parse() + .expect( + r#" + Listen multiaddresses generation failure. + This is a critical bug that need to be report on `https://github.com/topos-protocol/topos/issues` + "#, + )] +} + +fn default_public_addresses() -> Vec { + vec![format!( + "/ip4/{}/tcp/{}", + default_libp2p_api_addr().ip(), + default_libp2p_api_addr().port() + ) + .parse() + .expect( + r#" + Public multiaddresses generation failure. + This is a critical bug that need to be report on `https://github.com/topos-protocol/topos/issues` + "#, + )] +} diff --git a/crates/topos-tce-broadcast/Cargo.toml b/crates/topos-tce-broadcast/Cargo.toml index 05d29aa2e..616cfc1f7 100644 --- a/crates/topos-tce-broadcast/Cargo.toml +++ b/crates/topos-tce-broadcast/Cargo.toml @@ -19,8 +19,8 @@ tokio-stream = { workspace = true, features = ["sync"] } tokio-util.workspace = true tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] } tracing.workspace = true -tce_transport = { package = "topos-tce-transport", path = "../topos-tce-transport"} topos-core = { workspace = true, features = ["uci"] } +topos-config = { path = "../topos-config/" } topos-metrics = { path = "../topos-metrics/" } topos-tce-storage = { path = "../topos-tce-storage/" } topos-crypto = { path = "../topos-crypto" } diff --git a/crates/topos-tce-broadcast/benches/task_manager.rs b/crates/topos-tce-broadcast/benches/task_manager.rs index 73be180f7..6a7b57561 100644 --- a/crates/topos-tce-broadcast/benches/task_manager.rs +++ b/crates/topos-tce-broadcast/benches/task_manager.rs @@ -1,8 +1,8 @@ use std::collections::HashSet; use std::str::FromStr; use std::sync::Arc; -use tce_transport::ReliableBroadcastParams; use tokio::sync::{broadcast, mpsc, oneshot}; +use topos_config::tce::broadcast::ReliableBroadcastParams; use topos_core::types::ValidatorId; use topos_crypto::messages::MessageSigner; use topos_tce_broadcast::double_echo::DoubleEcho; diff --git a/crates/topos-tce-broadcast/src/double_echo/broadcast_state.rs b/crates/topos-tce-broadcast/src/double_echo/broadcast_state.rs index ee82d7393..cfc762785 100644 --- a/crates/topos-tce-broadcast/src/double_echo/broadcast_state.rs +++ b/crates/topos-tce-broadcast/src/double_echo/broadcast_state.rs @@ -1,7 +1,7 @@ +use crate::event::ProtocolEvents; use crate::sampler::SubscriptionsView; use std::sync::Arc; use std::{collections::HashSet, time}; -use tce_transport::ProtocolEvents; use tokio::sync::mpsc; use topos_core::{ types::{ diff --git a/crates/topos-tce-broadcast/src/double_echo/mod.rs b/crates/topos-tce-broadcast/src/double_echo/mod.rs index abc567c8e..0c3930d6a 100644 --- a/crates/topos-tce-broadcast/src/double_echo/mod.rs +++ b/crates/topos-tce-broadcast/src/double_echo/mod.rs @@ -13,12 +13,13 @@ //! be ignored by others. `fullnode` still consumes Echo and Ready coming from //! validators and use those messages to build their state. +use crate::event::ProtocolEvents; use crate::{DoubleEchoCommand, SubscriptionsView}; use std::collections::HashSet; use std::sync::Arc; -use tce_transport::{ProtocolEvents, ReliableBroadcastParams}; use tokio::sync::{broadcast, mpsc, oneshot}; use tokio_util::sync::CancellationToken; +use topos_config::tce::broadcast::ReliableBroadcastParams; use topos_core::{ types::ValidatorId, uci::{Certificate, CertificateId}, diff --git a/crates/topos-tce-transport/src/lib.rs b/crates/topos-tce-broadcast/src/event.rs similarity index 51% rename from crates/topos-tce-transport/src/lib.rs rename to crates/topos-tce-broadcast/src/event.rs index 82546dfc0..b8e530800 100644 --- a/crates/topos-tce-transport/src/lib.rs +++ b/crates/topos-tce-broadcast/src/event.rs @@ -1,39 +1,9 @@ -//! implementation of Topos Network Transport -//! -use clap::Parser; -use serde::{Deserialize, Serialize}; use topos_core::{ types::ValidatorId, uci::{Certificate, CertificateId}, }; use topos_crypto::messages::Signature; -#[derive(Parser, Clone, Debug, Default, Deserialize, Serialize)] -#[command(name = "Parameters of the reliable broadcast")] -pub struct ReliableBroadcastParams { - /// Echo threshold - #[arg(long, env = "TCE_ECHO_THRESHOLD", default_value_t = 1)] - pub echo_threshold: usize, - /// Ready threshold - #[arg(long, env = "TCE_READY_THRESHOLD", default_value_t = 1)] - pub ready_threshold: usize, - /// Delivery threshold - #[arg(long, env = "TCE_DELIVERY_THRESHOLD", default_value_t = 1)] - pub delivery_threshold: usize, -} - -impl ReliableBroadcastParams { - pub fn new(n: usize) -> Self { - let f: usize = n / 3; - - Self { - echo_threshold: 1 + (n + f) / 2, - ready_threshold: 1 + f, - delivery_threshold: 2 * f + 1, - } - } -} - /// Protocol events #[derive(Clone, Debug)] pub enum ProtocolEvents { @@ -66,7 +36,4 @@ pub enum ProtocolEvents { }, /// For simulation purpose, for now only caused by ill-formed sampling Die, - - /// Stable Sample - StableSample, } diff --git a/crates/topos-tce-broadcast/src/lib.rs b/crates/topos-tce-broadcast/src/lib.rs index 5e4969769..b3dbc5d4d 100644 --- a/crates/topos-tce-broadcast/src/lib.rs +++ b/crates/topos-tce-broadcast/src/lib.rs @@ -32,16 +32,17 @@ //! //! The implementation is based on the paper: [Topos: A Secure, Trustless, and Decentralized Interoperability Protocol](https://arxiv.org/pdf/2206.03481.pdf) //! +use crate::event::ProtocolEvents; use double_echo::DoubleEcho; use futures::Stream; use std::collections::HashSet; use std::sync::Arc; -use tce_transport::{ProtocolEvents, ReliableBroadcastParams}; use thiserror::Error; use tokio::spawn; use tokio::sync::mpsc::Sender; use tokio::sync::{broadcast, mpsc, oneshot}; use tokio_stream::wrappers::ReceiverStream; +use topos_config::tce::broadcast::ReliableBroadcastParams; use topos_core::types::ValidatorId; use topos_core::uci::{Certificate, CertificateId}; use topos_crypto::messages::{MessageSigner, Signature}; @@ -56,6 +57,7 @@ pub type Peer = String; mod constant; pub mod double_echo; +pub mod event; pub mod sampler; pub mod task_manager; diff --git a/crates/topos-tce-broadcast/src/task_manager/mod.rs b/crates/topos-tce-broadcast/src/task_manager/mod.rs index 379081465..288c773aa 100644 --- a/crates/topos-tce-broadcast/src/task_manager/mod.rs +++ b/crates/topos-tce-broadcast/src/task_manager/mod.rs @@ -1,3 +1,4 @@ +use crate::event::ProtocolEvents; use futures::stream::FuturesUnordered; use futures::Future; use futures::StreamExt; @@ -6,10 +7,10 @@ use std::future::IntoFuture; use std::pin::Pin; use std::sync::Arc; use std::time::Duration; -use tce_transport::{ProtocolEvents, ReliableBroadcastParams}; use tokio::sync::broadcast; use tokio::{spawn, sync::mpsc}; use tokio_util::sync::CancellationToken; +use topos_config::tce::broadcast::ReliableBroadcastParams; use topos_core::types::ValidatorId; use topos_core::uci::Certificate; use topos_core::uci::CertificateId; diff --git a/crates/topos-tce-broadcast/src/tests/mod.rs b/crates/topos-tce-broadcast/src/tests/mod.rs index c09fe1777..521b27382 100644 --- a/crates/topos-tce-broadcast/src/tests/mod.rs +++ b/crates/topos-tce-broadcast/src/tests/mod.rs @@ -4,8 +4,8 @@ use rstest::*; use std::collections::HashSet; use std::str::FromStr; use std::time::Duration; -use tce_transport::ReliableBroadcastParams; use tokio::sync::mpsc::Receiver; +use topos_config::tce::broadcast::ReliableBroadcastParams; use topos_crypto::messages::MessageSigner; use topos_test_sdk::constants::*; use topos_test_sdk::storage::create_validator_store; diff --git a/crates/topos-tce-broadcast/src/tests/task_manager.rs b/crates/topos-tce-broadcast/src/tests/task_manager.rs index 73eb734dd..3a1963d8f 100644 --- a/crates/topos-tce-broadcast/src/tests/task_manager.rs +++ b/crates/topos-tce-broadcast/src/tests/task_manager.rs @@ -25,7 +25,7 @@ async fn can_start(#[future] create_validator_store: Arc) { let (broadcast_sender, _) = broadcast::channel(1); let shutdown = CancellationToken::new(); let validator_id = ValidatorId::default(); - let thresholds = tce_transport::ReliableBroadcastParams { + let thresholds = topos_config::tce::broadcast::ReliableBroadcastParams { echo_threshold: 1, ready_threshold: 1, delivery_threshold: 1, diff --git a/crates/topos-tce-proxy/Cargo.toml b/crates/topos-tce-proxy/Cargo.toml index 5adc0e2dc..f762b0ef5 100644 --- a/crates/topos-tce-proxy/Cargo.toml +++ b/crates/topos-tce-proxy/Cargo.toml @@ -39,7 +39,6 @@ opentelemetry.workspace = true base64ct.workspace = true [dev-dependencies] -topos-tce-transport = { path = "../topos-tce-transport" } topos-tce = { path = "../topos-tce" } rstest = { workspace = true, features = ["async-timeout"] } test-log.workspace = true diff --git a/crates/topos-tce-transport/Cargo.toml b/crates/topos-tce-transport/Cargo.toml deleted file mode 100644 index 1d359035e..000000000 --- a/crates/topos-tce-transport/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "topos-tce-transport" -version = "0.1.0" -edition = "2021" - -[lints] -workspace = true - -[lib] -path = 'src/lib.rs' - -[dependencies] -clap.workspace = true -serde = { workspace = true, features = ["rc"] } -tracing.workspace = true -topos-core = { workspace = true, features = ["api", "uci"] } -topos-crypto = { path = "../topos-crypto" } diff --git a/crates/topos-tce/Cargo.toml b/crates/topos-tce/Cargo.toml index 9145a97ed..f679c2701 100644 --- a/crates/topos-tce/Cargo.toml +++ b/crates/topos-tce/Cargo.toml @@ -31,7 +31,6 @@ tonic.workspace = true bytes.workspace = true prost.workspace = true -tce_transport = { package = "topos-tce-transport", path = "../topos-tce-transport" } topos-config = { path = "../topos-config" } topos-p2p = { path = "../topos-p2p" } topos-metrics = { path = "../topos-metrics" } diff --git a/crates/topos-tce/src/app_context.rs b/crates/topos-tce/src/app_context.rs index 38127c82c..689d2b46a 100644 --- a/crates/topos-tce/src/app_context.rs +++ b/crates/topos-tce/src/app_context.rs @@ -6,7 +6,6 @@ use futures::{Stream, StreamExt}; use prometheus::HistogramTimer; use std::collections::HashMap; use std::sync::Arc; -use tce_transport::ProtocolEvents; use tokio::sync::mpsc; use tokio_util::sync::CancellationToken; use topos_core::uci::CertificateId; @@ -14,6 +13,7 @@ use topos_metrics::CERTIFICATE_DELIVERED_TOTAL; use topos_p2p::{Event as NetEvent, NetworkClient}; use topos_tce_api::RuntimeClient as ApiClient; use topos_tce_api::RuntimeEvent as ApiEvent; +use topos_tce_broadcast::event::ProtocolEvents; use topos_tce_broadcast::ReliableBroadcastClient; use topos_tce_gatekeeper::GatekeeperClient; use topos_tce_storage::store::ReadStore; diff --git a/crates/topos-tce/src/app_context/protocol.rs b/crates/topos-tce/src/app_context/protocol.rs index 6c34253ed..a6987be31 100644 --- a/crates/topos-tce/src/app_context/protocol.rs +++ b/crates/topos-tce/src/app_context/protocol.rs @@ -1,21 +1,12 @@ -use tce_transport::ProtocolEvents; use topos_core::api::grpc::tce::v1::{double_echo_request, DoubleEchoRequest, Echo, Gossip, Ready}; +use topos_tce_broadcast::event::ProtocolEvents; use tracing::{error, info, warn}; -use crate::events::Events; use crate::AppContext; impl AppContext { pub async fn on_protocol_event(&mut self, evt: ProtocolEvents) { match evt { - ProtocolEvents::StableSample => { - info!("Stable Sample detected"); - self.api_client.set_active_sample(true).await; - if self.events.send(Events::StableSample).await.is_err() { - error!("Unable to send StableSample event"); - } - } - ProtocolEvents::Broadcast { certificate_id } => { info!("Broadcasting certificate {}", certificate_id); } diff --git a/crates/topos-tce/src/tests/mod.rs b/crates/topos-tce/src/tests/mod.rs index 21adbf3dc..3f5c6d2cb 100644 --- a/crates/topos-tce/src/tests/mod.rs +++ b/crates/topos-tce/src/tests/mod.rs @@ -1,9 +1,9 @@ use libp2p::PeerId; use rstest::{fixture, rstest}; use std::{collections::HashSet, future::IntoFuture, sync::Arc}; -use tce_transport::ProtocolEvents; use tokio_stream::Stream; use topos_tce_api::RuntimeEvent; +use topos_tce_broadcast::event::ProtocolEvents; use topos_tce_gatekeeper::Gatekeeper; use tokio::sync::{broadcast, mpsc}; @@ -106,7 +106,7 @@ pub async fn setup_test( let (tce_cli, _) = ReliableBroadcastClient::new( ReliableBroadcastConfig { - tce_params: tce_transport::ReliableBroadcastParams::default(), + tce_params: topos_config::tce::broadcast::ReliableBroadcastParams::default(), validator_id, validators: HashSet::new(), message_signer: message_signer.clone(), diff --git a/crates/topos-test-sdk/Cargo.toml b/crates/topos-test-sdk/Cargo.toml index ed8428451..f452cd268 100644 --- a/crates/topos-test-sdk/Cargo.toml +++ b/crates/topos-test-sdk/Cargo.toml @@ -10,6 +10,7 @@ workspace = true [dependencies] topos-core = { workspace = true, features = ["uci", "api"] } topos-crypto = { path = "../topos-crypto/" } +topos-config = { path = "../topos-config/" } topos-p2p = { path = "../topos-p2p/" } topos-tce = { path = "../topos-tce/" } topos-tce-api = { path = "../topos-tce-api/" } @@ -17,7 +18,6 @@ topos-tce-broadcast = { path = "../topos-tce-broadcast/" } topos-tce-gatekeeper = { path = "../topos-tce-gatekeeper/" } topos-tce-storage = { path = "../topos-tce-storage/" } topos-tce-synchronizer = { path = "../topos-tce-synchronizer/" } -topos-tce-transport = { path = "../topos-tce-transport/" } hex.workspace = true ethers.workspace = true diff --git a/crates/topos-test-sdk/src/tce/protocol.rs b/crates/topos-test-sdk/src/tce/protocol.rs index 8e9e06ba6..8efb8b3b7 100644 --- a/crates/topos-test-sdk/src/tce/protocol.rs +++ b/crates/topos-test-sdk/src/tce/protocol.rs @@ -2,12 +2,13 @@ use futures::Stream; use std::collections::HashSet; use std::sync::Arc; use tokio::sync::broadcast; +use topos_config::tce::broadcast::ReliableBroadcastParams; use topos_core::types::ValidatorId; use topos_crypto::messages::MessageSigner; +use topos_tce_broadcast::event::ProtocolEvents; use topos_tce_broadcast::{ReliableBroadcastClient, ReliableBroadcastConfig}; use topos_tce_storage::types::CertificateDeliveredWithPositions; use topos_tce_storage::validator::ValidatorStore; -use topos_tce_transport::{ProtocolEvents, ReliableBroadcastParams}; pub async fn create_reliable_broadcast_client( validator_id: ValidatorId, diff --git a/crates/topos/Cargo.toml b/crates/topos/Cargo.toml index 46926553b..16564b7b7 100644 --- a/crates/topos/Cargo.toml +++ b/crates/topos/Cargo.toml @@ -10,7 +10,6 @@ workspace = true topos-config = { path = "../topos-config/" } topos-tce = { path = "../topos-tce/" } topos-p2p = { path = "../topos-p2p" } -topos-tce-transport = { path = "../topos-tce-transport" } topos-sequencer = { path = "../topos-sequencer" } topos-core = { workspace = true, features = ["api"] } topos-certificate-spammer = { path = "../topos-certificate-spammer" } @@ -50,7 +49,6 @@ openssl = { version = "0.10.61", features = ["vendored"] } [dev-dependencies] toml = "0.7.4" topos-tce-broadcast = { path = "../topos-tce-broadcast" } -topos-tce-transport = { path = "../topos-tce-transport" } topos-tce-synchronizer = { path = "../topos-tce-synchronizer" } topos-tce-gatekeeper = { path = "../topos-tce-gatekeeper" } topos-tce-api = { path = "../topos-tce-api" } diff --git a/crates/topos/src/components/node/services/process.rs b/crates/topos/src/components/node/services/process.rs index e5678461c..40bac4b09 100644 --- a/crates/topos/src/components/node/services/process.rs +++ b/crates/topos/src/components/node/services/process.rs @@ -6,10 +6,10 @@ use thiserror::Error; use tokio::{spawn, sync::mpsc, task::JoinHandle}; use tokio_util::sync::CancellationToken; use topos_config::sequencer::SequencerConfig; +use topos_config::tce::broadcast::ReliableBroadcastParams; use topos_config::tce::{AuthKey, StorageConfiguration, TceConfig}; use topos_p2p::Multiaddr; use topos_sequencer::SequencerConfiguration; -use topos_tce_transport::ReliableBroadcastParams; use topos_wallet::SecretManager; use tracing::{debug, error, info, warn};