-
-
Save i1i1/334739168b97242e1ba3812872ecff00 to your computer and use it in GitHub Desktop.
Celestia nonce error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::sync::Arc; | |
use celestia_rpc::{BlobClient, Client}; | |
use celestia_types::{nmt::Namespace, AppVersion, Blob, TxConfig}; | |
use clap::Parser; | |
use color_eyre::eyre::*; | |
#[derive(Debug, Parser)] | |
struct Args { | |
#[arg(default_value = "http://localhost:26658")] | |
url: url::Url, | |
token: Option<String>, | |
} | |
#[tokio::main] | |
async fn main() -> Result<()> { | |
color_eyre::install()?; | |
tracing_subscriber::fmt::init(); | |
let Args { | |
token, | |
url, | |
} = Args::parse(); | |
let token = match token { | |
Some(token) => token, | |
None => std::env::var("CELESTIA_NODE_AUTH_TOKEN") | |
.context("Set token either via arg or via `CELESTIA_NODE_AUTH_TOKEN` env variable")?, | |
}; | |
let now = std::time::Instant::now(); | |
let blob_size = 1_900_000; | |
let my_namespace = Namespace::new_v0(b"Rise").expect("Invalid namespace"); | |
let client = Client::new(url.as_ref(), Some(&token)) | |
.await | |
.map(Arc::new) | |
.context("Failed creating rpc client")?; | |
let blobs = (0..100) | |
.map(|i| Blob::new(my_namespace, vec![i; blob_size], AppVersion::V2)) | |
.collect::<Result<Vec<_>, _>>() | |
.unwrap(); | |
let n = 10; | |
for blobs in blobs.chunks(n) { | |
let futures = blobs | |
.chunks(1) | |
.map(|blobs| client.blob_submit(&blobs, TxConfig::default())); | |
println!("{n} Blobs started {:?}", now.elapsed()); | |
futures::future::try_join_all(futures).await.unwrap(); | |
println!("{n} Blobs done {:?}", now.elapsed()); | |
} | |
println!("Total elapsed: {:?}", now.elapsed()); | |
Ok(()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 Blobs started 355.047555ms | |
10 Blobs done 21.153450732s | |
10 Blobs started 21.153464769s | |
10 Blobs done 41.683862125s | |
10 Blobs started 41.683872465s | |
10 Blobs done 70.642021972s | |
10 Blobs started 70.642032803s | |
10 Blobs done 92.655878979s | |
10 Blobs started 92.655900019s | |
10 Blobs done 113.767686297s | |
10 Blobs started 113.767696116s | |
The application panicked (crashed). | |
Message: called `Result::unwrap()` on an `Err` value: Call(ErrorObject { code: ServerError(1), message: "broadcast tx error: account sequence mismatch, expected 471, got 472: incorrect account sequence", data: None }) | |
Location: src/main.rs:52 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment