Skip to content

Commit 0f106d7

Browse files
authored
chore: update logic module audit scope (#20556)
Update logic module audit scope
2 parents 694fcd9 + 42462f5 commit 0f106d7

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed

barretenberg/cpp/scripts/audit/audit_scopes/logic_scope_doc.md renamed to barretenberg/cpp/scripts/audit/audit_scopes/logic_audit_scope.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,29 @@
22

33
Repository: https://github.com/AztecProtocol/aztec-packages
44

5-
Commit hash: TBD
5+
Commit hash: e4712cda8def49d75fbba2d361625fc5e21945f5
66

77
## Files to Audit
88

99
Note: Paths relative to `aztec-packages/barretenberg/cpp/src/barretenberg`
1010

11+
### stdlib (core logic implementation)
12+
1113
1. `stdlib/primitives/logic/logic.hpp`
1214
2. `stdlib/primitives/logic/logic.cpp`
1315
3. `stdlib_circuit_builders/plookup_tables/uint.hpp` (lookup tables)
1416

17+
### dsl (ACIR interface)
18+
19+
4. `dsl/acir_format/logic_constraint.hpp` — ACIR struct and gate function declarations
20+
5. `dsl/acir_format/logic_constraint.cpp` — Converts ACIR logic constraints into stdlib circuit gates
21+
1522
## Summary of Module
1623

1724
The `logic` module provides circuit-friendly implementations of bitwise logical operations (XOR and AND) over variable-length unsigned integers using plookup tables.
1825

26+
### stdlib layer
27+
1928
Main function: `create_logic_constraint(a, b, num_bits, is_xor_gate)`
2029

2130
- Computes `a XOR b` or `a AND b` for inputs up to `num_bits` in length
@@ -31,10 +40,19 @@ The implementation:
3140
- If both inputs are constants, the operation is computed natively without circuit constraints
3241
- If one input is constant, it is converted to a witness before processing
3342

43+
### dsl layer
44+
45+
The DSL layer bridges ACIR opcodes (`BlackBoxFuncCall::AND`, `BlackBoxFuncCall::XOR`) to the stdlib logic implementation:
46+
47+
- `acir_to_constraint_buf.cpp` deserializes ACIR AND/XOR black box calls into `LogicConstraint` structs (deserialization file itself is out of scope)
48+
- `create_logic_gate` converts `WitnessOrConstant` inputs to `field_ct` via `to_field_ct`, calls `stdlib::logic::create_logic_constraint`, and asserts the computed result equals the ACIR-provided result witness
49+
3450
## Test Files
3551

3652
1. `stdlib/primitives/logic/logic.test.cpp`
53+
2. `dsl/acir_format/logic_constraint.test.cpp`
3754

3855
## Dependencies
3956

4057
- Plookup read: `stdlib/primitives/plookup/plookup.hpp`
58+
- ACIR format core: `dsl/acir_format/acir_format.hpp` (constraint application loop)

barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// === AUDIT STATUS ===
2-
// internal: { status: Planned, auditors: [], commit: }
2+
// internal: { status: Complete, auditors: [Suyash], commit: e4712cda8def49d75fbba2d361625fc5e21945f5 }
33
// external_1: { status: not started, auditors: [], commit: }
44
// external_2: { status: not started, auditors: [], commit: }
55
// =====================

barretenberg/cpp/src/barretenberg/dsl/acir_format/logic_constraint.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// === AUDIT STATUS ===
2-
// internal: { status: Planned, auditors: [], commit: }
2+
// internal: { status: Complete, auditors: [Suyash], commit: e4712cda8def49d75fbba2d361625fc5e21945f5 }
33
// external_1: { status: not started, auditors: [], commit: }
44
// external_2: { status: not started, auditors: [], commit: }
55
// =====================

barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// === AUDIT STATUS ===
2-
// internal: { status: Planned, auditors: [], commit: }
2+
// internal: { status: Complete, auditors: [Suyash], commit: e4712cda8def49d75fbba2d361625fc5e21945f5 }
33
// external_1: { status: not started, auditors: [], commit: }
44
// external_2: { status: not started, auditors: [], commit: }
55
// =====================

barretenberg/cpp/src/barretenberg/stdlib/primitives/logic/logic.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// === AUDIT STATUS ===
2-
// internal: { status: Planned, auditors: [], commit: }
2+
// internal: { status: Complete, auditors: [Suyash], commit: e4712cda8def49d75fbba2d361625fc5e21945f5 }
33
// external_1: { status: not started, auditors: [], commit: }
44
// external_2: { status: not started, auditors: [], commit: }
55
// =====================

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/plookup_tables/uint.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// === AUDIT STATUS ===
2-
// internal: { status: Planned, auditors: [], commit: }
2+
// internal: { status: Complete, auditors: [Suyash], commit: e4712cda8def49d75fbba2d361625fc5e21945f5 }
33
// external_1: { status: not started, auditors: [], commit: }
44
// external_2: { status: not started, auditors: [], commit: }
55
// =====================

0 commit comments

Comments
 (0)