fix(token-extensions/metadata): build on Anchor 1.0; re-enable in CI#62
Merged
Conversation
… 1.0 / Solana 3.x The example failed to build after the repo moved to Anchor 1.0 / Solana 3.x because it pinned ancient spl-token-metadata-interface 0.3.3 / spl-type-length-value 0.4.3, which dragged in an old solana-zk-token-sdk that no longer compiles. - Bump spl-token-metadata-interface to 0.8.0 and spl-type-length-value to 0.9.1 (aligned with the version anchor-spl 1.0 pulls, resolving a VariableLenPack trait version clash). - initialize.rs: replace removed DEFAULT_EXEMPTION_THRESHOLD / DEFAULT_LAMPORTS_PER_BYTE_YEAR rent calc with Rent::get()?.minimum_balance(); drop the now-unused rent imports. - Add the renamed program_id field (formerly token_program_id) to the TokenMetadataInitialize / TokenMetadataUpdateField / TokenMetadataUpdateAuthority CPI account structs. - Rename handle_process_* instruction fns to process_* to match lib.rs. - Make the instructions module public so the LiteSVM test can reference its arg/enum types. - Add #![allow(clippy::diverging_sub_expression)] for the Anchor #[program] macro false positive. - Remove the example from .github/.ghaignore. Verified: cargo build-sbf, cargo test (LiteSVM full flow passes), cargo fmt --check, and cargo clippy --tests -D warnings all pass. https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP
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
Re-enables the excluded
tokens/token-extensions/metadata/anchorToken-2022 metadata example (initialize / update_field / remove_key / emit / update_authority). It was tagged "build failed – program outdated".Root cause: it pinned ancient
spl-token-metadata-interface = "0.3.3"/spl-type-length-value = "0.4.3", which dragged in an oldsolana-zk-token-sdkthat no longer compiles (PedersenCommitmentetc.).Changes
spl-token-metadata-interface→0.8.0,spl-type-length-value→0.9.1(must match — anchor-spl 1.0.2 pulls token-metadata-interface 0.8.0, which depends on type-length-value 0.9.1; mismatching them makesTokenMetadata'sVariableLenPack::get_packed_lenresolve against the wrong crate version).initialize.rs: removedDEFAULT_LAMPORTS_PER_BYTE_YEAR/DEFAULT_EXEMPTION_THRESHOLD(gone in solana 3.x) →Rent::get()?.minimum_balance(data_len).token_program_idfield was renamed toprogram_idonTokenMetadataInitialize/UpdateField/UpdateAuthority— updated accordingly.handle_process_*→process_*to matchlib.rs; made theinstructionsmodulepubso the test can use its arg types.Test / CI
The existing Rust LiteSVM test (
programs/metadata/tests/test_metadata.rs) drives the full flow (initialize → update_field → …); it references the program viametadata::id()(so it survives CI'sanchor keys sync). Dropped the example from.github/.ghaignore.Verification (Solana 3.1.x / platform-tools v1.52)
cargo build-sbf✓ ·cargo test→test_metadata_full_flowpasses ✓ ·cargo fmt --checkclean ·cargo clippy --tests -D warningsclean. No build artifacts committed.https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP
Generated by Claude Code