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
Comment on lines +279 to +283
inputs: vec![
alice_account.id().prefix().as_felt(),
alice_account.id().suffix(),
timelock_height.into(),
reclaim_height.into(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

4 inputs to the note

Comment on lines 47 to 51
let inputs = note::get_inputs();
let target_account_id_prefix = inputs[0];
let target_account_id_suffix = inputs[1];
let timelock_height = inputs[2];
let reclaim_height = inputs[3];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note consumption fails when more than 2 inputs. If timelock_height & reclaim_height are commented out, note consumption works.

// get block number
let block_number = tx::get_block_number();

assert!(block_number >= timelock_height);
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason for step 2 failure is this assert!. The timelock_height is 1000, but the test suite is bootstrapping the chain so the block_number should be low digits. If you set timelock_height to 1 this assert! is passing. After that the test fails at step 5.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish this was the issue. I updated the code to demonstrate that this is not the issue. The issue is that if you try to initialize more than 2 variables from note inputs:

let inputs = note::get_inputs();
let target_account_id_prefix = inputs[0];
let target_account_id_suffix = inputs[1];

let timelock_height = inputs[2]; // fails when uncommented

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, this fails on step 5. In this case send_asset_to_account makes a note providing only 2 elements (account id) as note inputs. So there are only 2 elements in inputs.

Comment on lines +43 to +48
fn run(_arg: Word) {
let inputs = note::get_inputs();
let target_account_id_prefix = inputs[0];
let target_account_id_suffix = inputs[1];

let timelock_height = inputs[2]; // fails when uncommented
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fails when trying to initialize more than 2 inputs.

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.

2 participants