Skip to content

Commit

Permalink
Add data availability service to node
Browse files Browse the repository at this point in the history
  • Loading branch information
zeegomo authored and danielSanchezQ committed Sep 15, 2023
1 parent 72f05cc commit 9b0c082
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion nodes/nomos-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ nomos-mempool = { path = "../../nomos-services/mempool", features = ["mock"] }
nomos-http = { path = "../../nomos-services/http", features = ["http"] }
nomos-consensus = { path = "../../nomos-services/consensus" }
nomos-libp2p = { path = "../../nomos-libp2p", optional = true }
nomos-da = { path = "../../nomos-services/data-availability" }
metrics = { path = "../../nomos-services/metrics", optional = true }
tracing-subscriber = "0.3"
consensus-engine = { path = "../../consensus-engine" }
Expand All @@ -34,7 +35,7 @@ serde_yaml = "0.9"
color-eyre = "0.6.0"
serde = "1"
waku-bindings = { version = "0.1.1", optional = true }

full-replication = { path = "../../nomos-da/full-replication" }

[features]
default = ["libp2p"]
Expand Down
1 change: 0 additions & 1 deletion nodes/nomos-node/src/blob.rs

This file was deleted.

4 changes: 4 additions & 0 deletions nodes/nomos-node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use std::{
};

use crate::Carnot;
#[cfg(feature = "libp2p")]
use crate::DataAvailability;
use clap::{Parser, ValueEnum};
use color_eyre::eyre::{self, eyre, Result};
use hex::FromHex;
Expand Down Expand Up @@ -129,6 +131,8 @@ pub struct Config {
pub consensus: <Carnot as ServiceData>::Settings,
#[cfg(feature = "metrics")]
pub metrics: <MetricsService<MapMetricsBackend<MetricsData>> as ServiceData>::Settings,
#[cfg(feature = "libp2p")]
pub da: <DataAvailability as ServiceData>::Settings,
}

impl Config {
Expand Down
17 changes: 15 additions & 2 deletions nodes/nomos-node/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
mod blob;
mod config;
mod tx;

use color_eyre::eyre::Result;
use consensus_engine::overlay::{FlatOverlay, RandomBeaconState, RoundRobin};
#[cfg(feature = "libp2p")]
use full_replication::{AbsoluteNumber, Attestation, Blob, Certificate, FullReplication};
#[cfg(feature = "metrics")]
use metrics::{backend::map::MapMetricsBackend, types::MetricsData, MetricsService};
#[cfg(feature = "libp2p")]
use nomos_consensus::network::adapters::libp2p::Libp2pAdapter as ConsensusLibp2pAdapter;
#[cfg(feature = "waku")]
use nomos_consensus::network::adapters::waku::WakuAdapter as ConsensusWakuAdapter;
use nomos_consensus::CarnotConsensus;
#[cfg(feature = "libp2p")]
use nomos_da::{
backend::memory_cache::BlobCache, network::adapters::libp2p::Libp2pAdapter as DaLibp2pAdapter,
DataAvailabilityService,
};
use nomos_http::backends::axum::AxumBackend;
use nomos_http::bridge::HttpBridgeService;
use nomos_http::http::HttpService;
Expand All @@ -28,7 +34,6 @@ use nomos_network::NetworkService;
use overwatch_derive::*;
use overwatch_rs::services::handle::ServiceHandle;

use crate::blob::Blob;
pub use config::{Config, ConsensusArgs, HttpArgs, LogArgs, NetworkArgs, OverlayArgs};
pub use tx::Tx;

Expand All @@ -53,6 +58,12 @@ pub type Carnot = CarnotConsensus<
Blob,
>;

type DataAvailability = DataAvailabilityService<
FullReplication<AbsoluteNumber<Attestation, Certificate>>,
BlobCache<<Blob as nomos_core::da::blob::Blob>::Hash, Blob>,
DaLibp2pAdapter<Blob, Attestation>,
>;

#[derive(Services)]
pub struct Nomos {
logging: ServiceHandle<Logger>,
Expand All @@ -69,4 +80,6 @@ pub struct Nomos {
bridges: ServiceHandle<HttpBridgeService>,
#[cfg(feature = "metrics")]
metrics: ServiceHandle<MetricsService<MapMetricsBackend<MetricsData>>>,
#[cfg(feature = "libp2p")]
da: ServiceHandle<DataAvailability>,
}
2 changes: 2 additions & 0 deletions nodes/nomos-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ fn main() -> Result<()> {
bridges: HttpBridgeSettings { bridges },
#[cfg(feature = "metrics")]
metrics: config.metrics,
#[cfg(feature = "libp2p")]
da: config.da,
},
None,
)
Expand Down

0 comments on commit 9b0c082

Please sign in to comment.