Skip to content

Commit 208c158

Browse files
Bump stwo-circuits and adapt to unreduced hash output (#375)
Bump stwo-circuits (041ec61 → 0451681), stwo-cairo (a837f0ea → 68b4af6d), and stwo (74951f79 → 5ea05973). Adapt to the upstream change where verifier circuits now output the full 8-word unreduced Blake2s digest instead of 2 reduced QM31s (stwo-circuits#597). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0b5d6af commit 208c158

7 files changed

Lines changed: 62 additions & 62 deletions

File tree

Cargo.lock

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ cairo-lang-execute-utils = "2.19.0-rc.0"
6161
cairo-lang-utils = "2.19.0-rc.0"
6262

6363
# stwo cairo
64-
cairo-air = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
65-
stwo-cairo-utils = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
66-
stwo-cairo-adapter = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
67-
stwo-cairo-prover = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
68-
stwo-cairo-serialize = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
69-
stwo-cairo-common = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
64+
cairo-air = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
65+
stwo-cairo-utils = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
66+
stwo-cairo-adapter = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
67+
stwo-cairo-prover = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
68+
stwo-cairo-serialize = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
69+
stwo-cairo-common = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
7070

7171

7272
# local crates

crates/privacy_circuit_verify/Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ cairo-vm = { workspace = true, features = [
3131
] }
3232

3333
# stwo cairo
34-
cairo-air = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
35-
stwo-cairo-serialize = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
36-
stwo-cairo-common = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
34+
cairo-air = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
35+
stwo-cairo-serialize = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
36+
stwo-cairo-common = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
3737

3838
# stwo circuits
39-
circuit-cairo-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
40-
circuits-stark-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
41-
circuits = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
42-
circuit-serialize = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
43-
circuit-common = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
44-
circuit-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
39+
circuit-cairo-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
40+
circuits-stark-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
41+
circuits = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
42+
circuit-serialize = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
43+
circuit-common = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
44+
circuit-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
4545

4646
# stwo
47-
stwo = { git = "https://github.com/starkware-libs/stwo", rev = "74951f79" }
47+
stwo = { git = "https://github.com/starkware-libs/stwo", rev = "5ea05973" }
4848

4949
[dev-dependencies]
5050
ctor.workspace = true
@@ -53,4 +53,4 @@ rstest.workspace = true
5353
tempfile.workspace = true
5454
tracing-subscriber.workspace = true
5555
privacy-prove = { path = "../privacy_prove" }
56-
stwo = { git = "https://github.com/starkware-libs/stwo", rev = "74951f79", features = ["parallel"] }
56+
stwo = { git = "https://github.com/starkware-libs/stwo", rev = "5ea05973", features = ["parallel"] }

crates/privacy_circuit_verify/src/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ pub const MAX_RECURSIVE_PROOF_UNCOMPRESSED_BYTES: usize =
2828
pub const PRIVACY_BOOTLOADER_JSON: &[u8] = include_bytes!(
2929
"../../cairo-program-runner-lib/resources/compiled_programs/bootloaders/privacy_simple_bootloader_compiled.json"
3030
);
31-
pub const CIRCUIT_OUTPUT_ADDRESSES: [usize; 3] = [3, 4, 2];
31+
pub const CIRCUIT_OUTPUT_ADDRESSES: [usize; 9] = [3, 4, 5, 6, 7, 8, 9, 10, 2];
3232
pub const PRIVACY_RECURSION_CIRCUIT_PREPROCESSED_ROOT: [u32; 8] = [
33-
1585703804, 471132416, 662613155, 1301946947, 16253410, 764021581, 1366076743, 1468898550,
33+
800377284, 3072891210, 312668056, 4159802026, 3280170003, 3058368945, 3010382083, 3621697867,
3434
];
3535
pub const CAIRO_LOG_BLOWUP_FACTOR: u32 = 3;
3636
pub const CAIRO_TRACE_LOG_SIZE: u32 = 20;

crates/privacy_circuit_verify/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use circuit_verifier::statement::{
2323
INTERACTION_POW_BITS as CIRCUIT_INTERACTION_POW_BITS, all_circuit_components,
2424
};
2525
use circuit_verifier::verify::{CircuitConfig, CircuitPublicData, verify_circuit};
26-
use circuits::blake::blake_qm31;
2726
use circuits::context::FinalizedContext;
27+
use circuits::ivalue::IValue;
2828
use circuits::ivalue::NoValue;
2929
use circuits_stark_verifier::proof::ProofConfig;
3030
use circuits_stark_verifier::proof_from_stark_proof::pack_into_qm31s;
@@ -124,11 +124,11 @@ pub fn verify_recursive_circuit(proof_output: &PrivacyProofOutput) -> Result<(),
124124
info!("Compute the output values");
125125
let outputs = compute_privacy_bootloader_output(&proof_output.output_preimage);
126126
let output_qm31s = pack_into_qm31s(outputs.into_iter());
127-
let output_hash = blake_qm31(output_qm31s.as_slice(), output_qm31s.len() * 16);
128-
// The circuit outputs the output_hash (2 QM31s) at addresses 3 and 4. The extension element
129-
// u = (0,0,1,0) (the logup anchor at address 2) is appended internally by the verifier, so it
130-
// must not be part of `output_values`.
131-
let output_values = vec![output_hash.0, output_hash.1];
127+
let output_hash = QM31::blake2s(&output_qm31s, output_qm31s.len() * 16);
128+
// The circuit outputs the full unreduced Blake2s digest (8 words) at the reserved output
129+
// wires. The `u` anchor wire is appended internally by the verifier, so it must not be part
130+
// of `output_values`.
131+
let output_values: Vec<QM31> = output_hash.iter().map(|w| *w.get()).collect();
132132

133133
info!("Call the verifier");
134134
verify_circuit(circuit_config, proof, CircuitPublicData { output_values })?;

crates/privacy_circuit_verify/src/tests.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use circuit_cairo_verifier::all_components::all_components;
2-
use circuits::blake::ReducedHashValue;
32
use stwo::core::fields::qm31::QM31;
43
use stwo::core::poly::circle::CanonicCoset;
54
use stwo::core::vcs_lifted::blake2_merkle::Blake2sM31MerkleChannel;
@@ -79,12 +78,12 @@ fn check_privacy_recursion_circuit_preprocessed_root() {
7978
CIRCUIT_PCS_CONFIG.lifting_log_size,
8079
&base_column_pool,
8180
);
82-
let expected_root: ReducedHashValue<QM31> = preprocessed_tree.commitment.root().into();
81+
let root_hash = preprocessed_tree.commitment.root();
82+
let raw_words: [u32; 8] = std::array::from_fn(|i| {
83+
u32::from_le_bytes(root_hash.0[i * 4..i * 4 + 4].try_into().unwrap())
84+
});
8385

84-
assert_eq!(
85-
expected_root,
86-
PRIVACY_RECURSION_CIRCUIT_PREPROCESSED_ROOT.into()
87-
);
86+
assert_eq!(raw_words, PRIVACY_RECURSION_CIRCUIT_PREPROCESSED_ROOT,);
8887
}
8988

9089
#[test]

crates/privacy_prove/Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,23 @@ cairo-vm = { workspace = true, features = [
3636
] }
3737

3838
# stwo cairo
39-
cairo-air = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
40-
stwo-cairo-adapter = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
41-
stwo-cairo-prover = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
42-
stwo-cairo-serialize = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
43-
stwo-cairo-common = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "a837f0eaa40db776f39f2677885d7059ced867ba" }
39+
cairo-air = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
40+
stwo-cairo-adapter = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
41+
stwo-cairo-prover = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
42+
stwo-cairo-serialize = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
43+
stwo-cairo-common = { git = "https://github.com/starkware-libs/stwo-cairo", rev = "68b4af6d" }
4444

4545
# stwo circuits
46-
circuit-cairo-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
47-
circuits-stark-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
48-
circuits = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
49-
circuit-serialize = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
50-
circuit-prover = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
51-
circuit-common = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
52-
circuit-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "041ec6101ba782aa00e325433929cda6ef15c1b9" }
46+
circuit-cairo-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
47+
circuits-stark-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
48+
circuits = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
49+
circuit-serialize = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
50+
circuit-prover = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
51+
circuit-common = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
52+
circuit-verifier = { git = "https://github.com/starkware-libs/stwo-circuits", rev = "0451681a86cc4755b848d342f6edbf3a240f2627" }
5353

5454
# stwo
55-
stwo = { git = "https://github.com/starkware-libs/stwo", rev = "74951f79", features = ["parallel"] }
55+
stwo = { git = "https://github.com/starkware-libs/stwo", rev = "5ea05973", features = ["parallel"] }
5656

5757
[dev-dependencies]
5858
ctor.workspace = true

0 commit comments

Comments
 (0)