Skip to content

Commit 703b7e8

Browse files
committed
Full refactor of blob to share
1 parent 92e9439 commit 703b7e8

File tree

74 files changed

+784
-781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+784
-781
lines changed

clients/common-http-client/src/lib.rs

+20-23
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std::{fmt::Debug, sync::Arc};
22

3-
use nomos_core::da::blob::Blob;
4-
use nomos_da_messages::http::da::{DABlobCommitmentsRequest, DaSamplingRequest};
3+
use nomos_core::da::blob::Share;
4+
use nomos_da_messages::http::da::{DASharesCommitmentsRequest, DaSamplingRequest};
55
use reqwest::{Client, ClientBuilder, RequestBuilder, StatusCode, Url};
66
use serde::{de::DeserializeOwned, Serialize};
77

88
// These could be moved into shared location, perhaps to upcoming `nomos-lib`
9-
const DA_GET_SHARED_COMMITMENTS: &str = "/da/sampling/commitments";
9+
const DA_GET_SHARES_COMMITMENTS: &str = "/da/sampling/commitments";
1010

11-
const DA_GET_LIGHT_BLOB: &str = "/da/sampling/blob";
11+
const DA_GET_LIGHT_SHARE: &str = "/da/sampling/share";
1212

1313
#[derive(thiserror::Error, Debug)]
1414
pub enum Error {
@@ -94,40 +94,37 @@ impl CommonHttpClient {
9494
}
9595

9696
/// Get the commitments for a Blob
97-
pub async fn get_commitments<B>(
97+
pub async fn get_commitments<S>(
9898
&self,
9999
base_url: Url,
100-
blob_id: B::BlobId,
101-
) -> Result<Option<B::SharedCommitments>, Error>
100+
blob_id: S::BlobId,
101+
) -> Result<Option<S::SharesCommitments>, Error>
102102
where
103-
B: Blob,
104-
B::SharedCommitments: DeserializeOwned + Send + Sync,
105-
<B as Blob>::BlobId: serde::Serialize + Send + Sync,
103+
S: Share,
104+
S::SharesCommitments: DeserializeOwned + Send + Sync,
105+
<S as Share>::BlobId: serde::Serialize + Send + Sync,
106106
{
107-
let request: DABlobCommitmentsRequest<B> = DABlobCommitmentsRequest { blob_id };
108-
let path = DA_GET_SHARED_COMMITMENTS.trim_start_matches('/');
107+
let request: DASharesCommitmentsRequest<S> = DASharesCommitmentsRequest { blob_id };
108+
let path = DA_GET_SHARES_COMMITMENTS.trim_start_matches('/');
109109
let request_url = base_url.join(path).map_err(Error::Url)?;
110110
self.get(request_url, &request).await
111111
}
112112

113113
/// Get blob by blob id and column index
114-
pub async fn get_blob<B, C>(
114+
pub async fn get_share<S, C>(
115115
&self,
116116
base_url: Url,
117-
blob_id: B::BlobId,
118-
column_idx: B::ColumnIndex,
117+
blob_id: S::BlobId,
118+
share_idx: S::ShareIndex,
119119
) -> Result<Option<C>, Error>
120120
where
121121
C: DeserializeOwned + Send + Sync,
122-
B: Blob + DeserializeOwned + Send + Sync,
123-
<B as Blob>::BlobId: serde::Serialize + Send + Sync,
124-
<B as Blob>::ColumnIndex: serde::Serialize + Send + Sync,
122+
S: Share + DeserializeOwned + Send + Sync,
123+
<S as Share>::BlobId: serde::Serialize + Send + Sync,
124+
<S as Share>::ShareIndex: serde::Serialize + Send + Sync,
125125
{
126-
let request: DaSamplingRequest<B> = DaSamplingRequest {
127-
blob_id,
128-
share_idx: column_idx,
129-
};
130-
let path = DA_GET_LIGHT_BLOB.trim_start_matches('/');
126+
let request: DaSamplingRequest<S> = DaSamplingRequest { blob_id, share_idx };
127+
let path = DA_GET_LIGHT_SHARE.trim_start_matches('/');
131128
let request_url = base_url.join(path).map_err(Error::Url)?;
132129
self.get(request_url, &request).await
133130
}

clients/executor-http-client/src/lib.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub use common_http_client::BasicAuthCredentials;
22
use common_http_client::{CommonHttpClient, Error};
3-
use nomos_core::da::blob::Blob;
3+
use nomos_core::da::blob::Share;
44
use nomos_executor::api::{handlers::DispersalRequest, paths};
55
use reqwest::Url;
66
use serde::{de::DeserializeOwned, Serialize};
@@ -38,34 +38,34 @@ impl ExecutorHttpClient {
3838
}
3939

4040
/// Get the commitments for a specific `BlobId`
41-
pub async fn get_commitments<B>(
41+
pub async fn get_commitments<S>(
4242
&self,
4343
base_url: Url,
44-
blob_id: B::BlobId,
45-
) -> Result<Option<B::SharedCommitments>, Error>
44+
blob_id: S::BlobId,
45+
) -> Result<Option<S::SharesCommitments>, Error>
4646
where
47-
B: Blob + Send,
48-
<B as Blob>::BlobId: Serialize + Send + Sync,
49-
<B as Blob>::SharedCommitments: DeserializeOwned + Send + Sync,
47+
S: Share + Send,
48+
<S as Share>::BlobId: Serialize + Send + Sync,
49+
<S as Share>::SharesCommitments: DeserializeOwned + Send + Sync,
5050
{
51-
self.client.get_commitments::<B>(base_url, blob_id).await
51+
self.client.get_commitments::<S>(base_url, blob_id).await
5252
}
5353

54-
/// Get blob by blob id and column index
55-
pub async fn get_blob<B, C>(
54+
/// Get share by blob id and share index
55+
pub async fn get_share<S, C>(
5656
&self,
5757
base_url: Url,
58-
blob_id: B::BlobId,
59-
column_idx: B::ColumnIndex,
58+
blob_id: S::BlobId,
59+
share_idx: S::ShareIndex,
6060
) -> Result<Option<C>, Error>
6161
where
6262
C: DeserializeOwned + Send + Sync,
63-
B: Blob + DeserializeOwned + Send + Sync,
64-
<B as Blob>::BlobId: serde::Serialize + Send + Sync,
65-
<B as Blob>::ColumnIndex: serde::Serialize + Send + Sync,
63+
S: Share + DeserializeOwned + Send + Sync,
64+
<S as Share>::BlobId: serde::Serialize + Send + Sync,
65+
<S as Share>::ShareIndex: serde::Serialize + Send + Sync,
6666
{
6767
self.client
68-
.get_blob::<B, C>(base_url, blob_id, column_idx)
68+
.get_share::<S, C>(base_url, blob_id, share_idx)
6969
.await
7070
}
7171
}

nodes/nomos-executor/src/api/backend.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use hyper::header::{CONTENT_TYPE, USER_AGENT};
55
use nomos_api::Backend;
66
use nomos_core::{
77
da::{
8-
blob::{info::DispersedBlobInfo, metadata, Blob},
8+
blob::{info::DispersedBlobInfo, metadata, Share},
99
DaVerifier as CoreDaVerifier,
1010
},
1111
header::HeaderId,
@@ -18,8 +18,8 @@ use nomos_da_verifier::backend::VerifierBackend;
1818
use nomos_libp2p::PeerId;
1919
use nomos_mempool::{tx::service::openapi::Status, MempoolMetrics};
2020
use nomos_node::api::handlers::{
21-
add_blob, add_blob_info, add_tx, block, cl_metrics, cl_status, cryptarchia_headers,
22-
cryptarchia_info, da_get_commitments, da_get_light_blob, get_range, libp2p_info,
21+
add_blob_info, add_share, add_tx, block, cl_metrics, cl_status, cryptarchia_headers,
22+
cryptarchia_info, da_get_commitments, da_get_light_share, get_range, libp2p_info,
2323
};
2424
use nomos_storage::backends::StorageSerde;
2525
use overwatch::overwatch::handle::OverwatchHandle;
@@ -47,7 +47,7 @@ pub struct AxumBackendSettings {
4747

4848
pub struct AxumBackend<
4949
DaAttestation,
50-
DaBlob,
50+
DaShare,
5151
DaBlobInfo,
5252
Memebership,
5353
DaVerifiedBlobInfo,
@@ -73,7 +73,7 @@ pub struct AxumBackend<
7373
#[expect(clippy::type_complexity)]
7474
_phantom: core::marker::PhantomData<(
7575
DaAttestation,
76-
DaBlob,
76+
DaShare,
7777
DaBlobInfo,
7878
Memebership,
7979
DaVerifiedBlobInfo,
@@ -111,7 +111,7 @@ struct ApiDoc;
111111
#[async_trait::async_trait]
112112
impl<
113113
DaAttestation,
114-
DaBlob,
114+
DaShare,
115115
DaBlobInfo,
116116
Membership,
117117
DaVerifiedBlobInfo,
@@ -134,7 +134,7 @@ impl<
134134
> Backend
135135
for AxumBackend<
136136
DaAttestation,
137-
DaBlob,
137+
DaShare,
138138
DaBlobInfo,
139139
Membership,
140140
DaVerifiedBlobInfo,
@@ -157,12 +157,12 @@ impl<
157157
>
158158
where
159159
DaAttestation: Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
160-
DaBlob: Blob + Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
161-
<DaBlob as Blob>::BlobId:
160+
DaShare: Share + Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
161+
<DaShare as Share>::BlobId:
162162
AsRef<[u8]> + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
163-
<DaBlob as Blob>::ColumnIndex: AsRef<[u8]> + DeserializeOwned + Send + Sync + 'static,
164-
<DaBlob as Blob>::LightBlob: Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
165-
<DaBlob as Blob>::SharedCommitments:
163+
<DaShare as Share>::ShareIndex: AsRef<[u8]> + DeserializeOwned + Send + Sync + 'static,
164+
<DaShare as Share>::LightShare: Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
165+
<DaShare as Share>::SharesCommitments:
166166
Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
167167
DaBlobInfo: DispersedBlobInfo<BlobId = [u8; 32]>
168168
+ Clone
@@ -196,7 +196,7 @@ where
196196
AsRef<[u8]> + Clone + Serialize + DeserializeOwned + Send + Sync,
197197
<DaVerifiedBlobInfo as metadata::Metadata>::Index:
198198
AsRef<[u8]> + Clone + Serialize + DeserializeOwned + PartialOrd + Send + Sync,
199-
DaVerifierBackend: VerifierBackend + CoreDaVerifier<DaBlob = DaBlob> + Send + Sync + 'static,
199+
DaVerifierBackend: VerifierBackend + CoreDaVerifier<DaShare = DaShare> + Send + Sync + 'static,
200200
<DaVerifierBackend as VerifierBackend>::Settings: Clone,
201201
<DaVerifierBackend as CoreDaVerifier>::Error: Error,
202202
DaVerifierNetwork: nomos_da_verifier::network::NetworkAdapter + Send + Sync + 'static,
@@ -238,7 +238,7 @@ where
238238
> + Send
239239
+ 'static,
240240
SamplingBackend::Settings: Clone,
241-
SamplingBackend::Blob: Debug + 'static,
241+
SamplingBackend::Share: Debug + 'static,
242242
SamplingBackend::BlobId: Debug + 'static,
243243
SamplingNetworkAdapter: nomos_da_sampling::network::NetworkAdapter + Send + 'static,
244244
SamplingStorage: nomos_da_sampling::storage::DaStorageAdapter + Send + 'static,
@@ -324,11 +324,11 @@ where
324324
),
325325
)
326326
.route(
327-
paths::DA_ADD_BLOB,
327+
paths::DA_ADD_SHARE,
328328
routing::post(
329-
add_blob::<
329+
add_share::<
330330
DaAttestation,
331-
DaBlob,
331+
DaShare,
332332
Membership,
333333
DaVerifierBackend,
334334
DaStorageSerializer,
@@ -391,12 +391,12 @@ where
391391
),
392392
)
393393
.route(
394-
paths::DA_GET_SHARED_COMMITMENTS,
395-
routing::get(da_get_commitments::<DaStorageSerializer, DaBlob>),
394+
paths::DA_GET_SHARES_COMMITMENTS,
395+
routing::get(da_get_commitments::<DaStorageSerializer, DaShare>),
396396
)
397397
.route(
398-
paths::DA_GET_LIGHT_BLOB,
399-
routing::get(da_get_light_blob::<DaStorageSerializer, DaBlob>),
398+
paths::DA_GET_LIGHT_SHARE,
399+
routing::get(da_get_light_share::<DaStorageSerializer, DaShare>),
400400
)
401401
.with_state(handle);
402402

nodes/nomos-executor/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ pub mod api;
22
pub mod config;
33

44
use api::backend::AxumBackend;
5-
use kzgrs_backend::common::blob::DaBlob;
5+
use kzgrs_backend::common::share::DaShare;
66
use nomos_api::ApiService;
77
use nomos_blend_service::{
88
backends::libp2p::Libp2pBlendBackend as BlendBackend,
99
network::libp2p::Libp2pAdapter as BlendNetworkAdapter, BlendService,
1010
};
11+
use nomos_core::da::blob::info::DispersedBlobInfo;
1112
use nomos_da_dispersal::{
1213
adapters::{
1314
mempool::kzgrs::KzgrsMempoolAdapter,
@@ -29,9 +30,8 @@ use nomos_da_verifier::{
2930
use nomos_mempool::backend::mockpool::MockPool;
3031
use nomos_node::{
3132
BlobInfo, Cryptarchia, DaIndexer, DaMempool, DaNetworkService, DaSampling, DaVerifier,
32-
DispersedBlobInfo, HeaderId, MempoolNetworkAdapter, NetworkBackend, NetworkService,
33-
NomosDaMembership, NomosTimeService, RocksBackend, StorageService, SystemSig, Tx, TxMempool,
34-
Wire, MB16,
33+
HeaderId, MempoolNetworkAdapter, NetworkBackend, NetworkService, NomosDaMembership,
34+
NomosTimeService, RocksBackend, StorageService, SystemSig, Tx, TxMempool, Wire, MB16,
3535
};
3636
use overwatch::OpaqueServiceHandle;
3737
use overwatch_derive::Services;
@@ -40,13 +40,13 @@ use rand_chacha::ChaCha20Rng;
4040
pub type ExecutorApiService = ApiService<
4141
AxumBackend<
4242
(),
43-
DaBlob,
43+
DaShare,
4444
BlobInfo,
4545
NomosDaMembership,
4646
BlobInfo,
4747
KzgrsDaVerifier,
4848
VerifierNetworkAdapter<NomosDaMembership>,
49-
VerifierStorageAdapter<DaBlob, Wire>,
49+
VerifierStorageAdapter<DaShare, Wire>,
5050
Tx,
5151
Wire,
5252
DispersalKZGRSBackend<DispersalNetworkAdapter<NomosDaMembership>, DispersalMempoolAdapter>,
@@ -56,7 +56,7 @@ pub type ExecutorApiService = ApiService<
5656
KzgrsSamplingBackend<ChaCha20Rng>,
5757
nomos_da_sampling::network::adapters::executor::Libp2pAdapter<NomosDaMembership>,
5858
ChaCha20Rng,
59-
SamplingStorageAdapter<DaBlob, Wire>,
59+
SamplingStorageAdapter<DaShare, Wire>,
6060
nomos_time::backends::system_time::SystemTimeBackend,
6161
HttApiAdapter<NomosDaMembership>,
6262
MB16,
@@ -69,10 +69,10 @@ pub type DispersalMempoolAdapter = KzgrsMempoolAdapter<
6969
KzgrsSamplingBackend<ChaCha20Rng>,
7070
nomos_da_sampling::network::adapters::executor::Libp2pAdapter<NomosDaMembership>,
7171
ChaCha20Rng,
72-
SamplingStorageAdapter<DaBlob, Wire>,
72+
SamplingStorageAdapter<DaShare, Wire>,
7373
KzgrsDaVerifier,
7474
VerifierNetworkAdapter<NomosDaMembership>,
75-
VerifierStorageAdapter<DaBlob, Wire>,
75+
VerifierStorageAdapter<DaShare, Wire>,
7676
HttApiAdapter<NomosDaMembership>,
7777
>;
7878

nodes/nomos-executor/src/main.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use clap::Parser;
22
use color_eyre::eyre::{eyre, Result};
3+
use nomos_core::da::blob::info::DispersedBlobInfo;
34
use nomos_executor::{
45
config::Config as ExecutorConfig, NomosExecutor, NomosExecutorServiceSettings,
56
};
67
use nomos_mempool::tx::settings::TxMempoolSettings;
78
use nomos_node::{
8-
config::BlendArgs, BlobInfo, CryptarchiaArgs, DaMempoolSettings, DispersedBlobInfo, HttpArgs,
9-
LogArgs, MempoolAdapterSettings, NetworkArgs, Transaction, Tx, CL_TOPIC, DA_TOPIC,
9+
config::BlendArgs, BlobInfo, CryptarchiaArgs, DaMempoolSettings, HttpArgs, LogArgs,
10+
MempoolAdapterSettings, NetworkArgs, Transaction, Tx, CL_TOPIC, DA_TOPIC,
1011
};
1112
use overwatch::overwatch::OverwatchRunner;
1213

0 commit comments

Comments
 (0)