Skip to content

Swap spl-pod for solana-zero-copy + solana-nullable#1069

Merged
grod220 merged 3 commits intomainfrom
spl-pod-swap
Apr 23, 2026
Merged

Swap spl-pod for solana-zero-copy + solana-nullable#1069
grod220 merged 3 commits intomainfrom
spl-pod-swap

Conversation

@grod220
Copy link
Copy Markdown
Member

@grod220 grod220 commented Apr 1, 2026

rebased after #1090

This PR migrates token-2022 away from spl-pod and onto solana-zero-copy + solana-nullable. On the road to making the library crates no-std.

Comment thread interface/src/lib.rs Outdated
@grod220 grod220 force-pushed the spl-pod-swap branch 6 times, most recently from d655ba0 to b68f68c Compare April 22, 2026 20:10
Comment thread clients/cli/Cargo.toml
Comment on lines +43 to +44
spl-token-metadata-interface = "1.0.0"
spl-token-group-interface = "0.7.2"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

New versions support the new solana-zero-copy/nullable types

Comment on lines +18 to +19
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
getrandom = { version = "0.2", features = ["js"] }
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Without this, make build-wasm-interface fails.

the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature

Turns out spl-pod previously activates getrandom/js transitively. So need to be explicit here now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This actually points at another issue I think -- currently spl-token-2022-interface is importing spl-confidential-transfer-proof-generation just for a conversion between error types.

I would instead just remove the error conversion and the dependency entirely in spl-token-2022-interface. The conversion is likely only needed by spl-token-client or spl-token-cli.

This can be done in a follow-up, however. To make it super clear though, can you add these lines to spl-token-2022-interface instead in the meantime?

What do you think @samkim-crypto ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, I missed this. We should definitely remove spl-confidential-transfer-proof-generation out of the interface. I can take care of this in a follow-up PR.

Comment on lines +506 to +507
#[cfg_attr(feature = "serde", serde(with = "As::<Option<DisplayFromStr>>"))]
pub authority: MaybeNull<Address>,
Copy link
Copy Markdown
Member Author

@grod220 grod220 Apr 22, 2026

Choose a reason for hiding this comment

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

the serde_with usage here is to preserve the base58 serde encoding that was built into OptionalNonZeroPubkey

Comment thread program/Cargo.toml
Comment on lines -22 to -25
arrayref = "0.3.9"
bytemuck = { version = "1.25.0", features = ["derive"] }
num-derive = "0.4"
num-traits = "0.2"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

While deps/features were being added, used cargo machete to find a collection of unused ones in this program and removed them

@grod220 grod220 marked this pull request as ready for review April 22, 2026 21:33
Copy link
Copy Markdown
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks really great overall! Thanks for handling all this tedious work 🙏

Just a couple of points

Comment thread interface/src/pod.rs Outdated
Comment thread interface/src/pod.rs Outdated
Comment thread program/Cargo.toml
no-entrypoint = []
test-sbf = []
serde-traits = ["dep:serde", "dep:serde_with", "dep:base64", "spl-pod/serde-traits", "spl-token-2022-interface/serde"]
serde-traits = ["spl-token-2022-interface/serde"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For a follow-up, how about renaming this feature to serde?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, can follow up with this

Comment on lines +18 to +19
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
getrandom = { version = "0.2", features = ["js"] }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This actually points at another issue I think -- currently spl-token-2022-interface is importing spl-confidential-transfer-proof-generation just for a conversion between error types.

I would instead just remove the error conversion and the dependency entirely in spl-token-2022-interface. The conversion is likely only needed by spl-token-client or spl-token-cli.

This can be done in a follow-up, however. To make it super clear though, can you add these lines to spl-token-2022-interface instead in the meantime?

What do you think @samkim-crypto ?

Copy link
Copy Markdown
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks good to me! Do get Sam's approval though to be sure

Copy link
Copy Markdown
Contributor

@samkim-crypto samkim-crypto left a comment

Choose a reason for hiding this comment

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

Looks good to me on my side also!

@grod220 grod220 merged commit f546c56 into main Apr 23, 2026
40 checks passed
@grod220 grod220 deleted the spl-pod-swap branch April 23, 2026 20:49
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.

3 participants