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

bug: Add support to pass notes as argument #4131

Closed
LHerskind opened this issue Jan 18, 2024 · 5 comments
Closed

bug: Add support to pass notes as argument #4131

LHerskind opened this issue Jan 18, 2024 · 5 comments
Assignees
Labels
A-internal-devex Area: Relates to the devex of internal teams building Aztec. C-aztec.js Component: aztec.js client library C-aztec.nr Component: Aztec smart contract framework T-bug Type: Bug. Something is broken.

Comments

@LHerskind
Copy link
Contributor

Currently it seems unsupported to pass a note into a contract as an argument. This can be useful for certain cases, and should be supported.

@github-project-automation github-project-automation bot moved this to Todo in A3 Jan 18, 2024
@LHerskind LHerskind added this to the Execution Environment milestone Jan 24, 2024
@sklppy88 sklppy88 moved this from Todo to In Progress in A3 Jan 26, 2024
@sklppy88 sklppy88 added T-bug Type: Bug. Something is broken. C-aztec.nr Component: Aztec smart contract framework C-aztec.js Component: aztec.js client library A-internal-devex Area: Relates to the devex of internal teams building Aztec. labels Jan 26, 2024
@sklppy88
Copy link
Contributor

sklppy88 commented Jan 31, 2024

Update:

This was tested, and the crux of the issue is that

assert(args_hash == item.public_inputs.args_hash);

in yarn-project/aztec-nr/aztec/src/context.nr would fail.

This was isolated down into an issue when a note is passed through as an argument. When args are serialized in typescript, they are serialized with the header, (as a whole arg) but when the actual note is serialized via the macro, the serialize function on the note is used, and this function only includes the content of the note and not the header. The hashes do not match because the preimage does not match and therefore the context catches this mismatch, throwing an error.

@sklppy88 sklppy88 moved this from In Progress to Todo in A3 Jan 31, 2024
@LHerskind
Copy link
Contributor Author

One way to solve the issue would be to replace the current serialize functions of the notes with serialize_content functions, and then have a serialize that serializes the entire note (with header) which is used for the argument serialization.

@rahul-kothari
Copy link
Contributor

FYI - this should also handle the case of passing note even in public domain.

Here we have an interesting issue -> only unencrypted notes should be allowed to pass though right?

@LHerskind
Copy link
Contributor Author

With #4383 it is possible to define a serialize for the note such that it can be passed in directly. It is a little strange to do, since the header will be populated as the note is inserted, but it can be useful for inclusion proofs etc.

@github-project-automation github-project-automation bot moved this from Todo to Done in A3 Feb 5, 2024
@rahul-kothari
Copy link
Contributor

Do we need an e2e here that checks that notes are passable in the pub/private domain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-internal-devex Area: Relates to the devex of internal teams building Aztec. C-aztec.js Component: aztec.js client library C-aztec.nr Component: Aztec smart contract framework T-bug Type: Bug. Something is broken.
Projects
Archived in project
Development

No branches or pull requests

3 participants