Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] fix deref after using CopyGetters #197

Merged
merged 2 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions halo2-base/src/poseidon/hasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ impl<F: ScalarField, const T: usize, const RATE: usize> PoseidonHasherConsts<F,
/// 1 logical row of compact input for Poseidon hasher.
#[derive(Copy, Clone, Debug, Getters, CopyGetters)]
pub struct PoseidonCompactInput<F: ScalarField, const RATE: usize> {
// Right padded inputs. No constrains on paddings.
/// Right padded inputs. No constrains on paddings.
#[getset(get = "pub")]
inputs: [AssignedValue<F>; RATE],
// is_final = 1 triggers squeeze.
/// is_final = 1 triggers squeeze.
#[getset(get_copy = "pub")]
is_final: SafeBool<F>,
// Length of `inputs`.
/// Length of `inputs`.
#[getset(get_copy = "pub")]
len: AssignedValue<F>,
}
Expand Down Expand Up @@ -94,10 +94,10 @@ impl<F: ScalarField, const RATE: usize> PoseidonCompactInput<F, RATE> {
/// A compact chunk input for Poseidon hasher. The end of a logical input could only be at the boundary of a chunk.
#[derive(Clone, Debug, Getters, CopyGetters)]
pub struct PoseidonCompactChunkInput<F: ScalarField, const RATE: usize> {
// Inputs of a chunk. All witnesses will be absorbed.
/// Inputs of a chunk. All witnesses will be absorbed.
#[getset(get = "pub")]
inputs: Vec<[AssignedValue<F>; RATE]>,
// is_final = 1 triggers squeeze.
/// is_final = 1 triggers squeeze.
#[getset(get_copy = "pub")]
is_final: SafeBool<F>,
}
Expand Down
2 changes: 1 addition & 1 deletion halo2-base/src/poseidon/hasher/tests/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fn hasher_compact_chunk_inputs_compatiblity_verification<
for (compact_output, chunk_input) in compact_outputs.iter().zip(chunk_inputs) {
// into() doesn't work if ! is in the beginning in the bool expression...
let is_final_input = chunk_input.is_final.as_ref().value();
let is_final_output = compact_output.is_final().as_ref().value();
let is_final_output = compact_output.is_final.as_ref().value();
assert_eq!(is_final_input, is_final_output);
if is_final_output == &Fr::ONE {
assert_eq!(native_results[output_offset], *compact_output.hash().value());
Expand Down
2 changes: 1 addition & 1 deletion hashes/zkevm/src/keccak/component/circuit/shard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl<F: Field> KeccakComponentShardCircuit<F> {
lookup_key_per_keccak_f.iter().zip_eq(loaded_keccak_fs)
{
let is_final = AssignedValue::from(loaded_keccak_f.is_final);
let key = gate.select(ctx, *compact_output.hash(), dummy_key_witness, is_final);
let key = gate.select(ctx, compact_output.hash(), dummy_key_witness, is_final);
let hash_lo =
gate.select(ctx, loaded_keccak_f.hash_lo, dummy_keccak_lo_witness, is_final);
let hash_hi =
Expand Down
2 changes: 1 addition & 1 deletion hashes/zkevm/src/keccak/component/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub fn encode_var_len_bytes_vec<F: Field>(
initialized_hasher.hash_compact_chunk_inputs(ctx, range_chip.gate(), &chunk_inputs);
range_chip.gate().select_by_indicator(
ctx,
compact_outputs.into_iter().map(|o| *o.hash()),
compact_outputs.into_iter().map(|o| o.hash()),
f_indicator,
)
}
Expand Down
Loading