Skip to content

spl: fix metadata feature failing to build standalone#4742

Open
plutohan wants to merge 1 commit into
otter-sec:masterfrom
plutohan:plutohan/issue-3291-metadata-feature-standalone
Open

spl: fix metadata feature failing to build standalone#4742
plutohan wants to merge 1 commit into
otter-sec:masterfrom
plutohan:plutohan/issue-3291-metadata-feature-standalone

Conversation

@plutohan

Copy link
Copy Markdown

Fixes #3291.

cargo build -p anchor-spl --no-default-features --features metadata fails because metadata.rs uses spl_token_interface::ID and spl_associated_token_account_interface::program::ID, which are only pulled in by the token/associated_token features. This enables those two (already optional) crates from the metadata feature so it builds standalone. No code changes.

Verified --features metadata builds and the default build is unchanged.

@acheroncrypto you suggested using the lighter spl-associated-token-account-client instead. I went with the existing interface crates since it's a one-line change with no new deps, but can switch to the client crates if you'd prefer.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@plutohan is attempting to deploy a commit to the OtterSec Team on Vercel.

A member of the Team first needs to authorize it.

@plutohan plutohan force-pushed the plutohan/issue-3291-metadata-feature-standalone branch from 0eb6d7e to 1287232 Compare June 30, 2026 11:20
@jamie-osec

Copy link
Copy Markdown
Collaborator

Please use the suggested fix with spl-associated-token-account-client; it makes our dep tree lighter

Comment thread spl/Cargo.toml Outdated
Comment on lines +25 to +26
"spl-token-interface",
"spl-associated-token-account-interface",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently applied inconsistently in the codebase, but please use dep:<crate> syntax for new feature-dependencies as it makes them a little clearer.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I switched these to dep:, and also flipped token/associated_token to dep: since using dep: for those crates drops their implicit feature, which the bare references relied on.

@plutohan plutohan force-pushed the plutohan/issue-3291-metadata-feature-standalone branch from 1287232 to d05c987 Compare June 30, 2026 20:04
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.

anchor-spl with metadata feature fails to compile without token and associated_token

2 participants