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

Renamed fill_variable_array to fill_pb_variable_array for consistency #396

Merged
merged 1 commit into from
Aug 24, 2021
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
2 changes: 1 addition & 1 deletion libzeth/circuits/binary_operation.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void double_bit32_sum_eq_gadget<FieldT>::generate_r1cs_witness()
bits32 a_bits32 = bits32::from_vector(a.get_bits(this->pb));
bits32 b_bits32 = bits32::from_vector(b.get_bits(this->pb));
bits32 left_side_acc = bits_add<32>(a_bits32, b_bits32, false);
left_side_acc.fill_variable_array(this->pb, res);
left_side_acc.fill_pb_variable_array(this->pb, res);
}

} // namespace libzeth
Expand Down
10 changes: 5 additions & 5 deletions libzeth/circuits/blake2s/blake2s_comp_setup.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -159,28 +159,28 @@ void BLAKE2s_256_comp<FieldT>::setup_v(bool is_last_block)

// [v_8, v_9, v_10, v_11] = [IV_0, IV_1, IV_2, IV_3]
for (size_t i = 8; i < 12; i++) {
BLAKE2s_IV[i - 8].fill_variable_array(this->pb, v[0][i]);
BLAKE2s_IV[i - 8].fill_pb_variable_array(this->pb, v[0][i]);
}

// v_12 = t0 XOR IV_4
bits32 temp_xored = bits_xor(BLAKE2s_IV[4], t[0]);
temp_xored.fill_variable_array(this->pb, v[0][12]);
temp_xored.fill_pb_variable_array(this->pb, v[0][12]);

// v_13 = t1 XOR IV_5
temp_xored = bits_xor(BLAKE2s_IV[5], t[1]);
temp_xored.fill_variable_array(this->pb, v[0][13]);
temp_xored.fill_pb_variable_array(this->pb, v[0][13]);

// v_14 = f0 XOR IV_6
if (is_last_block) {
temp_xored = bits_xor(BLAKE2s_IV[6], flag_to_1);
} else {
temp_xored = BLAKE2s_IV[6];
}
temp_xored.fill_variable_array(this->pb, v[0][14]);
temp_xored.fill_pb_variable_array(this->pb, v[0][14]);

// v_15 = f1 XOR IV_7
temp_xored = BLAKE2s_IV[7];
temp_xored.fill_variable_array(this->pb, v[0][15]);
temp_xored.fill_pb_variable_array(this->pb, v[0][15]);
}

template<typename FieldT> void BLAKE2s_256_comp<FieldT>::setup_mixing_gadgets()
Expand Down
6 changes: 3 additions & 3 deletions libzeth/circuits/joinsplit.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,10 @@ public:
// Witness public values
//
// Witness LHS public value
vpub_in.fill_variable_array(this->pb, zk_vpub_in);
vpub_in.fill_pb_variable_array(this->pb, zk_vpub_in);

// Witness RHS public value
vpub_out.fill_variable_array(this->pb, zk_vpub_out);
vpub_out.fill_pb_variable_array(this->pb, zk_vpub_out);

// Witness h_sig
h_sig->generate_r1cs_witness(h_sig_in.to_vector());
Expand All @@ -495,7 +495,7 @@ public:
left_side_acc, inputs[i].note.value, true);
}

left_side_acc.fill_variable_array(this->pb, zk_total_uint64);
left_side_acc.fill_pb_variable_array(this->pb, zk_total_uint64);
}

// Witness the JoinSplit inputs and the h_is
Expand Down
10 changes: 5 additions & 5 deletions libzeth/circuits/notes/note.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ template<typename FieldT> void note_gadget<FieldT>::generate_r1cs_constraints()
template<typename FieldT>
void note_gadget<FieldT>::generate_r1cs_witness(const zeth_note &note)
{
note.r.fill_variable_array(this->pb, r);
note.value.fill_variable_array(this->pb, value);
note.r.fill_pb_variable_array(this->pb, r);
note.value.fill_pb_variable_array(this->pb, value);
}

// Gadget that makes sure that all conditions are met in order to spend a note:
Expand Down Expand Up @@ -175,7 +175,7 @@ void input_note_gadget<FieldT, HashT, HashTreeT, TreeDepth>::
spend_authority->generate_r1cs_witness();

// Witness rho for the input note
note.rho.fill_variable_array(this->pb, rho);
note.rho.fill_pb_variable_array(this->pb, rho);
// Witness the nullifier for the input note
expose_nullifiers->generate_r1cs_witness();

Expand Down Expand Up @@ -258,7 +258,7 @@ void input_note_gadget<FieldT, HashT, HashTreeT, TreeDepth>::
<< (this->pb.val(value_enforce)).as_ulong() << std::endl;

// Witness merkle tree authentication path
address_bits.fill_variable_array(this->pb, address_bits_va);
address_bits.fill_pb_variable_array(this->pb, address_bits_va);

// Set auth_path values
auth_path->fill_with_field_elements(this->pb, merkle_path);
Expand Down Expand Up @@ -301,7 +301,7 @@ void output_note_gadget<FieldT, HashT>::generate_r1cs_witness(
note_gadget<FieldT>::generate_r1cs_witness(note);

// Witness a_pk with note information
note.a_pk.fill_variable_array(this->pb, a_pk->bits);
note.a_pk.fill_pb_variable_array(this->pb, a_pk->bits);

commit_to_outputs_cm->generate_r1cs_witness();
}
Expand Down
2 changes: 1 addition & 1 deletion libzeth/core/bits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ template<size_t numBits> class bits : public std::array<bool, numBits>
/// Fill a libsnark::pb_variable_array with bits from this container,
/// representing each as 1 or 0 in FieldT.
template<typename FieldT>
void fill_variable_array(
void fill_pb_variable_array(
libsnark::protoboard<FieldT> &pb,
libsnark::pb_variable_array<FieldT> &var_array) const;

Expand Down
2 changes: 1 addition & 1 deletion libzeth/core/bits.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ template<size_t numBits> bool bits<numBits>::is_zero() const

template<size_t numBits>
template<typename FieldT>
void bits<numBits>::fill_variable_array(
void bits<numBits>::fill_pb_variable_array(
libsnark::protoboard<FieldT> &pb,
libsnark::pb_variable_array<FieldT> &var_array) const
{
Expand Down