Skip to content
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

full blob test #1423

Merged
merged 7 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aggregator/data/test_batches/batch274.hex

Large diffs are not rendered by default.

45 changes: 24 additions & 21 deletions aggregator/src/tests/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,18 @@ fn check_circuit(circuit: &BlobCircuit) -> Result<(), Vec<VerifyFailure>> {

#[test]
fn blob_circuit_completeness() {
// TODO: enable this once we have another deterministic case of batch -> blob (fully packed).
// now batch274 is an deterministic case of batch -> blob (fully packed).
// Full blob test case
// batch274 contains batch bytes that will produce a full blob
// let full_blob = hex::decode(
// fs::read_to_string("./data/test_batches/batch274.hex")
// .expect("file path exists")
// .trim(),
// )
// .expect("should load full blob batch bytes");
// batch274 contains metadata
// let segmented_full_blob_src = BatchData::<MAX_AGG_SNARKS>::segment_with_metadata(full_blob);
let full_blob = hex::decode(
fs::read_to_string("./data/test_batches/batch274.hex")
.expect("file path exists")
.trim(),
)
.expect("should load full blob batch bytes");

// batch274 contains metadatas
let segmented_full_blob_src = BatchData::<MAX_AGG_SNARKS>::segment_with_metadata(full_blob);

let all_empty_chunks: Vec<Vec<u8>> = vec![vec![]; MAX_AGG_SNARKS];
let one_chunk = vec![vec![2, 3, 4, 100, 1]];
Expand All @@ -305,8 +306,8 @@ fn blob_circuit_completeness() {
.chain(std::iter::once(vec![3, 100, 24, 30]))
.collect::<Vec<_>>();

for blob in [
// segmented_full_blob_src,
for (idx, blob) in [
segmented_full_blob_src,
one_chunk,
two_chunks,
max_chunks,
Expand All @@ -317,19 +318,21 @@ fn blob_circuit_completeness() {
all_empty_except_last,
]
.into_iter()
.enumerate()
{
let batch_data = BatchData::from(&blob);

// TODO: enable this once we have another deterministic case of batch -> blob (fully
// packed).
// First blob is purposely constructed to take full blob space
// if idx == 0 {
// let blob_data_bytes_len = batch_data.get_blob_data_bytes().len();
// assert_eq!(
// blob_data_bytes_len, N_BLOB_BYTES,
// "should be full blob: expected={N_BLOB_BYTES}, got={blob_data_bytes_len}",
// );
// }
// First blob(batch274's blob data) is purposely constructed to take full blob space
if idx == 0 {
let batch_data_bytes = batch_data.get_batch_data_bytes();
let blob_data_bytes = get_blob_bytes(&batch_data_bytes);
let blob_data_bytes_len = blob_data_bytes.len();

assert_eq!(
blob_data_bytes_len, N_BLOB_BYTES,
"should be full blob: expected={N_BLOB_BYTES}, got={blob_data_bytes_len}",
);
}

assert_eq!(check_data(batch_data), Ok(()), "{:?}", blob);
}
Expand Down
Loading