diff --git a/sz-poc-offsite-2025/evm/lightnode/Cargo.toml b/sz-poc-offsite-2025/evm/lightnode/Cargo.toml index 8c31a76..d05e98f 100644 --- a/sz-poc-offsite-2025/evm/lightnode/Cargo.toml +++ b/sz-poc-offsite-2025/evm/lightnode/Cargo.toml @@ -16,3 +16,5 @@ risc0-zkvm = { version = "2" } indexmap = { version = "1.9.3" } url = { version = "2" } hex = { version = "0.4" } +futures = { version = "0.3" } +kzgrs-backend = { git = "https://github.com/logos-co/nomos", branch = "master" } diff --git a/sz-poc-offsite-2025/evm/lightnode/src/lib.rs b/sz-poc-offsite-2025/evm/lightnode/src/lib.rs index 95f26e3..99dbad0 100644 --- a/sz-poc-offsite-2025/evm/lightnode/src/lib.rs +++ b/sz-poc-offsite-2025/evm/lightnode/src/lib.rs @@ -1,9 +1,14 @@ +use std::collections::HashSet; + +use executor_http_client::{BasicAuthCredentials, Error, ExecutorHttpClient}; +use kzgrs_backend::common::share::{DaLightShare, DaShare}; use nomos::{CryptarchiaInfo, HeaderId}; use reqwest::Url; -use tracing::{error, info}; +use tracing::{debug, error, info}; pub const CRYPTARCHIA_INFO: &str = "cryptarchia/info"; pub const STORAGE_BLOCK: &str = "storage/block"; +use futures::Stream; pub mod nomos; pub mod proofcheck; @@ -18,6 +23,7 @@ pub struct NomosClient { base_url: Url, reqwest_client: reqwest::Client, basic_auth: Credentials, + nomos_client: ExecutorHttpClient, } impl NomosClient { @@ -25,14 +31,18 @@ impl NomosClient { Self { base_url, reqwest_client: reqwest::Client::new(), - basic_auth, + basic_auth: basic_auth.clone(), + nomos_client: ExecutorHttpClient::new(Some(BasicAuthCredentials::new( + basic_auth.username, + basic_auth.password, + ))), } } pub async fn get_cryptarchia_info(&self) -> Result { let url = self.base_url.join(CRYPTARCHIA_INFO).expect("Invalid URL"); - info!("Requesting cryptarchia info from {}", url); + debug!("Requesting cryptarchia info from {}", url); let request = self.reqwest_client.get(url).basic_auth( &self.basic_auth.username, self.basic_auth.password.as_deref(), @@ -84,11 +94,21 @@ impl NomosClient { "Failed to parse JSON".to_string() })?; - info!( - "Block (raw): {}", - serde_json::to_string_pretty(&json).unwrap() - ); - Ok(json) } + + pub async fn get_shares( + &self, + blob_id: [u8; 32], + ) -> Result, Error> { + self.nomos_client + .get_shares::( + self.base_url.clone(), + blob_id, + HashSet::new(), + HashSet::new(), + true, + ) + .await + } } diff --git a/sz-poc-offsite-2025/evm/lightnode/src/main.rs b/sz-poc-offsite-2025/evm/lightnode/src/main.rs index 0b907c2..257c661 100644 --- a/sz-poc-offsite-2025/evm/lightnode/src/main.rs +++ b/sz-poc-offsite-2025/evm/lightnode/src/main.rs @@ -1,9 +1,9 @@ use clap::Parser; use evm_lightnode::proofcheck; -use url::Url; -use std::path::PathBuf; use std::error; +use std::path::PathBuf; use tracing_subscriber::{EnvFilter, fmt}; +use url::Url; #[derive(Parser, Debug)] #[clap(author, version, about = "Light Node validator")] @@ -41,8 +41,12 @@ async fn main() -> Result<(), Box> { args.batch_size, &args.rpc, &args.prover_url, - &args.zeth_binary_dir.unwrap_or_else(|| std::env::current_dir().unwrap()).join("zeth-ethereum"), - ).await?; + &args + .zeth_binary_dir + .unwrap_or_else(|| std::env::current_dir().unwrap()) + .join("zeth-ethereum"), + ) + .await?; Ok(()) }