fix lightnode

This commit is contained in:
Giacomo Pasini 2025-05-19 18:19:59 +02:00
parent ad29e630e5
commit 8cdc2d1dbe
No known key found for this signature in database
GPG Key ID: FC08489D2D895D4B
3 changed files with 648 additions and 485 deletions

1117
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ struct Args {
#[clap(long, default_value = "http://localhost:8545")] #[clap(long, default_value = "http://localhost:8545")]
rpc: Url, rpc: Url,
#[clap(long, default_value = "wss://localhost:8546")] #[clap(long, default_value = "ws://localhost:8546")]
ws_rpc: Url, ws_rpc: Url,
#[clap(long, default_value = "http://localhost:8070")] #[clap(long, default_value = "http://localhost:8070")]
@ -47,14 +47,16 @@ async fn main() -> Result<(), Box<dyn error::Error>> {
fmt::fmt().with_env_filter(filter).with_target(false).init(); fmt::fmt().with_env_filter(filter).with_target(false).init();
let zone_blocks = follow_sz(args.ws_rpc.clone()).await?; let zone_blocks = follow_sz(args.ws_rpc.clone()).await.unwrap();
let (tx, da_blobs) = tokio::sync::mpsc::channel::<BlobId>(MAX_BLOBS); let (tx, da_blobs) = tokio::sync::mpsc::channel::<BlobId>(MAX_BLOBS);
let username = std::env::var("NOMOS_USER").unwrap_or_default();
let password = std::env::var("NOMOS_PASSWORD").ok();
tokio::spawn(check_blobs( tokio::spawn(check_blobs(
NomosClient::new( NomosClient::new(
args.nomos_node.clone(), args.nomos_node.clone(),
Credentials { Credentials {
username: "user".to_string(), username,
password: Some("password".to_string()), password,
}, },
), ),
tx tx
@ -205,7 +207,6 @@ async fn follow_sz(
let heavy_task = tokio::task::spawn_blocking(move || encoder.encode(&data)); let heavy_task = tokio::task::spawn_blocking(move || encoder.encode(&data));
let encoded_data = heavy_task.await.unwrap().unwrap(); let encoded_data = heavy_task.await.unwrap().unwrap();
kzgrs_backend::common::build_blob_id( kzgrs_backend::common::build_blob_id(
&encoded_data.aggregated_column_commitment,
&encoded_data.row_commitments, &encoded_data.row_commitments,
) )
}; };
@ -238,7 +239,7 @@ async fn check_blobs(
if info.tip != current_tip { if info.tip != current_tip {
current_tip = info.tip; current_tip = info.tip;
tracing::debug!("new tip: {:?}", info.tip); tracing::debug!("new tip: {:?}", info.tip);
let blobs = nomos_client.get_block(info.tip).await?.blobs; let blobs = nomos_client.get_block(info.tip).await?.bl_blobs;
if blobs.is_empty() { if blobs.is_empty() {
tracing::debug!("No blobs found in block"); tracing::debug!("No blobs found in block");
@ -246,7 +247,7 @@ async fn check_blobs(
} }
for blob in blobs { for blob in blobs {
sink.send(blob).await?; sink.send(blob.id).await?;
} }
} else { } else {
tracing::trace!("No new tip, sleeping..."); tracing::trace!("No new tip, sleeping...");

View File

@ -51,6 +51,7 @@ fn main() -> eyre::Result<()> {
"--dev.block-time=2s", "--dev.block-time=2s",
"--http.addr=0.0.0.0", "--http.addr=0.0.0.0",
"--http.api=eth,net,web3,debug,trace,txpool", // Some might be unnecessary, but I guess "--http.api=eth,net,web3,debug,trace,txpool", // Some might be unnecessary, but I guess
"--ws",
"--ws.addr=0.0.0.0", "--ws.addr=0.0.0.0",
"--ws.api=eth,net,web3,txpool", "--ws.api=eth,net,web3,txpool",
"--http.corsdomain=\"*\"", // Needed locally, probably needed here as well. "--http.corsdomain=\"*\"", // Needed locally, probably needed here as well.