Skip to content

Conversation

@partylikeits1983
Copy link
Contributor

This PR adds the P2IDE note as an example note.

@partylikeits1983 partylikeits1983 added the examples Issues or requests related to our example projects label Oct 6, 2025
@partylikeits1983 partylikeits1983 self-assigned this Oct 27, 2025
@partylikeits1983 partylikeits1983 marked this pull request as ready for review October 27, 2025 13:44
Copy link
Contributor

@greenhat greenhat left a 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));
Copy link
Contributor

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

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));
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples Issues or requests related to our example projects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants