Skip to content

Commit fa0612f

Browse files
committed
some fixes
1 parent fe32f4b commit fa0612f

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

circuit/src/builder/compiler/non_primitive_lowerer.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,7 @@ mod tests {
210210
// Test MmcsVerify with mock config (simplest case: 1 leaf + 1 index + 1 root)
211211
let mock_config = MmcsVerifyConfig::mock_config();
212212
assert_eq!(mock_config.ext_field_digest_elems, 1);
213-
assert_eq!(
214-
mock_config.input_size(),
215-
mock_config.ext_field_digest_elems + 1
216-
);
213+
assert_eq!(mock_config.input_size(), 2 * mock_config.ext_field_digest_elems + 1);
217214

218215
let mut config = BuilderConfig::new();
219216
config.enable_mmcs(&mock_config);
@@ -253,7 +250,7 @@ mod tests {
253250
assert_eq!(babybear_config.ext_field_digest_elems, 8);
254251
assert_eq!(
255252
babybear_config.input_size(),
256-
babybear_config.ext_field_digest_elems + 1
253+
2 * babybear_config.ext_field_digest_elems + 1
257254
);
258255

259256
let mut config = BuilderConfig::new();

circuit/src/ops/mmcs.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ pub struct MmcsVerifyConfig {
2727
}
2828

2929
impl MmcsVerifyConfig {
30-
/// Returns the number of inputs (witness elements) received.
30+
/// Returns the total number of witness elements consumed by the op.
31+
/// Layout: leaf (ext) + index (1) + root (ext)
3132
pub const fn input_size(&self) -> usize {
32-
// `ext_field_digest_elems` for the leaf and 1 for the index
33-
self.ext_field_digest_elems + 1
33+
2 * self.ext_field_digest_elems + 1
3434
}
3535

36+
/// MMCS verify is an assert-only op and does not produce outputs.
3637
pub const fn output_size(&self) -> usize {
37-
// `ext_field_digest_elems` for the root
38-
self.ext_field_digest_elems
38+
0
3939
}
4040

4141
/// Convert a digest represented as extension field elements into base field elements.
@@ -225,7 +225,7 @@ where
225225
let mut inputs = vec![];
226226
inputs.extend(leaf_expr);
227227
inputs.push(*index_expr);
228-
// Include root exprs as outputs for the non-primitive op lowering to map
228+
// Include root exprs as inputs for the non-primitive op; they are asserted
229229
inputs.extend(root_expr);
230230

231231
Ok(self.push_non_primitive_op(NonPrimitiveOpType::MmcsVerify, inputs, "mmcs_verify"))

circuit/src/tables/runner.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,14 @@ impl<F: CircuitField> CircuitRunner<F> {
7474
// Validate that the private data matches the operation type (if any)
7575
if let Op::NonPrimitiveOpWithExecutor { executor, .. } =
7676
&self.circuit.non_primitive_ops[op_id.0 as usize]
77-
{
78-
if let (
77+
&& let (
7978
crate::op::NonPrimitiveOpType::MmcsVerify,
8079
NonPrimitiveOpPrivateData::MmcsVerify(_),
8180
) = (executor.op_type(), &private_data)
82-
{
83-
// ok
84-
}
85-
// Other ops currently don't expect private data
81+
{
82+
// ok
8683
}
84+
// Other ops currently don't expect private data
8785

8886
// Store private data for this operation
8987
self.non_primitive_op_private_data[op_id.0 as usize] = Some(private_data);

0 commit comments

Comments
 (0)