Skip to content
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: Add note execution_hint to store #441

Merged
merged 13 commits into from
Aug 13, 2024

Conversation

SantiagoPittella
Copy link
Collaborator

@SantiagoPittella SantiagoPittella commented Aug 12, 2024

This fixes the faucet's and node build by doing the following:

  • Adding the new NoteExecutionHint for all note's metadata
  • Adding the new after_block_num field to note exports on the faucet
  • Adding the execution_hint field to Notes table.

Closes #439 .

This PR is built on top of 0xPolygonMiden/miden-base#827 .

It is meant to be merged AFTER that PR.

@SantiagoPittella SantiagoPittella added this to the v0.5 milestone Aug 12, 2024
@SantiagoPittella SantiagoPittella marked this pull request as ready for review August 12, 2024 20:21
Copy link
Collaborator

@igamigo igamigo left a comment

Choose a reason for hiding this comment

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

LGTM! Left a couple minor comments. I also don't know if it's possible to easily test this (checking that storing/retrieval is correct) but it would be nice

@@ -589,9 +600,15 @@ pub fn select_notes_since_block_by_tag_and_sender(
let merkle_path = MerklePath::read_from_bytes(merkle_path_data)?;
let details_data = row.get_ref(9)?.as_blob_or_null()?;
let details = details_data.map(<Vec<u8>>::read_from_bytes).transpose()?;
let execution_hint = row.get_ref(10)?.as_i64()? as u64;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can use column_value_as_u64() here

@@ -26,8 +33,15 @@ impl From<NoteMetadata> for crate::generated::note::NoteMetadata {
let sender = Some(val.sender().into());
let note_type = val.note_type() as u32;
let tag = val.tag().into();
let execution_hint: u64 = Felt::from(val.execution_hint()).into();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can now replace this with

        let execution_hint: u64 = val.execution_hint().into();

@igamigo igamigo requested a review from polydez August 12, 2024 21:35
Copy link
Contributor

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Choose a reason for hiding this comment

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

LGTM

crates/proto/src/domain/notes.rs Outdated Show resolved Hide resolved
aux INTEGER NOT NULL,
merkle_path BLOB NOT NULL,
details BLOB,
execution_hint INTEGER,
Copy link
Contributor

Choose a reason for hiding this comment

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

A couple of small comments:

  • We should probably move execution_hint to be right after aux field since logically it is part of the note's metadata.
  • I think execution_hint should be NOT NULL field as we always have an integer value for it.

Comment on lines 427 to 428
details,
execution_hint
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to the other comment, here, and in other places in this file, I'd probably move execution_hint to be right after the aux field.

Copy link
Collaborator

@igamigo igamigo left a comment

Choose a reason for hiding this comment

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

LGTM!

@SantiagoPittella SantiagoPittella merged commit 83c73c2 into next Aug 13, 2024
9 checks passed
@SantiagoPittella SantiagoPittella deleted the add-note-exec-hint-to-store branch August 13, 2024 14:21
@bobbinth bobbinth mentioned this pull request Aug 18, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants