Skip to content

Commit a3afeb4

Browse files
committed
Merge branch 'better_xmss'
2 parents 1249265 + 931783f commit a3afeb4

File tree

28 files changed

+818
-464
lines changed

28 files changed

+818
-464
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,14 @@ sha3 = "0.10.8"
6363
derive_more = { version = "2.0.1", features = ["full"] }
6464
pest = "2.7"
6565
pest_derive = "2.7"
66-
itertools = "0.10.5"
66+
itertools = "0.14.0"
6767
colored = "3.0.0"
6868
tracing = "0.1.26"
6969
serde_json = "1.0.145"
7070
num_enum = "0.7.5"
7171
tracing-subscriber = { version = "0.3.19", features = ["std", "env-filter"] }
7272
tracing-forest = { version = "0.3.0", features = ["ansi", "smallvec"] }
7373
p3-koala-bear = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
74-
p3-baby-bear = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
7574
p3-poseidon2 = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
7675
p3-symmetric = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
7776
p3-air = { git = "https://github.com/TomWambsgans/Plonky3.git", branch = "lean-multisig" }
@@ -86,7 +85,11 @@ multilinear-toolkit = { git = "https://github.com/leanEthereum/multilinear-toolk
8685
[dependencies]
8786
clap.workspace = true
8887
rec_aggregation.workspace = true
88+
xmss.workspace = true
8989
poseidon_circuit.workspace = true
90+
p3-koala-bear.workspace = true
91+
multilinear-toolkit.workspace = true
92+
whir-p3.workspace = true
9093

9194
# [patch."https://github.com/TomWambsgans/Plonky3.git"]
9295
# p3-koala-bear = { path = "../zk/Plonky3/koala-bear" }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ RUSTFLAGS='-C target-cpu=native' cargo run --release -- recursion
4646
### XMSS aggregation
4747

4848
```console
49-
RUSTFLAGS='-C target-cpu=native' cargo run --release -- xmss --n-signatures 990
49+
RUSTFLAGS='-C target-cpu=native' cargo run --release -- xmss --n-signatures 1000
5050
```
5151

5252
[Trivial encoding](docs/XMSS_trivial_encoding.pdf) (for now).

crates/air/tests/complex_air.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn test_air_helper<const VIRTUAL_COLUMN: bool>() {
108108
const N_PREPROCESSED_COLUMNS: usize = 5;
109109
let log_n_rows = 12;
110110
let n_rows = 1 << log_n_rows;
111-
let mut prover_state = build_prover_state::<EF>();
111+
let mut prover_state = build_prover_state::<EF>(false);
112112

113113
let (columns_plus_one_f, columns_plus_one_ef) = generate_trace::<N_COLUMNS, N_PREPROCESSED_COLUMNS>(n_rows + 1);
114114
let columns_ref_f = columns_plus_one_f.iter().map(|col| &col[..n_rows]).collect::<Vec<_>>();

crates/air/tests/fib_air.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn generate_trace(n_rows: usize) -> (Vec<F>, Vec<EF>) {
6060
fn test_air_fibonacci() {
6161
let log_n_rows = 14;
6262
let n_rows = 1 << log_n_rows;
63-
let mut prover_state = build_prover_state::<EF>();
63+
let mut prover_state = build_prover_state::<EF>(false);
6464

6565
let (columns_plus_one_f, columns_plus_one_ef) = generate_trace(n_rows + 1);
6666
let columns_ref_f = vec![&columns_plus_one_f[..n_rows]];

crates/lean_compiler/src/a_simplify_lang.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,11 @@ fn handle_const_arguments_helper(
16321632
// TODO we should unroll before const arguments handling
16331633
handle_const_arguments_helper(body, constant_functions, new_functions);
16341634
}
1635+
Line::Match { arms, .. } => {
1636+
for (_, arm) in arms {
1637+
handle_const_arguments_helper(arm, constant_functions, new_functions);
1638+
}
1639+
}
16351640
_ => {}
16361641
}
16371642
}

crates/lean_prover/src/prove_execution.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn prove_execution(
2323
no_vec_runtime_memory: usize, // size of the "non-vectorized" runtime memory
2424
vm_profiler: bool,
2525
(poseidons_16_precomputed, poseidons_24_precomputed): (&Poseidon16History, &Poseidon24History),
26-
) -> (Vec<PF<EF>>, usize, String) {
26+
) -> (Vec<PF<EF>>, String) {
2727
let mut exec_summary = String::new();
2828
let ExecutionTrace {
2929
traces,
@@ -82,7 +82,7 @@ pub fn prove_execution(
8282
})
8383
});
8484

85-
let mut prover_state = build_prover_state::<EF>();
85+
let mut prover_state = build_prover_state::<EF>(false);
8686
prover_state.add_base_scalars(
8787
&[
8888
vec![private_memory.len()],
@@ -380,11 +380,7 @@ pub fn prove_execution(
380380
&packed_pcs_witness_extension.packed_polynomial.by_ref(),
381381
);
382382

383-
(
384-
prover_state.proof_data().to_vec(),
385-
prover_state.proof_size(),
386-
exec_summary,
387-
)
383+
(prover_state.proof_data().to_vec(), exec_summary)
388384
}
389385

390386
fn prove_bus_and_air(

crates/lean_prover/src/verify_execution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn verify_execution(
2424
proof_data: Vec<PF<EF>>,
2525
whir_config_builder: WhirConfigBuilder,
2626
) -> Result<(), ProofError> {
27-
let mut verifier_state = VerifierState::new(proof_data, build_challenger());
27+
let mut verifier_state = VerifierState::new(proof_data, build_challenger(), false);
2828

2929
let p16_gkr_layers = PoseidonGKRLayers::<16, N_COMMITED_CUBES_P16>::build(Some(VECTOR_LEN));
3030
let p24_gkr_layers = PoseidonGKRLayers::<24, N_COMMITED_CUBES_P24>::build(None);

crates/lean_prover/tests/test_zkvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn test_zk_vm_helper(program_str: &str, (public_input, private_input): (&[F], &[
115115
utils::init_tracing();
116116
let bytecode = compile_program(program_str.to_string());
117117
let time = std::time::Instant::now();
118-
let (proof_data, _, summary) = prove_execution(
118+
let (proof_data, summary) = prove_execution(
119119
&bytecode,
120120
(public_input, private_input),
121121
whir_config_builder(),

crates/lean_vm/src/execution/runner.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -257,22 +257,6 @@ fn execute_bytecode_helper(
257257
poseidons_24_precomputed.len(),
258258
"Warning: not all precomputed Poseidon24 were used"
259259
);
260-
tracing::info!(
261-
"{}% of Poseidon16 precomputed",
262-
if poseidons_16_precomputed.is_empty() {
263-
0.
264-
} else {
265-
(n_poseidon16_precomputed_used as f64 / poseidons_16_precomputed.len() as f64) * 100.0
266-
}
267-
);
268-
tracing::info!(
269-
"{}% of Poseidon24 precomputed",
270-
if poseidons_24_precomputed.is_empty() {
271-
0.
272-
} else {
273-
(n_poseidon24_precomputed_used as f64 / poseidons_24_precomputed.len() as f64) * 100.0
274-
}
275-
);
276260

277261
assert_eq!(pc, ENDING_PC);
278262
pcs.push(pc);
@@ -330,6 +314,18 @@ fn execute_bytecode_helper(
330314
used_memory_cells as f64 / runtime_memory_size as f64 * 100.0
331315
));
332316

317+
// precomputed poseidons
318+
summary.push_str(&format!(
319+
"Poseidon2_16 precomputed used: {}/{}\n",
320+
pretty_integer(n_poseidon16_precomputed_used),
321+
pretty_integer(poseidons_16_precomputed.len())
322+
));
323+
summary.push_str(&format!(
324+
"Poseidon2_24 precomputed used: {}/{}\n",
325+
pretty_integer(n_poseidon24_precomputed_used),
326+
pretty_integer(poseidons_24_precomputed.len())
327+
));
328+
333329
summary.push('\n');
334330

335331
if traces[Table::poseidon16().index()].base[0].len() + traces[Table::poseidon24().index()].base[0].len() > 0 {

0 commit comments

Comments
 (0)