Skip to content

fix(token-extensions/metadata): build on Anchor 1.0; re-enable in CI#62

Merged
mikemaccana merged 1 commit into
mainfrom
claude/token-ext-metadata
Jun 5, 2026
Merged

fix(token-extensions/metadata): build on Anchor 1.0; re-enable in CI#62
mikemaccana merged 1 commit into
mainfrom
claude/token-ext-metadata

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

Summary

Re-enables the excluded tokens/token-extensions/metadata/anchor Token-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 old solana-zk-token-sdk that no longer compiles (PedersenCommitment etc.).

Changes

  • Deps: spl-token-metadata-interface0.8.0, spl-type-length-value0.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 makes TokenMetadata's VariableLenPack::get_packed_len resolve against the wrong crate version).
  • initialize.rs: removed DEFAULT_LAMPORTS_PER_BYTE_YEAR/DEFAULT_EXEMPTION_THRESHOLD (gone in solana 3.x) → Rent::get()?.minimum_balance(data_len).
  • anchor-spl 1.0 CPI structs: token_program_id field was renamed to program_id on TokenMetadataInitialize/UpdateField/UpdateAuthority — updated accordingly.
  • Naming: renamed the instruction handlers handle_process_*process_* to match lib.rs; made the instructions module pub so 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 via metadata::id() (so it survives CI's anchor keys sync). Dropped the example from .github/.ghaignore.

Verification (Solana 3.1.x / platform-tools v1.52)

cargo build-sbf ✓ · cargo testtest_metadata_full_flow passes ✓ · cargo fmt --check clean · cargo clippy --tests -D warnings clean. No build artifacts committed.

https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP


Generated by Claude Code

… 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
@mikemaccana mikemaccana merged commit ec6e5e4 into main Jun 5, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants