test(compression/cnft-burn): fix build + add LiteSVM cNFT-burn test; re-enable in CI#57
Merged
Conversation
The program pinned `ahash = "=0.8.7"` (unused in the source), which pulls getrandom 0.2 — that `compile_error!`s on the SBF target, so `cargo build-sbf` / `anchor build` failed. Drop the pin; the program now builds on the current toolchain (it was already migrated to Anchor 1.0 with manual Bubblegum CPI). This does not yet re-enable it in CI: it still needs a cNFT-burn integration test (load Bubblegum + spl-account-compression + noop fixtures, create a tree, mint a cNFT, compute the proof, then burn), which is tracked separately.
… account-compression, noop) + provenance
Re-enable the cnft-burn Anchor example with a Rust LiteSVM test that runs
the full create-tree -> mint -> burn flow against the real mainnet
mpl-bubblegum, spl-account-compression, and spl-noop program binaries.
- Anchor.toml [scripts] test -> cargo test (matches the group/anchor pattern).
- Add litesvm + solana-* 3.x dev-dependencies to the program crate.
- programs/cnft-burn/tests/test_burn.rs:
- loads cnft_burn.so plus the three committed fixtures into LiteSVM
- allocates + create_tree_config a depth-3/buffer-8 Bubblegum tree
- mints one cNFT via mint_v1 (TokenStandard::NonFungible)
- recomputes data_hash/creator_hash exactly as Bubblegum does
- builds the empty-node Merkle proof for leaf 0 and reads the live root
from the on-chain ConcurrentMerkleTree<3,8> account
- calls burn_cnft, asserts success, and asserts a second burn fails
- Suppress the Anchor #[program] macro's false-positive
diverging_sub_expression clippy lint at the crate level.
https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP
…oys to a local validator (not unfunded devnet)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compression/cnft-burn/anchorwas excluded ("builds but need to test on localhost") — but it didn't actually build, and had no test. This fixes both and re-enables it.Build fix
The program was already migrated to Anchor 1.0 (it builds its Bubblegum
BurnCPI manually, nompl-bubblegum/spl-account-compressionRust deps). The only break was a leftover, unusedahash = "=0.8.7"pin, which pullsgetrandom 0.2— thatcompile_error!s on the SBF target. Removing it →cargo build-sbfsucceeds.Real cNFT-burn test (LiteSVM)
Switched the Anchor test script to
cargo test(matching the other re-enabled Anchor examples) and addedprograms/cnft-burn/tests/test_burn.rs, which exercises the full flow against the real mainnet programs:ConcurrentMerkleTree<3,8>account and runs Bubblegumcreate_tree_config.mint_v1.data_hash/creator_hashexactly as Bubblegum (keccak(keccak(metadata) ++ seller_fee)/hash_creators), builds the index-0 proof from account-compression empty-node hashes, and reads the live root from the tree account.burn_cnft, asserts success, and asserts a second burn fails (leaf zeroed → stale root).Fixtures + provenance
The three
.soare committed undertests/fixtures/(same mechanism the repo already uses formpl_token_metadata.so), with atests/fixtures/README.mdmanifest recording each program's ID, source cluster, dump date (2026-06-05) + slot (424532091), and the refresh command.Verification
Against the CI toolchain (Solana 3.1.x / platform-tools v1.52):
cargo build-sbfbuilds,cargo testpasses (test_burn_cnft+ discriminator check),cargo fmt --checkclean,cargo clippy --tests -D warningsclean. Only the mainnet fixtures (not the built program.so) are committed. Removedcompression/cnft-burn/anchorfrom.github/.ghaignore.https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP
Generated by Claude Code