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

Include Full output notes in ExecutedTransaction #1049

Open
barabanovro opened this issue Jan 6, 2025 · 5 comments
Open

Include Full output notes in ExecutedTransaction #1049

barabanovro opened this issue Jan 6, 2025 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@barabanovro
Copy link

Feature description

We are currently working on Miden Playground, and we have a requirement to display output notes after executing a transaction. At present, when we use the TransactionExecutor from the miden_tx crate to execute a transaction with a SWAP note using the execute_transaction function, I find that there is a Partial Payback note in the output_notes of the ExecutedTransaction.

It would be preferable to have a Full output note in the output_notes of the ExecutedTransaction instead, as the Miden Playground needs to show complete information about each note.

I have observed that in the Miden client, we construct an expected future payback note before executing a transaction. However, I believe this approach may not be suitable for Miden Playground. Users can modify notes (script, inputs, and assets), and as a result, we cannot definitively determine if a note remains a SWAP or becomes something else after user edits. Ideally, in our case we should build the payback output note after the transaction execution.

Could we explore implementing this improvement?

Why is this feature needed?

No response

@barabanovro barabanovro added the enhancement New feature or request label Jan 6, 2025
@Dominik1999
Copy link
Collaborator

Quick question: are you using a public or a private note as output?

For public notes that you are creating, you should already be able to get the full note details out of the executor.

@barabanovro
Copy link
Author

@Dominik1999 Is it determined in the note script? If so, then I have const.PRIVATE_NOTE = 2 in the SWAP note script. I assume this means that the note is private?

@Dominik1999
Copy link
Collaborator

Yes, that means the note is private. So you will only get partial information of the note out.

I think @igamigo or someone of his team might be able to help you for this particular case. I understand that for the playground we need the full note information out.

@igamigo
Copy link
Collaborator

igamigo commented Jan 7, 2025

For a private note, you cannot get details on ExecutedTransaction.
For public notes, I believe you only get OuputNote::Full if you insert the recipient in the advice provider (and then it gets built here). For this you need to know the data beforehand anyway. I believe on the client we do not automatically set this data, even for public notes. This is something we might want to do (and there might be an issue for it already, IIRC).

@bobbinth
Copy link
Contributor

bobbinth commented Jan 9, 2025

To clarify this a bit more:

  • if information of the output note RECIPIENT is pre-loaded into the advice provider before a transaction is executed, we'd get OutputNote::Full. This is regardless of whether the note is public or private.
  • If there is no information about the recipient in the advice provider, then we get OutputNote::Partial. If this note is supposed to be public, we'll get an error (we can't have partial public notes). So, in effect, this works only for private notes.

I think the next question is how to compute a RECIPIENT for a note (more info about what recipient is is here). In the context of the playground, we probably should have a "widget" for creating expected output notes of a transaction. In this widget the user would specify note script, inputs, and a serial number (which can be randomly generated). Once these are specified, we can compute the RECIPIENT and this value can be used in the note/tx scripts to create the note.

@Dominik1999 @gobsponge - maybe worth sketching a UI for this.

@bobbinth bobbinth added this to the v0.8 milestone Jan 21, 2025
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
None yet
Development

No branches or pull requests

4 participants