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 method for exporting and importing notes #67

Merged
merged 7 commits into from
Dec 22, 2023

Conversation

igamigo
Copy link
Collaborator

@igamigo igamigo commented Dec 20, 2023

In order to register notes that can be passed through a side channel, we need a method to import/export them

Copy link
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! Looks good! I do have a few comments - some of them may be good to do in this PR, but others we can do in subsequent PRs (but let's create issues for them).

  1. I'd prefer Client::import_note() instead of Client::insert_input_note().
  2. In the future, we'd probably want to enable importing of both pending and committed notes (i.e., Note vs. RecordedNote). So, we might have to create a separate struct where note authentication info is optional.
  3. For CLI command structure, I wonder if it would be better to have import and export be top level commands. So, we'd say miden-client import note to import a note.

@igamigo
Copy link
Collaborator Author

igamigo commented Dec 21, 2023

I'd prefer Client::import_note() instead of Client::insert_input_note().

Renamed

In the future, we'd probably want to enable importing of both pending and committed notes (i.e., Note vs. RecordedNote). So, we might have to create a separate struct where note authentication info is optional.

Created an issue for this, also related to #68 that implements an enum for Note/RecordedNote

For CLI command structure, I wonder if it would be better to have import and export be top level commands. So, we'd say miden-client import note to import a note.

Created an issue for this as well. I don't think it's necessary right now but as the project takes form we might want to do that.

Copy link
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.

Looks good! Thank you! I left one comment for the future inline.

Comment on lines +30 to 34
pub fn import_input_note(&mut self, note: RecordedNote) -> Result<(), ClientError> {
self.store
.insert_input_note(&note)
.map_err(|err| err.into())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

One other thing to consider in the future: when we are importing notes with Merkle authentication paths, we'd probably want to make sure that the note actually exists in the chain and start monitoring its nullifiers. The former will require a call to the node RPC. For the latter we'll need to update a list of relevant tags in the state sync table.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a TODO for this

@igamigo igamigo merged commit 516e535 into main Dec 22, 2023
4 checks passed
@igamigo igamigo deleted the igamigo-import-notes branch December 22, 2023 15:23
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