Commit 71dccc5
committed
Add LiteSVM integration test for cnft-vault withdraw_cnft
Adds programs/cnft-vault/tests/test_vault.rs, a LiteSVM test that:
- loads the built cnft-vault program plus the three mainnet fixtures
(mpl-bubblegum, spl-account-compression, spl-noop)
- creates a Bubblegum ConcurrentMerkleTree<3,8> and mints a cNFT whose
leaf_owner is the vault PDA (seeds [b"cNFT-vault"])
- recomputes data_hash/creator_hash, builds the index-0 empty-node proof,
reads the live root
- calls withdraw_cnft (CPIs Bubblegum Transfer, vault PDA signs via
invoke_signed) to move the cNFT to a recipient, asserting success and
that a replay with the now-stale root fails
Also: add #![allow(clippy::diverging_sub_expression)] (accepted Anchor
#[program] false positive) and #[allow(clippy::too_many_arguments)] on
build_transfer_instruction, plus rustfmt cleanup, so fmt/clippy are clean.
withdraw_two_cnfts is left untested (would need two trees/leaves/proofs).
https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP1 parent 9f9f470 commit 71dccc5
4 files changed
Lines changed: 463 additions & 16 deletions
File tree
- compression/cnft-vault/anchor/programs/cnft-vault
- src
- instructions
- tests
Lines changed: 2 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
6 | 3 | | |
7 | | - | |
| 4 | + | |
8 | 5 | | |
9 | 6 | | |
10 | 7 | | |
| |||
Lines changed: 2 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
6 | 3 | | |
7 | | - | |
| 4 | + | |
8 | 5 | | |
9 | 6 | | |
10 | 7 | | |
| |||
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | | - | |
13 | | - | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
0 commit comments