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

Expose Databus objects to the backend #4974

Closed
guipublic opened this issue May 3, 2024 · 1 comment
Closed

Expose Databus objects to the backend #4974

guipublic opened this issue May 3, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@guipublic
Copy link
Contributor

Problem

Aztec kernel circuits require a lot of input/output data, and in order to avoir to increase the size of the circuit too much because of many public inputs, we want to leverage the ‘databus’ concept.
The idea is to commit to the data and have the proving system to check that commitments match (intput to circuit i is output of cicruit i-1, etc..)
In Barretenberg, the databus will be similar to a ROM table, with methods to set the values and read them at the provided index.

Here is an example where calldata (inputs) is [4,5,6,7,8], and return_data (output) is [4,5,6,13], i.e. the output is identical to the input but with the last two entries summed together.
This can be proven with the following relation:

// First three entries are simply 'copied' from input to output
databus.calldata[idx_0].assert_equal(databus.return_data[idx_0]);
databus.calldata[idx_1].assert_equal(databus.return_data[idx_1]);
databus.calldata[idx_2].assert_equal(databus.return_data[idx_2]);

// Final output is the sum of the last two inputs
field_ct sum = databus.calldata[idx_3] + databus.calldata[idx_4];
sum.assert_equal(databus.calldata[idx_final]);

Happy Case

In Noir, we already handle call_data and return_data attributes in the main function and we aggregate such parameters into one array (one for call_data and one for return_data).

What we need to do to integrate with Barrentenberg:

  • create new opcodes to access and initialise the databus call_data / return_data.
  • replace array init with databus initialisation
  • replace ‘array get of the call_data array’ with a ‘databus opcode’
  • make return_data private input
  • Assert the return data is equal to databus return_data

Project Impact

None

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@guipublic guipublic added the enhancement New feature or request label May 3, 2024
guipublic added a commit to AztecProtocol/aztec-packages that referenced this issue May 8, 2024
This PR adds a field to the MemoryInit opcode to specify the memory
blocks used for the databus.

It is related to issue noir-lang/noir#4974

This is a breaking change because it modifies ACIR format.

---------

Co-authored-by: Tom French <tom@tomfren.ch>
AztecBot pushed a commit to AztecProtocol/barretenberg that referenced this issue May 9, 2024
This PR adds a field to the MemoryInit opcode to specify the memory
blocks used for the databus.

It is related to issue noir-lang/noir#4974

This is a breaking change because it modifies ACIR format.

---------

Co-authored-by: Tom French <tom@tomfren.ch>
@TomAFrench
Copy link
Member

For reference: https://hackmd.io/pTE38VziRP-rMBDrOnbweQ?both

github-merge-queue bot pushed a commit that referenced this issue May 14, 2024
# Description

## Problem\*

Related to  #4974

## Summary\*
Very small PR which avoids returning databus objects, because they need
to be handled as private inputs.
This is incremental work, so it cannot be tested yet. The PR only impact
databus use case.



## 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\*

- [ ] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
guipublic added a commit to AztecProtocol/aztec-packages that referenced this issue May 22, 2024
Related to noir-lang/noir#4974

The PR implements logic in BB to handle ACIR opcodes for the databus.
Because the databus in BB works only with Goblin which is not yet
supported by Noir, the code is not fully tested, so this is only
prototype code.
Using the databus with UltraPlonk will result in a failing ASSERT.
I have updated the BB unit test to work with GoblinPlonk, so the BB code
is tested.

---------

Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: ledwards2225 <l.edwards.d@gmail.com>
github-merge-queue bot pushed a commit that referenced this issue May 22, 2024
# Description

## Problem\*

Related to #4974

## Summary\*
This PR mark return data array with return_data block type, and disable
the unused arrays optimisation for databus.
This is required because the return_data is not returned from main
although similar constraints will be generated on the backend side.


## Additional Context
This should be the last piece for this databus iteration from issue
#4974, and it will allow to generate an end-to-end test with the databus
to check if we get what is expected.


## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [X] **[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.
AztecBot pushed a commit to AztecProtocol/barretenberg that referenced this issue May 23, 2024
Related to noir-lang/noir#4974

The PR implements logic in BB to handle ACIR opcodes for the databus.
Because the databus in BB works only with Goblin which is not yet
supported by Noir, the code is not fully tested, so this is only
prototype code.
Using the databus with UltraPlonk will result in a failing ASSERT.
I have updated the BB unit test to work with GoblinPlonk, so the BB code
is tested.

---------

Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: ledwards2225 <l.edwards.d@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants