Skip to content

Commit

Permalink
Merge branch 'master' into my-codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
romanzac committed Sep 8, 2024
2 parents e2e5e35 + 49ac81b commit 734c8b2
Show file tree
Hide file tree
Showing 24 changed files with 514 additions and 97 deletions.
2 changes: 1 addition & 1 deletion nodes/nomos-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ overwatch-derive = { git = "https://github.com/logos-co/Overwatch", rev = "ac28d
tracing = "0.1"
multiaddr = "0.18"
nomos-core = { path = "../../nomos-core" }
nomos-da-sampling = { path = "../../nomos-services/data-availability/sampling" }
nomos-da-sampling = { path = "../../nomos-services/data-availability/sampling", features = ["rocksdb-backend"] }
nomos-da-verifier = { path = "../../nomos-services/data-availability/verifier", features = ["rocksdb-backend", "libp2p"] }
nomos-da-indexer = { path = "../../nomos-services/data-availability/indexer", features = ["rocksdb-backend"] }
nomos-da-network-service = { path = "../../nomos-services/data-availability/network" }
Expand Down
30 changes: 28 additions & 2 deletions nodes/nomos-node/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub struct AxumBackend<
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
const SIZE: usize,
> {
settings: AxumBackendSettings,
Expand All @@ -78,6 +79,7 @@ pub struct AxumBackend<
_sampling_backend: core::marker::PhantomData<SamplingBackend>,
_sampling_network_adapter: core::marker::PhantomData<SamplingNetworkAdapter>,
_sampling_rng: core::marker::PhantomData<SamplingRng>,
_sampling_storage: core::marker::PhantomData<SamplingStorage>,
}

#[derive(OpenApi)]
Expand Down Expand Up @@ -106,6 +108,7 @@ impl<
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
const SIZE: usize,
> Backend
for AxumBackend<
Expand All @@ -120,6 +123,7 @@ impl<
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
SIZE,
>
where
Expand Down Expand Up @@ -182,6 +186,7 @@ where
SamplingBackend::Blob: Debug + 'static,
SamplingBackend::BlobId: Debug + 'static,
SamplingNetworkAdapter: nomos_da_sampling::network::NetworkAdapter + Send + 'static,
SamplingStorage: nomos_da_sampling::storage::DaStorageAdapter + Send + 'static,
{
type Error = hyper::Error;
type Settings = AxumBackendSettings;
Expand All @@ -203,6 +208,7 @@ where
_sampling_backend: core::marker::PhantomData,
_sampling_network_adapter: core::marker::PhantomData,
_sampling_rng: core::marker::PhantomData,
_sampling_storage: core::marker::PhantomData,
})
}

