0xPolygonMiden / miden-client

Client library that facilitates interaction with the Miden rollup
MIT License
25 stars 22 forks source link

feat: add a way to get the consumer account of a note #325

Closed tomyrd closed 1 month ago

tomyrd commented 1 month ago

One of the changes requested in #314 is:

show input note status (pending, committed (height), consumed(account_id_that_consumed_the_note)) on input-notes list.

But we didn't have a way to get the account ID of the consumer of a note. This PR adds a new method to Store and Client that does just that.

bobbinth commented 1 month ago

Probably for a different PR: would it make sense to store this info in the database somehow? Like for every input note we could have "consumed by" field which would be set to account ID which consumed the note and null otherwise.

I guess the difficulty here would be to figure out when to fill this field (e.g., when a transaction is submitted to the node, or when it is recorded on chain).

mFragaBA commented 1 month ago

Probably for a different PR: would it make sense to store this info in the database somehow? Like for every input note we could have "consumed by" field which would be set to account ID which consumed the note and null otherwise.

I guess the difficulty here would be to figure out when to fill this field (e.g., when a transaction is submitted to the node, or when it is recorded on chain).

One way might be when we mark the transactions as Committed

bobbinth commented 1 month ago

Probably for a different PR: would it make sense to store this info in the database somehow? Like for every input note we could have "consumed by" field which would be set to account ID which consumed the note and null otherwise. I guess the difficulty here would be to figure out when to fill this field (e.g., when a transaction is submitted to the node, or when it is recorded on chain).

One way might be when we mark the transactions as Committed

On the second thought, maybe storing account ID is not the right thing and what we should store is actually transaction ID (of the transaction in which the note was consumed).

One other thing that we should try to figure out how to do is to track more details information about note status. For example, I don't think we can currently tell if a note is in the process of being consumed (e.g., we created a transaction consuming this note, sent it to the network, but the transaction hasn't been included in a block yet) and how long it has remained in this state (e.g., have we sent a transaction 10 minutes or 10 days ago?). Let's create an issue to discuss this.

tomyrd commented 1 month ago

Closing this PR as a better solution was developed in #334