Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
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
20 changes: 11 additions & 9 deletions aggregator/src/aggregation/blob_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ impl BlobDataConfig {
}

// enable hash selector
for offset in N_ROWS_METADATA + N_ROWS_DATA..N_ROWS_BLOB_DATA_CONFIG {
for offset in
N_ROWS_METADATA + N_ROWS_DATA..N_ROWS_METADATA + N_ROWS_DATA + N_ROWS_DIGEST_RLC
{
self.hash_selector.enable(&mut region, offset)?;
}

Expand Down Expand Up @@ -662,8 +664,8 @@ impl BlobDataConfig {
region.constrain_equal(i_val.cell(), row.chunk_idx.cell())?;
}

let blob_preimage_rlc_specified = &rows.last().unwrap().preimage_rlc;
let blob_digest_rlc_specified = &rows.last().unwrap().digest_rlc;
let challenge_digest_preimage_rlc_specified = &rows.last().unwrap().preimage_rlc;
let challenge_digest_rlc_specified = &rows.last().unwrap().digest_rlc;

// ensure that on the last row of this section the is_boundary is turned on
// which would enable the keccak table lookup for challenge_digest
Expand Down Expand Up @@ -733,15 +735,15 @@ impl BlobDataConfig {
///////////////////////////////// DIGEST BYTES /////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

let mut blob_preimage_keccak_rlc = zero.clone();
let mut challenge_digest_preimage_keccak_rlc = zero.clone();
let rows = assigned_rows
.iter()
.skip(N_ROWS_METADATA + N_ROWS_DATA + N_ROWS_DIGEST_RLC)
.take(N_ROWS_DIGEST_BYTES)
.collect::<Vec<_>>();
for (i, digest_rlc_specified) in std::iter::once(metadata_digest_rlc_specified)
.chain(chunk_digest_evm_rlcs)
.chain(std::iter::once(blob_digest_rlc_specified))
.chain(std::iter::once(challenge_digest_rlc_specified))
.enumerate()
{
let digest_rows = rows
Expand Down Expand Up @@ -771,18 +773,18 @@ impl BlobDataConfig {
&r_keccak,
&mut rlc_config_offset,
)?;
blob_preimage_keccak_rlc = rlc_config.mul_add(
challenge_digest_preimage_keccak_rlc = rlc_config.mul_add(
&mut region,
&blob_preimage_keccak_rlc,
&challenge_digest_preimage_keccak_rlc,
&r32,
&digest_keccak_rlc,
&mut rlc_config_offset,
)?;
}
}
region.constrain_equal(
blob_preimage_keccak_rlc.cell(),
blob_preimage_rlc_specified.cell(),
challenge_digest_preimage_keccak_rlc.cell(),
challenge_digest_preimage_rlc_specified.cell(),
)?;

////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 4 additions & 1 deletion aggregator/src/tests/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
aggregation::{
AssignedBarycentricEvaluationConfig, BarycentricEvaluationConfig, BlobDataConfig, RlcConfig,
},
blob::{BlobAssignments, BlobData},
blob::{BlobAssignments, BlobData, N_ROWS_DATA},
param::ConfigParams,
MAX_AGG_SNARKS,
};
Expand Down Expand Up @@ -167,6 +167,8 @@ fn check_circuit(data: BlobData) -> Result<(), Vec<VerifyFailure>> {

#[test]
fn blob_circuit_completeness() {
// single chunk in batch, but the chunk has a size of N_ROWS_DATA
let full_blob = vec![vec![123; N_ROWS_DATA]];
let all_empty_chunks: Vec<Vec<u8>> = vec![vec![]; MAX_AGG_SNARKS];
let one_chunk = vec![vec![2, 3, 4, 100, 1]];
let two_chunks = vec![vec![100; 1000], vec![2, 3, 4, 100, 1]];
Expand All @@ -188,6 +190,7 @@ fn blob_circuit_completeness() {
.collect::<Vec<_>>();

for blob in [
full_blob,
one_chunk,
two_chunks,
max_chunks,
Expand Down