Expand Down Expand Up @@ -240,6 +246,7 @@ where
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
SIZE,
>,
),
Expand All @@ -253,6 +260,7 @@ where
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
SIZE,
>,
),
Expand All @@ -269,6 +277,7 @@ where
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
SIZE,
>,
),
Expand All @@ -279,7 +288,13 @@ where
.route(
"/mempool/add/blobinfo",
routing::post(
add_blob_info::<V, SamplingBackend, SamplingNetworkAdapter, SamplingRng>,
add_blob_info::<
V,
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
>,
),
)
.route("/metrics", routing::get(get_metrics))
Expand Down Expand Up @@ -370,6 +385,7 @@ async fn cryptarchia_info<
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
const SIZE: usize,
>(
State(handle): State<OverwatchHandle>,
Expand All @@ -393,13 +409,15 @@ where
SamplingBackend::Blob: Debug + 'static,
SamplingBackend::BlobId: Debug + 'static,
SamplingNetworkAdapter: nomos_da_sampling::network::NetworkAdapter,
SamplingStorage: nomos_da_sampling::storage::DaStorageAdapter,
{
make_request_and_return_response!(consensus::cryptarchia_info::<
Tx,
SS,
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
SIZE,
>(&handle))
}
Expand All @@ -418,6 +436,7 @@ async fn cryptarchia_headers<
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
const SIZE: usize,
>(
State(store): State<OverwatchHandle>,
Expand All @@ -442,6 +461,7 @@ where
SamplingBackend::Blob: Debug + 'static,
SamplingBackend::BlobId: Debug + 'static,
SamplingNetworkAdapter: nomos_da_sampling::network::NetworkAdapter,
SamplingStorage: nomos_da_sampling::storage::DaStorageAdapter,
{
let QueryParams { from, to } = query;
make_request_and_return_response!(consensus::cryptarchia_headers::<
Expand All @@ -450,6 +470,7 @@ where
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
SIZE,
>(&store, from, to))
}
Expand Down Expand Up @@ -511,6 +532,7 @@ async fn get_range<
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
const SIZE: usize,
>(
State(handle): State<OverwatchHandle>,
Expand Down Expand Up @@ -561,6 +583,7 @@ where
SamplingBackend::Blob: Debug + 'static,
SamplingBackend::BlobId: Debug + 'static,
SamplingNetworkAdapter: nomos_da_sampling::network::NetworkAdapter,
SamplingStorage: nomos_da_sampling::storage::DaStorageAdapter,
{
make_request_and_return_response!(da::get_range::<
Tx,
Expand All @@ -570,6 +593,7 @@ where
SamplingBackend,
SamplingNetworkAdapter,
SamplingRng,
SamplingStorage,
SIZE,
>(&handle, app_id, range))
}
Expand Down Expand Up @@ -631,7 +655,7 @@ where
(status = 500, description = "Internal server error", body = String),
)
)]
async fn add_blob_info<B, SamplingBackend, SamplingAdapter, SamplingRng>(
async fn add_blob_info<B, SamplingBackend, SamplingAdapter, SamplingRng, SamplingStorage>(
State(handle): State<OverwatchHandle>,
Json(blob_info): Json<B>,
) -> Response
Expand All @@ -654,6 +678,7 @@ where
SamplingBackend::BlobId: Debug + 'static,
SamplingAdapter: nomos_da_sampling::network::NetworkAdapter + Send + 'static,
SamplingRng: SeedableRng + RngCore + Send + 'static,
SamplingStorage: nomos_da_sampling::storage::DaStorageAdapter,
{
make_request_and_return_response!(mempool::add_blob_info::<
NetworkBackend,
Expand All @@ -663,6 +688,7 @@ where
SamplingBackend,
SamplingAdapter,
SamplingRng,
SamplingStorage,
>(&handle, blob_info, DispersedBlobInfo::blob_id))
}

Expand Down
6 changes: 6 additions & 0 deletions nodes/nomos-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use nomos_da_network_service::backends::libp2p::validator::DaNetworkValidatorBac
use nomos_da_network_service::NetworkService as DaNetworkService;
use nomos_da_sampling::backend::kzgrs::KzgrsSamplingBackend;
use nomos_da_sampling::network::adapters::libp2p::Libp2pAdapter as SamplingLibp2pAdapter;
use nomos_da_sampling::storage::adapters::rocksdb::RocksAdapter as SamplingStorageAdapter;
use nomos_da_sampling::DaSamplingService;
use nomos_da_verifier::backend::kzgrs::KzgrsDaVerifier;
use nomos_da_verifier::network::adapters::libp2p::Libp2pAdapter as VerifierNetworkAdapter;
Expand Down Expand Up @@ -66,6 +67,7 @@ pub type NomosApiService = ApiService<
KzgrsSamplingBackend<ChaCha20Rng>,
nomos_da_sampling::network::adapters::libp2p::Libp2pAdapter<NomosDaMembership>,
ChaCha20Rng,
SamplingStorageAdapter<DaBlob, Wire>,
MB16,
>,
>;
Expand All @@ -86,6 +88,7 @@ pub type Cryptarchia = cryptarchia_consensus::CryptarchiaConsensus<
KzgrsSamplingBackend<ChaCha20Rng>,
nomos_da_sampling::network::adapters::libp2p::Libp2pAdapter<NomosDaMembership>,
ChaCha20Rng,
SamplingStorageAdapter<DaBlob, Wire>,
>;

pub type TxMempool = TxMempoolService<
Expand All @@ -99,6 +102,7 @@ pub type DaMempool = DaMempoolService<
KzgrsSamplingBackend<ChaCha20Rng>,
nomos_da_sampling::network::adapters::libp2p::Libp2pAdapter<NomosDaMembership>,
ChaCha20Rng,
SamplingStorageAdapter<DaBlob, Wire>,
>;

pub type DaIndexer = DataIndexerService<
Expand All @@ -118,12 +122,14 @@ pub type DaIndexer = DataIndexerService<
KzgrsSamplingBackend<ChaCha20Rng>,
nomos_da_sampling::network::adapters::libp2p::Libp2pAdapter<NomosDaMembership>,
ChaCha20Rng,
SamplingStorageAdapter<DaBlob, Wire>,
>;

pub type DaSampling = DaSamplingService<
KzgrsSamplingBackend<ChaCha20Rng>,
SamplingLibp2pAdapter<NomosDaMembership>,
ChaCha20Rng,
SamplingStorageAdapter<DaBlob, Wire>,
>;

pub type DaVerifier = DaVerifierService<
Expand Down
Loading

0 comments on commit 734c8b2

Please sign in to comment.