Skip to content

Commit 7b83cac

Browse files
committed
integrate triple_xor gate
1 parent 923f130 commit 7b83cac

22 files changed

Lines changed: 1442 additions & 19 deletions

File tree

_typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ extend-exclude = [
55
]
66
[default.extend-words]
77
consts = "consts"
8+
ba = "ba"

crates/cairo_air/src/privacy_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,5 @@ fn test_privacy_proof_info() {
260260
let proof_info = ProofInfo::from_config(&proof_config);
261261
println!("{proof_info}");
262262
// Assert the total size in bytes.
263-
assert_eq!(proof_info.total_bytes(), 347360);
263+
assert_eq!(proof_info.total_bytes(), 355088);
264264
}

crates/cairo_air/src/sample_evaluations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// AIR version 77f11bb4
1+
// AIR version 80108501
22
use stwo::core::fields::{cm31::CM31, m31::M31, qm31::QM31};
33
pub const ADD_AP_OPCODE_SAMPLE_EVAL_RESULT: QM31 =
44
QM31(CM31(M31(1435814162), M31(1618992457)), CM31(M31(840348268), M31(442754761)));

crates/circuit_air/src/circuit_components.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::circuit_claim::{CircuitClaim, CircuitInteractionClaim, CircuitInteractionElements};
22
use crate::components::{
33
blake_g, blake_gate, blake_output, blake_round, blake_round_sigma, eq, m_31_to_u_32, qm31_ops,
4-
range_check_15, range_check_16, triple_xor_32, verify_bitwise_xor_4, verify_bitwise_xor_7,
5-
verify_bitwise_xor_8, verify_bitwise_xor_9, verify_bitwise_xor_12,
4+
range_check_15, range_check_16, triple_xor, triple_xor_32, verify_bitwise_xor_4,
5+
verify_bitwise_xor_7, verify_bitwise_xor_8, verify_bitwise_xor_9, verify_bitwise_xor_12,
66
};
77
use stwo::core::air::Component;
88
use stwo_constraint_framework::TraceLocationAllocator;
@@ -26,6 +26,7 @@ define_component_list! {
2626
BlakeG,
2727
BlakeOutput,
2828
TripleXor32,
29+
TripleXor,
2930
M31ToU32,
3031
VerifyBitwiseXor8,
3132
VerifyBitwiseXor12,
@@ -45,6 +46,7 @@ pub struct CircuitComponents {
4546
pub blake_g: blake_g::Component,
4647
pub blake_output: blake_output::Component,
4748
pub triple_xor_32: triple_xor_32::Component,
49+
pub triple_xor: triple_xor::Component,
4850
pub m_31_to_u_32: m_31_to_u_32::Component,
4951
pub verify_bitwise_xor_8: verify_bitwise_xor_8::Component,
5052
pub verify_bitwise_xor_12: verify_bitwise_xor_12::Component,
@@ -139,6 +141,16 @@ impl CircuitComponents {
139141
},
140142
interaction_claim.claimed_sums[ComponentList::TripleXor32 as usize],
141143
);
144+
let triple_xor_component = triple_xor::Component::new(
145+
tree_span_provider,
146+
triple_xor::Eval {
147+
claim: triple_xor::Claim {
148+
log_size: circuit_claim.log_sizes[ComponentList::TripleXor as usize],
149+
},
150+
common_lookup_elements: interaction_elements.common_lookup_elements.clone(),
151+
},
152+
interaction_claim.claimed_sums[ComponentList::TripleXor as usize],
153+
);
142154
let m_31_to_u_32_component = m_31_to_u_32::Component::new(
143155
tree_span_provider,
144156
m_31_to_u_32::Eval {
@@ -214,6 +226,7 @@ impl CircuitComponents {
214226
blake_g: blake_g_component,
215227
blake_output: blake_output_component,
216228
triple_xor_32: triple_xor_32_component,
229+
triple_xor: triple_xor_component,
217230
m_31_to_u_32: m_31_to_u_32_component,
218231
verify_bitwise_xor_8: verify_bitwise_xor_8_component,
219232
verify_bitwise_xor_12: verify_bitwise_xor_12_component,
@@ -235,6 +248,7 @@ impl CircuitComponents {
235248
Box::new(self.blake_g) as Box<dyn Component>,
236249
Box::new(self.blake_output) as Box<dyn Component>,
237250
Box::new(self.triple_xor_32) as Box<dyn Component>,
251+
Box::new(self.triple_xor) as Box<dyn Component>,
238252
Box::new(self.m_31_to_u_32) as Box<dyn Component>,
239253
Box::new(self.verify_bitwise_xor_8) as Box<dyn Component>,
240254
Box::new(self.verify_bitwise_xor_12) as Box<dyn Component>,

crates/circuit_air/src/circuit_eval_components/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub mod prelude;
88
pub mod range_check_15;
99
pub mod range_check_16;
1010
pub mod subroutines;
11+
pub mod triple_xor;
1112
pub mod triple_xor_32;
1213
pub mod verify_bitwise_xor_12;
1314
pub mod verify_bitwise_xor_4;

0 commit comments

Comments
 (0)