-
Notifications
You must be signed in to change notification settings - Fork 48
Add P2IDE note example #704
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
base: next
Are you sure you want to change the base?
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.
Looking good! The new test never exercises the reclaim branch of the script. It'd be great to have that case covered as well.
| let reclaim_height = inputs[3]; | ||
|
|
||
| // make sure the number of inputs is 4 | ||
| assert_eq(inputs.len().into(), Felt::from(4u32)); |
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.
The code before this assert_eq indexes inputs[0..=3] before checking how many items were provided, so a malformed note input will panic before this assert. Consider moving it to the start of the function.
| let reclaim_height = Felt::new(0); | ||
|
|
||
| // Create the p2ide note with only 2 inputs (account ID) | ||
| // This is a simplified P2IDE note without timelock/reclaim functionality |
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.
It seems like it's a full-fledged P2IDE note with a reclaim feature.
| let reclaim_height = inputs[3]; | ||
|
|
||
| // make sure the number of inputs is 4 | ||
| assert_eq(inputs.len().into(), Felt::from(4u32)); |
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.
There is a felt! macro in the SDK. So Felt::from(4u32) can be substituted with felt!(4).
This PR adds the P2IDE note as an example note.