-
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
feat: store and retrieve aux field #384
feat: store and retrieve aux field #384
Conversation
crates/store/src/db/sql.rs
Outdated
let merkle_path = MerklePath::read_from_bytes(merkle_path_data)?; | ||
let details_data = row.get_ref(8)?.as_blob_or_null()?; | ||
let details_data = row.get_ref(9)?.as_blob_or_null()?; | ||
let details = details_data.map(<Vec<u8>>::read_from_bytes).transpose()?; | ||
|
||
// TODO: Properly retrieve aux |
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 be good to remove this TODO
!
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.
Also, these same changes need to be applied to the other note queries
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.
done! I removed the TODO and applied the same change to select_note
and select_note_by_id
crates/store/src/db/sql.rs
Outdated
@@ -483,17 +486,19 @@ pub fn select_notes_since_block_by_tag_and_sender( | |||
let note_type = row.get::<_, u8>(4)?; | |||
let sender = column_value_as_u64(row, 5)?; | |||
let tag: u32 = row.get(6)?; | |||
let merkle_path_data = row.get_ref(7)?.as_blob()?; | |||
let aux: u64 = row.get(7)?; | |||
let aux = aux.try_into().map_err(|err| DatabaseError::DeserializationError(DeserializationError::InvalidValue(err)))?; |
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'm not sure this error represents the problem correctly here. Looking at the definition it seems that it's related to problems deserializing SQL blobs where here, the u64
was already deserialized from the database. But also, not sure if there is a better representation there. Maybe introducing a new InvalidFelt
variant?
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.
done!
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.
All looks good! Thank you!
@Dominik1999 - could you tackle 0xPolygonMiden/miden-client#381 next so that we can test/close this as well?
There you go 0xPolygonMiden/miden-base#752 |
@mFragaBA - now that 0xPolygonMiden/miden-base#752 is merged, could you confirm that all is working here as well? After this we can merge this PR as well. |
addresses #342.
I tried testing this using the integration tests on miden-client but they fail because I still can't use any other value than 0 for the aux field until 0xPolygonMiden/miden-base#731 is done.
That being said, I somewhat tested this change by changing the hardcoded 0 value in the transaction kernel's create_note and using the same value for notes on the integration tests. They ran successfully with some fixes present in 0xPolygonMiden/miden-client#381 (mainly removing hardcoded values from the client side)
sqlite3
and the aux column ofnotes
had the proper values