-
Notifications
You must be signed in to change notification settings - Fork 37
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
Enhance Note Consumption: Skip Invalid Notes and Consume Valid Ones from the List #679
Comments
For this scenario where an asset is placed on a note which cannot be consumed as expected for whatever reason (wrong target account, etc.), you can always encode conditions in the script that could let you recall assets after a certain amount of time has passed. For example, you could make it so that only a target account ID can consume the note, but if the reference block is, say, 1000 or higher, you (the sender account ID) can consume the note again. The P2IDR note script is provided for scenarios similar to these. Regarding not failing if a single note errors, I think it could potentially be done although I'm not sure about all the implications (cc @bobbinth) nor whether it's always desirable. A simple workaround that you could use now for knowing whether a note is consumable is to test with a simple execution transaction, but disregarding proving/submitting to the node. |
I think there are a few things here:
For points 2 and 3, we should think through the UX - i.e., specifically how do we let the user know that a given note may not be executable (e.g., does it happen at transaction building time? or maybe earlier?) |
Related to this is also 0xPolygonMiden/miden-base#831 |
Feature description
Story
I was trying to create multiple notes using an invalid (almost an empty) masm script. My balance was deducted & it created the note scripts. But note was not valid or it was failing to consume in the target account. After importing the notes, I found out I already had few other imported note but not consumed yet. I prepared a noteList and tried to use this method
webClient.new_consume_transaction(targetAccount,noteList)
. And it was failing to consume the notes. Since it had that invalid note. But If I provided valid note ids, it was working fine.Requesting Feature
A better way to handle that note consumption will be nice. For an example, If I have 5 notes & 1 of them is invalid, it should consume 4 of them & throw an error for the invalid one.
Why is this feature needed?
In my case, I was having trouble to consume valid notes because of invalid one. I didn't know if it was an invalid note. It created the notes & deducted the balance from my account & it failed on target account note consumption level. This is also a bit concerning if an invalid note is generated and can't be consumed by target account that fund might be lost.
The text was updated successfully, but these errors were encountered: