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

Add return value accessor to assigner #217

Closed
aleasims opened this issue Mar 27, 2024 · 4 comments · Fixed by #219
Closed

Add return value accessor to assigner #217

aleasims opened this issue Mar 27, 2024 · 4 comments · Fixed by #219
Assignees

Comments

@aleasims
Copy link
Contributor

After successful evaluation assigner has a return value of circuit function, which now can be printed to stdout (see print_format). However we cannot access this value from API now. It will be nice for users and really helpful for testing assigner.

I suggest we add public method get_return_value:

std::vector<typename BlueprintFieldType::integral_type> get_return_value();
  • If the return value is primitive (integer, field), this returns vector of a single element - the value itself;
  • Using BlueprintFieldType::integral_type here allows to return single value for non-native fields (at least as I understood it);
  • If the return value is LLVM vector of curve, this returns vector of values of corresponding size;
  • Other cases (pointers, structs and etc.) are not defined yet.

If the function is called not after successful evaluation, result must be undefined (probably empty).

@aleasims aleasims self-assigned this Mar 27, 2024
@aleasims
Copy link
Contributor Author

@akokoshn @CblPOK-git
Is std::vector<typename BlueprintFieldType::integral_type> fine as a return value type?

@CblPOK-git
Copy link
Contributor

We create all issues related to submodules in the zkllvm repository if I'm right

@CblPOK-git
Copy link
Contributor

CblPOK-git commented Mar 27, 2024

BlueprintFieldType::integral_type

It is basically uint256, works fine with pallas, but bls12381 has bit length of 381, need to use extended_integral_type which is something like uint4096.

@aleasims
Copy link
Contributor Author

For now only a partial implementation, which does not handle complicated cases with aggregated return types (just like it is done in printing output).

The rest of implementation will be covered in

@aleasims aleasims linked a pull request Mar 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants