Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
ccs: update toolchain-> 1.7.8 & modify for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
10to4 committed Aug 27, 2024
1 parent 5de4502 commit 454d634
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 38 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions examples/blake2f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,15 +871,15 @@ fn blake2f_circuit<F: PrimeField + Hash>(
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);
Expand Down Expand Up @@ -1319,7 +1319,7 @@ fn blake2f_circuit<F: PrimeField + Hash>(
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<u64> = h_vec_values
Expand Down
10 changes: 8 additions & 2 deletions examples/keccak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1635,9 +1635,15 @@ fn keccak_circuit<F: PrimeField<Repr = [u8; 32]> + 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],
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.77.0
1.78.0
17 changes: 9 additions & 8 deletions src/ccs/ir/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl<F: Field + From<u64> + Hash> Z<F> {
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());
}
}

Expand Down Expand Up @@ -114,7 +114,8 @@ impl<F: Field> Matrix<F> {

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;
}
}
Expand Down Expand Up @@ -195,7 +196,7 @@ impl<F: Field + From<u64> + Hash> CCSCircuit<F> {

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)>]) {
Expand All @@ -207,7 +208,7 @@ impl<F: Field + From<u64> + Hash> CCSCircuit<F> {
}
degree = degree.max(selector.len())
}
self.selectors = selectors.to_owned().clone();
self.selectors.clone_from(&selectors.to_owned());
self.d = degree;
}

Expand Down Expand Up @@ -303,9 +304,9 @@ impl<F: Field + From<u64> + Hash> Circuit<F> {
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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/plonkish/backend/halo2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ impl<F: Field + From<u64> + Hash> h2Circuit<F> for ChiquitoHalo2SuperCircuit<F>
});

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)
});

Expand Down
32 changes: 16 additions & 16 deletions src/wit_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,22 @@ pub(crate) fn calc_auto_signals<F: Field + Hash, V: Clone + Eq + PartialEq + Has
let mut pending_amount = pending.len();

while pending_amount > 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::<Vec<V>>()
.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::<Vec<V>>(),
);

// in each round at least one new signal should be assigned
if pending.len() == pending_amount {
Expand Down

0 comments on commit 454d634

Please sign in to comment.