-
Notifications
You must be signed in to change notification settings - Fork 174
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
6 changed files
with
128 additions
and
34 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,17 +1,24 @@ | ||
use katana_primitives::da::{blob, encoding, serde::parse_str_to_blob_data}; | ||
use anyhow::Result; | ||
use katana_primitives::da::encoding::encode_state_updates; | ||
use katana_primitives::da::serde::parse_str_to_blob_data; | ||
use katana_primitives::da::{blob, encoding}; | ||
use num_bigint::BigUint; | ||
use rstest::rstest; | ||
|
||
fn read(path: &str) -> Vec<BigUint> { | ||
let content = std::fs::read_to_string(path).unwrap(); | ||
let content = content.trim(); | ||
parse_str_to_blob_data(content.strip_prefix("0x").unwrap_or(&content)) | ||
parse_str_to_blob_data(content.strip_prefix("0x").unwrap_or(content)) | ||
} | ||
|
||
/// Pre-SNAR Tree blobs | ||
#[rstest] | ||
#[case("./tests/test-data/blobs/blob1.txt")] | ||
fn parse_blobs(#[case] blob: &str) { | ||
#[case("./tests/test-data/blobs/block_636262.txt")] | ||
#[case("./tests/test-data/blobs/block_636263.txt")] | ||
#[case("./tests/test-data/blobs/block_636264.txt")] | ||
fn parse_blobs_rt(#[case] blob: &str) -> Result<()> { | ||
let encoded = blob::recover(read(blob)); | ||
let state_update = encoding::decode_state_updates(&encoded); | ||
println!("{}", serde_json::to_string_pretty(&state_update).unwrap()); | ||
let state_update = encoding::decode_state_updates(&encoded)?; | ||
let _ = encode_state_updates(state_update); | ||
Ok(()) | ||
} |
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
crates/katana/primitives/tests/test-data/blobs/block_636262.txt
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
crates/katana/primitives/tests/test-data/blobs/block_636263.txt
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
crates/katana/primitives/tests/test-data/blobs/block_636264.txt
Large diffs are not rendered by default.
Oops, something went wrong.