diff --git a/Cargo.toml b/Cargo.toml index 8e9a4bdf..cbd6be8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,9 @@ num-bigint = { version = "0.4", features = ["rand"] } uuid = { version = "1.4.0", features = ["v1", "rng"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -hyperplonk_benchmark = { git = "https://github.com/qwang98/plonkish.git", branch = "main", package = "benchmark" } -plonkish_backend = { git = "https://github.com/qwang98/plonkish.git", branch = "main", package = "plonkish_backend" } +hyperplonk_benchmark = { git = "https://github.com/10to4/plonkish.git", branch = "main", package = "benchmark" } +plonkish_backend = { git = "https://github.com/10to4/plonkish.git", branch = "main", package = "plonkish_backend" } +# plonkish_backend = { path = "../../zkevm-circuit/plonkish/plonkish_backend" } regex = "1" ark-ff = "^0.4.0" diff --git a/examples/blake2f.rs b/examples/blake2f.rs index 1ce2db7f..8607684a 100644 --- a/examples/blake2f.rs +++ b/examples/blake2f.rs @@ -871,15 +871,15 @@ fn blake2f_circuit( let mut output_vec = v_mid1_vec.clone(); if i >= 8 { if i % 2 == 0 { - input_vec = v_mid2_vec.clone(); - output_vec = v_mid3_vec.clone(); + input_vec.clone_from(&v_mid2_vec); + output_vec.clone_from(&v_mid3_vec) } else { - input_vec = v_mid3_vec.clone(); - output_vec = v_mid4_vec.clone(); + input_vec.clone_from(&v_mid3_vec); + output_vec.clone_from(&v_mid4_vec) } } else if i % 2 == 1 { - input_vec = v_mid1_vec.clone(); - output_vec = v_mid2_vec.clone(); + input_vec.clone_from(&v_mid1_vec); + output_vec.clone_from(&v_mid2_vec); } let (mut a, mut b, mut c, mut d) = (i / 2, 4 + i / 2, 8 + i / 2, 12 + i / 2); @@ -1319,7 +1319,7 @@ fn blake2f_circuit( b_3bits_vec, }; ctx.add(&blake2f_g_setup_vec[r as usize], ginputs); - v_vec_values = v_mid4_vec_values.clone(); + v_vec_values.clone_from(&v_mid4_vec_values); } let output_vec_values: Vec = h_vec_values diff --git a/examples/keccak.rs b/examples/keccak.rs index bc06c93b..ca750374 100644 --- a/examples/keccak.rs +++ b/examples/keccak.rs @@ -1635,9 +1635,15 @@ fn keccak_circuit + Eq + Hash>( let mut tmp_pi_sum_split_xor_vec = setup_theta_sum_split_xor_vec.clone(); for i in 0..PART_SIZE as usize { for j in 0..PART_SIZE as usize { + // tmp_pi_sum_split_xor_vec + // [j * PART_SIZE as usize + ((2 * i + 3 * j) % PART_SIZE as usize)] + // = setup_theta_sum_split_xor_vec[i * + // PART_SIZE as usize + j].clone(); tmp_pi_sum_split_xor_vec - [j * PART_SIZE as usize + ((2 * i + 3 * j) % PART_SIZE as usize)] = - setup_theta_sum_split_xor_vec[i * PART_SIZE as usize + j].clone(); + [j * PART_SIZE as usize + ((2 * i + 3 * j) % PART_SIZE as usize)] + .clone_from( + &setup_theta_sum_split_xor_vec[i * PART_SIZE as usize + j], + ); } } diff --git a/rust-toolchain b/rust-toolchain index 79e15fd4..54227249 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.77.0 +1.78.0 diff --git a/src/ccs/ir/circuit.rs b/src/ccs/ir/circuit.rs index 90ae18ec..93bfed6e 100644 --- a/src/ccs/ir/circuit.rs +++ b/src/ccs/ir/circuit.rs @@ -77,8 +77,8 @@ impl + Hash> Z { assert_eq!(inputs.len(), self.l); assert_eq!(witnesses.len(), self.n - self.l - 1); - self.public_inputs = inputs.to_owned().clone(); - self.assignments = witnesses.to_owned().clone(); + self.public_inputs.clone_from(&inputs.to_owned()); + self.assignments.clone_from(&witnesses.to_owned()); } } @@ -114,7 +114,8 @@ impl Matrix { pub fn reduce_rows(&mut self, m: usize) { if m < self.m { - self.values = self.values[0..m].to_owned(); + // self.values = self.values[0..m].to_owned(); + self.values.truncate(m); self.m = m; } } @@ -195,7 +196,7 @@ impl + Hash> CCSCircuit { pub fn write_constants(&mut self, constants: &[F]) { assert_eq!(constants.len(), self.q); - self.constants = constants.to_owned().clone(); + self.constants.clone_from(&constants.to_owned()); } pub fn write_selectors_and_degree(&mut self, selectors: &[Vec<(usize, F)>]) { @@ -207,7 +208,7 @@ impl + Hash> CCSCircuit { } degree = degree.max(selector.len()) } - self.selectors = selectors.to_owned().clone(); + self.selectors.clone_from(&selectors.to_owned()); self.d = degree; } @@ -303,9 +304,9 @@ impl + Hash> Circuit { self.calcu_bounds(&selectors.matrix_selectors); self.ccs.constants = vec![F::ONE; self.ccs.q]; - self.ccs.selectors = selectors.matrix_selectors.clone(); - self.exposed = exposed.to_owned(); - self.witness = witness.clone(); + self.ccs.selectors.clone_from(&selectors.matrix_selectors); + exposed.clone_into(&mut self.exposed); + self.witness.clone_from(witness); self.construct_matrix_coeffs_and_offsets(matrix_coeffs, &selectors.step_selectors); } diff --git a/src/plonkish/backend/halo2.rs b/src/plonkish/backend/halo2.rs index d8dfd6d2..410bfe4f 100644 --- a/src/plonkish/backend/halo2.rs +++ b/src/plonkish/backend/halo2.rs @@ -473,8 +473,8 @@ impl + Hash> h2Circuit for ChiquitoHalo2SuperCircuit }); sub_circuits.iter_mut().for_each(|sub_circuit| { - sub_circuit.advice_columns = advice_columns.clone(); - sub_circuit.fixed_columns = fixed_columns.clone(); + sub_circuit.advice_columns.clone_from(&advice_columns); + sub_circuit.fixed_columns.clone_from(&fixed_columns); sub_circuit.configure_sub_circuit(meta) }); diff --git a/src/wit_gen.rs b/src/wit_gen.rs index 81b542f1..c2bd9958 100644 --- a/src/wit_gen.rs +++ b/src/wit_gen.rs @@ -189,22 +189,22 @@ pub(crate) fn calc_auto_signals 0 { - pending = pending - .clone() - .into_iter() - .filter(|s| { - if let Some(value) = auto_signals - .get(s) - .expect("auto definition not found") - .eval(assignments) - { - assignments.insert(s.clone(), value); - } - - assignments.get(s).is_none() - }) - .collect::>() - .clone(); + pending.clone_from( + &pending + .clone() + .into_iter() + .filter(|s| { + if let Some(value) = auto_signals + .get(s) + .expect("auto definition not found") + .eval(assignments) + { + assignments.insert(s.clone(), value); + } + assignments.get(s).is_none() + }) + .collect::>(), + ); // in each round at least one new signal should be assigned if pending.len() == pending_amount {