(
two_leaves_pda_pubkey: &Pubkey,
left_leaf: &[u8],
right_leaf: &[u8],
encrypted_utxos: &[u8],
_expected_index: usize,
program_context: &mut ProgramTestContext,
)
| 484 | } |
| 485 | |
| 486 | async fn check_leaves_insert_correct( |
| 487 | two_leaves_pda_pubkey: &Pubkey, |
| 488 | left_leaf: &[u8], |
| 489 | right_leaf: &[u8], |
| 490 | encrypted_utxos: &[u8], |
| 491 | _expected_index: usize, |
| 492 | program_context: &mut ProgramTestContext, |
| 493 | ) { |
| 494 | let two_leaves_pda_account = program_context |
| 495 | .banks_client |
| 496 | .get_account(*two_leaves_pda_pubkey) |
| 497 | .await |
| 498 | .expect("get_account") |
| 499 | .unwrap(); |
| 500 | println!( |
| 501 | "two_leaves_pda_account.data: {:?}", |
| 502 | two_leaves_pda_account.data |
| 503 | ); |
| 504 | //account was initialized correctly |
| 505 | assert_eq!(1, two_leaves_pda_account.data[0]); |
| 506 | //account type is correct |
| 507 | assert_eq!(4, two_leaves_pda_account.data[1]); |
| 508 | //expected index |
| 509 | //assert_eq!(expected_index, usize::from_le_bytes(two_leaves_pda_account.data[2..11].try_into().unwrap())); |
| 510 | //saved left leaf correctly |
| 511 | assert_eq!(*left_leaf, two_leaves_pda_account.data[42..74]); |
| 512 | //saved right leaf correctly |
| 513 | assert_eq!(*right_leaf, two_leaves_pda_account.data[10..42]); |
| 514 | //saved merkle tree pubkey in which leaves were insorted |
| 515 | assert_eq!( |
| 516 | MERKLE_TREE_ACC_BYTES_ARRAY[0].0, |
| 517 | two_leaves_pda_account.data[74..106] |
| 518 | ); |
| 519 | // saved encrypted_utxos correctly |
| 520 | assert_eq!(*encrypted_utxos, two_leaves_pda_account.data[106..]); |
| 521 | } |
| 522 | async fn create_pubkeys_from_ix_data( |
| 523 | ix_data: &Vec<u8>, |
| 524 | program_id: &Pubkey, |
no outgoing calls
no test coverage detected