Skip to content

Commit

Permalink
chore: use uint32_t instead of size_t for databus data (#8479)
Browse files Browse the repository at this point in the history
Change type from `size_t` to `uint32_t` for `databus_propagation_data`
to avoid potential issues serializing `size_t`.
  • Loading branch information
ledwards2225 authored Sep 11, 2024
1 parent 274a6b7 commit 79995c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ std::vector<bb::fr> convert_grumpkin_fr_to_bn254_frs(const grumpkin::fr& val);
*/
template <typename T> std::vector<bb::fr> convert_to_bn254_frs(const T& val)
{
if constexpr (IsAnyOf<T, bool, uint32_t, uint64_t, size_t, bb::fr>) {
if constexpr (IsAnyOf<T, bool, uint32_t, uint64_t, bb::fr>) {
std::vector<bb::fr> fr_vec{ val };
return fr_vec;
} else if constexpr (IsAnyOf<T, grumpkin::fr>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ template <class Builder> class DataBusDepot {
auto context = commitment.get_context();

// Set flag indicating propagation of return data; save the index at which it will be stored in public inputs
size_t start_idx = context->public_inputs.size();
auto start_idx = static_cast<uint32_t>(context->public_inputs.size());
if (is_kernel) {
context->databus_propagation_data.contains_kernel_return_data_commitment = true;
context->databus_propagation_data.kernel_return_data_public_input_idx = start_idx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ struct DatabusPropagationData {
// The start index of the return data commitments (if present) in the public inputs. Note: a start index is all
// that's needed here since the commitents are represented by a fixed number of witnesses and are contiguous in the
// public inputs by construction.
size_t app_return_data_public_input_idx = 0;
size_t kernel_return_data_public_input_idx = 0;
uint32_t app_return_data_public_input_idx = 0;
uint32_t kernel_return_data_public_input_idx = 0;

// Is this a kernel circuit (used to determine when databus consistency checks can be appended to a circuit in IVC)
bool is_kernel = false;
Expand Down

0 comments on commit 79995c8

Please sign in to comment.