-
Notifications
You must be signed in to change notification settings - Fork 3
update celestia client, and fetch chain id from network #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,10 @@ use generate_pie::{ | |
| types::{ChainConfig, OsHintsConfiguration}, | ||
| }; | ||
| use log::{debug, error, info, trace}; | ||
| use starknet::providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider}; | ||
| use starknet::{ | ||
| core::types::BlockId, | ||
| providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider}, | ||
| }; | ||
| use starknet_api::{contract_address, core::ChainId}; | ||
| use tokio::{ | ||
| sync::{ | ||
|
|
@@ -106,6 +109,23 @@ where | |
| db.initialize_block(block_number.try_into().unwrap()) | ||
| .await | ||
| .unwrap(); | ||
| let state_update = &JsonRpcClient::new(HttpTransport::new(rpc_url.clone())) | ||
| .get_state_update(BlockId::Number(block_number)) | ||
| .await | ||
| .unwrap(); | ||
| let state_update = match state_update { | ||
| starknet::core::types::MaybePreConfirmedStateUpdate::Update(state_update) => { | ||
| state_update | ||
| } | ||
| //TODO: handle this case properly | ||
| starknet::core::types::MaybePreConfirmedStateUpdate::PreConfirmedUpdate(_) => { | ||
| panic!("PreConfirmedStateUpdate not supported") | ||
chudkowsky marked this conversation as resolved.
Show resolved
Hide resolved
chudkowsky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| }; | ||
|
|
||
| db.add_state_update(block_number.try_into().unwrap(), state_update.clone()) | ||
| .await | ||
| .unwrap(); | ||
|
Comment on lines
+112
to
+128
|
||
|
|
||
| match db | ||
| .get_pie(block_number.try_into().unwrap(), Step::Snos) | ||
|
|
@@ -116,6 +136,7 @@ where | |
| let new_block = BlockInfo { | ||
| number: block_number, | ||
| status: BlockStatus::SnosPieGenerated, | ||
| state_update: Some(state_update.clone()), | ||
| }; | ||
| trace!(block_number; "Pie generated"); | ||
|
|
||
|
|
@@ -159,6 +180,7 @@ where | |
| let new_block = BlockInfo { | ||
| number: block_number, | ||
| status: BlockStatus::SnosPieGenerated, | ||
| state_update: Some(state_update.clone()), | ||
| }; | ||
|
|
||
| let pie_bytes = compress_pie(pie.clone()).await.unwrap(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||||||
| use anyhow::Result; | ||||||||||
| use celestia_rpc::{BlobClient, Client}; | ||||||||||
| use celestia_types::{nmt::Namespace, AppVersion, Blob, TxConfig}; | ||||||||||
| use celestia_rpc::{BlobClient, Client, TxConfig}; | ||||||||||
| use celestia_types::{nmt::Namespace, AppVersion, Blob}; | ||||||||||
chudkowsky marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| use log::{debug, info}; | ||||||||||
| use tokio::sync::mpsc::{Receiver, Sender}; | ||||||||||
| use url::Url; | ||||||||||
|
|
@@ -53,7 +53,7 @@ where | |||||||||
| debug!("Received new proof"); | ||||||||||
|
|
||||||||||
| // TODO: error handling | ||||||||||
| let client = Client::new(self.rpc_url.as_ref(), Some(&self.auth_token)) | ||||||||||
| let client = Client::new(self.rpc_url.as_ref(), Some(&self.auth_token), None, None) | ||||||||||
| .await | ||||||||||
| .unwrap(); | ||||||||||
|
|
||||||||||
|
|
@@ -68,8 +68,9 @@ where | |||||||||
| ciborium::into_writer(&packet, &mut serialized_packet).unwrap(); | ||||||||||
|
|
||||||||||
| // TODO: error handling | ||||||||||
|
||||||||||
| // TODO: error handling | |
| // TODO: error handling | |
| // The third argument is the NMT share version (Option<u8>); `None` means | |
| // "use the default share version" as defined by the Celestia node/API. |
Copilot
AI
Feb 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The blob is cloned before accessing the commitment field. Consider accessing commitment directly from blob without cloning to improve performance, as cloning the entire blob (which may contain large data) just to access the commitment is inefficient.
| let commitment = blob.clone().commitment; | |
| let commitment = commitment.hash(); | |
| let commitment = blob.commitment.hash(); |
Uh oh!
There was an error while loading. Please reload this page.