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

NoirJS doesn't report return values when doing witness gen on a function with databus (return_data) #5715

Closed
sirasistant opened this issue Aug 13, 2024 · 2 comments · Fixed by #6074 or #6095
Assignees
Labels
bug Something isn't working

Comments

@sirasistant
Copy link
Contributor

sirasistant commented Aug 13, 2024

Aim

Get the return values along with the witness when calling a function with return_data, to pass them to the next circuit in the IVC chain.

Expected Behavior

As the prover entity, I should be able to get the databus return_data to pass it to the next circuit for recursive verification.

Bug

They are not due to this line https://github.com/noir-lang/noir/blob/master/tooling/noirc_abi/src/lib.rs#L351

To Reproduce

  1. Create a noir circuit with return_data
  2. Call it via noirjs

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

No response

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@sirasistant sirasistant added the bug Something isn't working label Aug 13, 2024
@TomAFrench
Copy link
Member

They are not due to this line https://github.com/noir-lang/noir/blob/master/tooling/noirc_abi/src/lib.rs#L351

This isn't the root cause of this issue. The issue is that the databus return data is held in a memory block rather than the witness map (note that we still reserve witness indices for databus return values, they're just not used).

In order to solve this we'll have to make changes to the ACVM as it assumes that the full state which the user is interested in will be contained in the witness map.

@TomAFrench
Copy link
Member

I've spoken with @guipublic on this and the current thinking is that we can ensure there's a set of witness indices which correspond to the contents of the databus return array (but these witnesses aren't made public). We can include these witnesses in the ABI similarly to standard return values (but distinguished by the return visibility) and so ABI decoding will "just work".

This may result in slightly less good ACIR gen in some cases but it would be basically equivalent to non-databus programs (except without the cost of public inputs).

@guipublic guipublic self-assigned this Sep 17, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 18, 2024
# Description

## Problem\*

Resolves #5715 

## Summary\*
Use ABI's return values for the Databus return_data


## Additional Context



## Documentation\*

Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
github-merge-queue bot pushed a commit that referenced this issue Sep 19, 2024
# Description

## Problem\*

Resolves #5715

## Summary\*

This PR picks up from @guipublic's work on #6074 to enable decoding
databus return values in `noirc_abi`. I've added a test to show this
working

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
3 participants