0xPolygonMiden / miden-client

Client library that facilitates interaction with the Miden rollup
MIT License
32 stars 27 forks source link

Return richer information on `SyncSummary` #512

Closed igamigo closed 1 week ago

igamigo commented 3 weeks ago

What should be done?

Currently, we are just returning basic flat stats on SyncSummary such as number of new notes, number of committed transactions, etc. We could improve this and return IDs of each of the involved entities.

How should it be done?

Gather IDs of new entities and return them in Vec<_> fields. The struct should look something like:

pub struct SyncSummary {
    pub block_num: u32,
    pub new_notes: Vec<NoteId>,
    pub new_inclusion_proofs: Vec<NoteId>,
    pub new_nullifiers: Vec<Nullifier>, // maybe NoteId instead?
    pub updated_onchain_accounts: Vec<AccountId>, 
    pub commited_transactions: Vec<TransactionId>,
}

When is this task done?

When we return richer information on SyncSummary as described above. The CLI can keep its current functionality by showing the count of each of these fields.

Additional context

No response

bobbinth commented 3 weeks ago

We may also consider the following structure:

pub struct SyncSummary {
    pub block_num: u32,
    pub received_notes: Vec<NoteId>,
    pub committed_notes: Vec<NoteId>,
    pub consumed_notes: Vec<NoteId>,
    pub updated_accounts: Vec<AccountId>, 
    pub committed_transactions: Vec<TransactionId>,
}
tomyrd commented 3 weeks ago

Just to be clear, the change from new_nullifiers: Vec<Nullifier> to consumed_notes: Vec<NoteId> would mean a separate query to retrieve the consumed note ids (currently we only update the notes that match the nullifiers without returning the ids). This wouldn't be a problem no?

bobbinth commented 3 weeks ago

Just to be clear, the change from new_nullifiers: Vec<Nullifier> to consumed_notes: Vec<NoteId> would mean a separate query to retrieve the consumed note ids (currently we only update the notes that match the nullifiers without returning the ids). This wouldn't be a problem no?

I think this may be OK. With the refactoring we are discussing in https://github.com/0xPolygonMiden/miden-client/discussions/487 I think we'll be retrieving all relevant notes from the store anyways, then applying state transitions to them, and then saving them back to the store. So, the amount of work probably wouldn't be that different.

tomyrd commented 1 week ago

Closed by #513