Skip to content

refactor: add inclusion proofs to SyncTransactions output notes#1893

Merged
bobbinth merged 2 commits intoigamigo-include-chain-tipfrom
igamigo-tx-notes-proofs
Apr 7, 2026
Merged

refactor: add inclusion proofs to SyncTransactions output notes#1893
bobbinth merged 2 commits intoigamigo-include-chain-tipfrom
igamigo-tx-notes-proofs

Conversation

@igamigo
Copy link
Copy Markdown
Collaborator

@igamigo igamigo commented Apr 6, 2026

Closes #1890 and builds on #1881

Enriches the response of SyncTransactions to include output note inclusion proofs. I did not find a simpler way to do this; alternatives included adding the data to the transactions tables or joining but this was not achievable with extra refactors or important downsides.
Also includes minor related refactors.

@igamigo igamigo changed the title refactor: add inclusion proof to SyncTransactions output notes refactor: add inclusion proofs to SyncTransactions output notes Apr 6, 2026
@igamigo igamigo changed the base branch from next to main April 6, 2026 20:24
@igamigo igamigo force-pushed the igamigo-tx-notes-proofs branch from ac7a8ef to 38e52bb Compare April 6, 2026 20:26
@igamigo igamigo changed the base branch from main to igamigo-include-chain-tip April 6, 2026 20:34
@igamigo igamigo marked this pull request as ready for review April 6, 2026 20:39
@igamigo igamigo mentioned this pull request Apr 6, 2026
Copy link
Copy Markdown
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I think this works for now. It does introduce some inconstancies, but I think we'll need to address them in v0.15. Let's create a follow-up issue for these.

Comment on lines +87 to +88
// Output notes of the transaction together with their inclusion proofs.
repeated note.NoteSyncRecord output_notes = 6;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is probably fine for now, but this again "de-syncs" the TransactionHeader message from the TransactionHeader struct in the protocol.

Ideally, we'd fine a way to keep things consistent - for example, if we can't align this with TransactionHeader struct, we could rename this into TransactionRecord or something like this. There could also be other ways to group things. Let's create an issue for this to resolve this in v0.15.

Comment on lines 72 to 73
// The unique identifier of the transaction.
TransactionId transaction_id = 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but I thought we got rid of this filed (because it should be computable from other fields in this message) - but maybe we didn't quite get there?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point, I hadn't noticed this was still around. It should be computable, just double checked. I can remove it here or add it to the issue for refactoring the transaction record.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it as is for now and address it in a later PR.

Copy link
Copy Markdown
Collaborator Author

@igamigo igamigo Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mentioned above is not quite true, as NoteSyncRecord does not contain full note metadata. Expanded here: #1898 (comment)

Comment on lines 156 to 167
proto::rpc::TransactionRecord {
header: Some(proto::transaction::TransactionHeader {
transaction_id: Some(self.transaction_id.into()),
account_id: Some(self.account_id.into()),
initial_state_commitment: Some(self.initial_state_commitment.into()),
final_state_commitment: Some(self.final_state_commitment.into()),
input_notes: self.input_notes.into_iter().map(Into::into).collect(),
output_notes: self.output_notes.into_iter().map(Into::into).collect(),
fee: Some(Asset::from(self.fee).into()),
}),
block_num: self.block_num.as_u32(),
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to one of the previous comments, I wonder if the note inclusion paths could be a part of the TransactionRecord rather than TransactionHeader. But again, this is probably something to solve in a follow-up PR.

Comment thread crates/store/src/db/models/queries/notes.rs
Comment thread crates/store/src/db/models/queries/transactions.rs
@igamigo igamigo force-pushed the igamigo-include-chain-tip branch 2 times, most recently from 9289dd9 to 7a07a95 Compare April 6, 2026 23:23
@igamigo igamigo force-pushed the igamigo-tx-notes-proofs branch from 5d1cf37 to 60c063a Compare April 6, 2026 23:29
@bobbinth bobbinth merged commit c9da5ed into igamigo-include-chain-tip Apr 7, 2026
15 checks passed
@bobbinth bobbinth deleted the igamigo-tx-notes-proofs branch April 7, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants