Skip to content

Commit a96d021

Browse files
mathsjamescopybara-github
authored andcommitted
Allow early rejection during multiplication by challenge matrices. This will (on average) roughly halve the run time spent on multiplication by challenge matrices, reducing the run time of create_client_message by about 8%.
PiperOrigin-RevId: 846194679
1 parent 6fa5c35 commit a96d021

File tree

2 files changed

+165
-123
lines changed

2 files changed

+165
-123
lines changed

willow/src/zk/linear_ip.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub struct LinearInnerProductParameters {
3636
F: RistrettoPoint,
3737
F_: RistrettoPoint,
3838
G: Vec<RistrettoPoint>,
39+
seed: Vec<u8>,
3940
}
4041

4142
pub fn inner_product(a: &[Scalar], b: &[Scalar]) -> Scalar {
@@ -59,6 +60,7 @@ fn common_setup(length: usize, parameter_seed: &[u8]) -> LinearInnerProductParam
5960
)
6061
})
6162
.collect(),
63+
seed: parameter_seed.to_vec(),
6264
}
6365
}
6466

@@ -67,11 +69,9 @@ fn append_params_to_transcript(
6769
params: &LinearInnerProductParameters,
6870
) {
6971
transcript.append_u64(b"n", params.n as u64);
70-
for G_i in &params.G {
71-
transcript.append_message(b"G_i", G_i.compress().as_bytes());
72-
}
73-
transcript.append_message(b"F", params.F.compress().as_bytes());
74-
transcript.append_message(b"F_", params.F_.compress().as_bytes());
72+
// We append the seed not the resulting params themselves because appending that many params
73+
// more than doubles the run time of both prove and verify.
74+
transcript.append_message(b"seed", &params.seed);
7575
}
7676

7777
fn validate_and_append_point(

0 commit comments

Comments
 (0)