Skip to content

Commit

Permalink
Feat/Blob 4844 Chunk-level Patch (#1180)
Browse files Browse the repository at this point in the history
* Correct pow_of_rand assignment in evm_circuit

* Correct typo

* Add rpi_length_acc consistency for chunk_txbytes section for padding rows

* pow_limit is set to max l2 tx bytes in a blob for pow_of_rand table

---------

Co-authored-by: kunxian xia <[email protected]>
  • Loading branch information
darth-cy and kunxian-xia authored Mar 28, 2024
1 parent 0601c2d commit 6046b40
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion zkevm-circuits/src/evm_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,14 @@ impl<F: Field> SubCircuit<F> for EvmCircuit<F> {
) -> Result<(), Error> {
let block = self.block.as_ref().unwrap();

let max_blob_bytes = 4096 * 31 - 62;
let max_pow_limit = Some(max_blob_bytes);

config.load_fixed_table(layouter, self.fixed_table_tags.clone())?;
config.load_byte_table(layouter)?;
config
.pow_of_rand_table
.assign(layouter, challenges, None)?;
.assign(layouter, challenges, max_pow_limit)?;
let export = config.execution.assign_block(layouter, block, challenges)?;
self.exports.borrow_mut().replace(export);
Ok(())
Expand Down
13 changes: 12 additions & 1 deletion zkevm-circuits/src/pi_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,17 @@ impl<F: Field> SubCircuitConfig<F> for PiCircuitConfig<F> {
),
);

cb.condition(
is_rpi_padding,
|cb| {
cb.require_equal(
"rpi_length_cc' = rpi_length_acc for padding rows",
meta.query_advice(rpi_length_acc, Rotation::prev()),
meta.query_advice(rpi_length_acc, Rotation::cur()),
);
}
);

cb.gate(meta.query_fixed(q_chunk_txbytes, Rotation::cur()))
},
);
Expand Down Expand Up @@ -1214,7 +1225,7 @@ impl<F: Field> PiCircuitConfig<F> {
/// TxCircuit, which is an RLC summary of rlp_signed (including tx_type byte) of a L2 tx.
/// This is to ensure the fixed length of an otherwise variable length section.
///
/// The rip_length_acc field, subsequently, accumulates the length of the rlp_signed data for
/// The rpi_length_acc field, subsequently, accumulates the length of the rlp_signed data for
/// each tx and the RLC multiplier at each row is the power of rand corresponding to the
/// differential length.
///
Expand Down

0 comments on commit 6046b40

Please sign in to comment.