fix: TransactionHeader serialization#1701
Conversation
mmagician
left a comment
There was a problem hiding this comment.
LGTM, let's maybe add a roundtrip test for serialization here?
|
This also needs a migration which is about to be introduced in #1700 , or do we never query the TX header from DB? |
|
igamigo
left a comment
There was a problem hiding this comment.
LGTM in terms of the code actually fixing the issue. However, we still cannot reconstruct the transaction header AFAIK. Not sure if this is something we want (I think it was discussed it at some point, but couldn't find much after a quick search cc @PhilippGackstatter), but I don't think we need it so this PR should be fine to merge.
bobbinth
left a comment
There was a problem hiding this comment.
Looks good! Thank you!
However, we still cannot reconstruct the transaction header AFAIK. Not sure if this is something we want (I think it was discussed it at some point, but couldn't find much after a quick search cc @PhilippGackstatter), but I don't think we need it so this PR should be fine to merge.
I thought we had an issue about this somewhere (to try to make transaction header consistent between protocol and protobuf implementations). If not, it may make sense to create one.
|
|
||
| This endpoint enables clients to maintain an updated view of account storage. | ||
|
|
||
| ### SyncChainMmr |
There was a problem hiding this comment.
Question: why did we remove this section (and also the entry on line 26 above)?
There was a problem hiding this comment.
It was mistakenly removed, fixed!
Just so we're on the same page here -- this, and the protocol migration, are not intended for v0.13 correct? If they are, then this becomes a much bigger lift. |
No - this should go into |
| // Serialize input notes using binary format (store nullifiers) | ||
| let nullifiers_binary = transaction_header.input_notes().to_bytes(); | ||
| // Extract nullifiers from input notes and serialize them. | ||
| // We only store the nullifiers (not the full InputNoteCommitment) since |
There was a problem hiding this comment.
nit: I'd appreciate backticks for types in comments
bin/node/src/commands/mod.rs
Outdated
|
|
||
| impl BundledValidatorConfig { | ||
| /// Converts the [`ValidatorConfig`] into a URL and an optional [`SocketAddr`]. | ||
| /// Converts the `ValidatorConfig` into a URL and an optional [`SocketAddr`]. |
There was a problem hiding this comment.
| /// Converts the `ValidatorConfig` into a URL and an optional [`SocketAddr`]. | |
| /// Converts the [`crate::commands::ValidatorConfig`] into a URL and an optional [`SocketAddr`]. |
There was a problem hiding this comment.
Linting was not part of actual code changes, as of rebasing into next, suggestion no longer applies.
drahnr
left a comment
There was a problem hiding this comment.
Bar the removal of SyncChainMmr from the docs and some nits, LGTM
mmagician
left a comment
There was a problem hiding this comment.
lgtm, but this should go to next as the bug is already there and not on the migration branch
a652138 to
12a0a74
Compare
Debugging #1691 with the miden client, found the following errors:
The
TransactionHeadertype changes from miden-base #1973 introduce a serialization mismatch inTransactionSummaryRowInsert::new.The read side (
TransactionRecordRaw::try_into) deserializes stored bytes asVec<Nullifier>andVec<NoteId>, but after the base update:transaction_header.input_notes()returnsInputNotes<InputNoteCommitment>(wasVec<Nullifier>), whereInputNoteCommitmentincludes anOption<NoteHeader>alongside the nullifier.transaction_header.output_notes()returns&[NoteHeader](wasVec<NoteId>), whereNoteHeaderincludesNoteMetadataalongside the note ID.Calling .to_bytes()on these richer types produces a different binary format than what the read side expects, so we need to extract just the nullifiers and note IDs before serializing.Cursor/push logic
Old code accumulated transactions in the loop but only stored the last one in
last_added_tx. After the loop, it pushed that single transaction and updated the cursor. This was a bug — only the last transaction from each chunk was actually pushed toall_transactions, thus all earlier transactions in the chunk were silently dropped.Fix pushes each transaction and updates the cursor immediately inside the loop, so every transaction that fits within the size limit is correctly added to
all_transactions.