-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
129 changed files
with
856 additions
and
3,632 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
name = "local_blobs_dump" | ||
version = "0.1.0" | ||
edition.workspace = true | ||
authors.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
license.workspace = true | ||
keywords.workspace = true | ||
categories.workspace = true | ||
publish = false | ||
|
||
[dependencies] | ||
tokio.workspace = true | ||
anyhow.workspace = true | ||
clap.workspace = true | ||
tracing.workspace = true | ||
hex.workspace = true | ||
zksync_object_store.workspace = true | ||
|
||
zksync_dal.workspace = true | ||
zksync_core_leftovers.workspace = true | ||
zksync_protobuf_config.workspace = true | ||
zksync_types.workspace = true | ||
zksync_config.workspace = true | ||
zksync_l1_recovery.workspace = true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
use std::path::PathBuf; | ||
|
||
use anyhow::Context; | ||
use clap::Parser; | ||
use zksync_config::{ | ||
configs::{object_store::ObjectStoreMode, GeneralConfig}, | ||
ObjectStoreConfig, | ||
}; | ||
use zksync_core_leftovers::temp_config_store::read_yaml_repr; | ||
use zksync_dal::{ConnectionPool, Core, CoreDal}; | ||
use zksync_l1_recovery::{BlobKey, BlobWrapper}; | ||
use zksync_object_store::{serialize_using_bincode, Bucket, ObjectStoreFactory, StoredObject}; | ||
use zksync_types::{eth_sender::EthTxBlobSidecar, H512}; | ||
|
||
#[derive(Debug, Parser)] | ||
#[command(author, version, about, long_about)] | ||
struct Cli { | ||
#[arg(long, global = true)] | ||
secrets_path: PathBuf, | ||
|
||
#[arg(long, global = true)] | ||
config_path: PathBuf, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() -> anyhow::Result<()> { | ||
let opts = Cli::parse(); | ||
let secrets_config = | ||
read_yaml_repr::<zksync_protobuf_config::proto::secrets::Secrets>(&opts.secrets_path) | ||
.context("failed decoding secrets YAML config")?; | ||
let database_secrets = secrets_config | ||
.database | ||
.clone() | ||
.context("Failed to find database config")?; | ||
|
||
let connection_pool = ConnectionPool::<Core>::singleton(database_secrets.master_url()?) | ||
.build() | ||
.await | ||
.context("failed to build a connection pool")?; | ||
|
||
let general_config = | ||
read_yaml_repr::<zksync_protobuf_config::proto::general::GeneralConfig>(&opts.config_path) | ||
.context("failed decoding general YAML config")?; | ||
let object_store_config = general_config | ||
.snapshot_recovery | ||
.unwrap() | ||
.object_store | ||
.context("failed to find core object store config")?; | ||
let object_store = ObjectStoreFactory::new(object_store_config) | ||
.create_store() | ||
.await?; | ||
|
||
let mut id = 1; | ||
loop { | ||
let mut storage = connection_pool.connection().await.unwrap(); | ||
let tx = storage.eth_sender_dal().get_eth_tx(id).await.unwrap(); | ||
id += 1; | ||
if tx.is_none() { | ||
break; | ||
} | ||
|
||
if let Some(blob_sidecar) = tx.unwrap().blob_sidecar { | ||
match blob_sidecar { | ||
EthTxBlobSidecar::EthTxBlobSidecarV1(sidecar) => { | ||
for blob in sidecar.blobs { | ||
object_store | ||
.put( | ||
BlobKey { | ||
kzg_commitment: blob | ||
.commitment | ||
.try_into() | ||
.expect("unable to convert kzg_commitment to [u8; 48]"), | ||
}, | ||
&BlobWrapper { blob: blob.blob }, | ||
) | ||
.await?; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
println!("Finished dumping blobs"); | ||
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
5 changes: 3 additions & 2 deletions
5
...8d4768c6a803a1a90889e5a1b8254c315231.json → ...f86051e80928c5530cacc02530a93812be8c.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
clear | ||
cd ../../.. | ||
cargo run --bin local_blobs_dump --release -- \ | ||
--config-path chains/era/configs/general.yaml \ | ||
--secrets-path chains/era/configs/secrets.yaml | ||
zkstack dev db reset | ||
rm -rf chains/era/db/main | ||
zkstack server --l1-recovery --verbose |
Oops, something went wrong.