Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit e8aecb6

Browse files
authored
bytecode_circuit: fix padding_shift underconstrainted (#508)
1 parent e6bdb8d commit e8aecb6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

zkevm-circuits/src/bytecode_circuit/circuit/to_poseidon_hash.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ impl<F: Field, const BYTES_IN_FIELD: usize> ToHashBlockCircuitConfig<F, BYTES_IN
164164
);
165165
});
166166

167-
cb.condition(not::expr(q_byte_in_field_not_last(meta)), |cb|{
167+
cb.condition(meta.query_advice(is_field_border, Rotation::prev()), |cb|{
168168

169169
cb.require_equal(
170-
"if !q_byte_in_field_not_last padding_shift := 1",
170+
"if is_field_border_prev padding_shift := 256^(BYTES_IN_FIELD-1)",
171171
meta.query_advice(padding_shift, Rotation::cur()),
172-
1.expr(),
172+
Expression::Constant(F::from(256 as u64).pow_vartime([BYTES_IN_FIELD as u64-1])),
173173
);
174174
});
175175

@@ -497,13 +497,13 @@ impl<F: Field, const BYTES_IN_FIELD: usize> ToHashBlockCircuitConfig<F, BYTES_IN
497497
offset: usize,
498498
) -> Result<(), Error> {
499499
for (name, column) in [
500-
("control length header", self.control_length),
500+
// ("control length header", self.control_length),
501501
("field input header", self.field_input),
502502
("bytes in field header", self.bytes_in_field_index),
503503
("bytes in field inv header", self.bytes_in_field_inv),
504504
("field border header", self.is_field_border),
505-
("padding shift header", self.padding_shift),
506-
("field index header", self.field_index),
505+
// ("padding shift header", self.padding_shift),
506+
// ("field index header", self.field_index),
507507
("field index inv header", self.field_index_inv),
508508
] {
509509
region.assign_advice(

0 commit comments

Comments
 (0)