-
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
Implemented support for note trees in Miden node #295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not check out the changes in miden-base
in depth. I'm a bit confused by the introduction of the batch index and what advantages it brings but the overall code LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you! I left a few small comments inline. After these are addressed, we can merge.
store/src/db/migrations.rs
Outdated
batch_index INTEGER NOT NULL, | ||
note_index INTEGER NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add comments here to clarify what batch_index
and note_index
represent.
Cargo.toml
Outdated
miden-lib = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "polydez-notes-tree" } | ||
miden-objects = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "polydez-notes-tree" } | ||
miden-processor = { version = "0.8" } | ||
miden-stdlib = { version = "0.8", default-features = false } | ||
miden-tx = { version = "0.1" } | ||
miden-tx = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "polydez-notes-tree" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can probably be changed to the next
branch now.
We need batch index for block note tree in order to mitigate bugs with note index calculations we faced. Our previous approach was to write note id and metadata hash into two adjacent leaves of
and +1 for metadata hash. This code was duplicated several times and each implementation was different, some of them were buggy. This PR should force to provide batch index and node index in batch as separate arguments and tree implementation will calculate all the rest by itself in one single place. |
e8579c2
to
a0184f7
Compare
…x` instead of encoding it into the note index
a0184f7
to
7c225a0
Compare
* feat: migration to the `next` versions of Miden dependencies * fix: address review comments * fix: update to the latest `next` * feat: support of `BatchNoteTree` and `BlockNoteTree` * feat: support of `BatchNoteTree` and `BlockNoteTree`, use `batch_index` instead of encoding it into the note index * docs: add comments in SQL for batch and note indexes
Updated code to use
BlockTreeNotes
andBatchTreeNotes
, introducedbatch_index
in order to reduce bugs with calculations.