Skip to content

Conversation

@samkim-crypto
Copy link
Contributor

@samkim-crypto samkim-crypto commented Oct 16, 2025

Problem

Crates like spl-token-2022-interface and spl-pod just uses the pod types in the solana-zk-sdk, but has to rely entirely on the entire crate with all of its heavy dependencies.

Summary of Changes

We want to ultimately export out the pod types into a separate solana-zk-sdk-pod crate. This crate will only rely on crates like bytemuck and have no dependencies on heavy cryptography crates.

The crates like spl-token-2022-interface and spl-pod types can depend on solana-zk-sdk-pod directly.

I was planning on breaking up the migration of pod code from the zk-sdk to the zk-sdk-pod crate in three PRs. This PR just focuses on the pod types for the encryption submodule.

On a follow-up, I will migrate the pod types for the proofs. I will then re-organize the rest of the pod types in a final follow-up.

@samkim-crypto samkim-crypto force-pushed the zk-sdk-pod branch 2 times, most recently from d60c330 to 3730ad9 Compare October 17, 2025 05:12
}
// // For proof verification, interpret pod::DecryptHandle as CompressedRistretto
// #[cfg(not(target_os = "solana"))]
// impl From<PodDecryptHandle> for CompressedRistretto {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the pod crate, we had this direct conversion from Pod* types to CompressedRistretto.

We can't really to keep this in the zk-sdk because Pod* and CompressedRistretto types are now all foreign types. We can't keep this in the zk-sdk-pod either since that would add the curve25519-dalek dependency to the crate.

I think we can remove this. Given a pod_decrypt_handle: PodDecryptHandle, downstream can run CompressedRistretto(*bytes_of(&pod_decrypt_handle)) to do this conversion itself.

/// The `AeCiphertext` type as a `Pod`.
#[derive(Clone, Copy, PartialEq, Eq)]
#[repr(transparent)]
pub struct PodAeCiphertext(pub [u8; AE_CIPHERTEXT_LEN]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code in zk-sdk-pod is mostly a copy of the original pod logic in the zk-sdk. The only main difference is that the enclosed byte array has a pub visibility while it used to have pub(crate) visibility inside the zk-sdk.

assert_eq!(expected_ae_ciphertext, computed_ae_ciphertext);
}
}
pub use solana_zk_sdk_pod::encryption::auth_encryption::*;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not clear if we should re-export the pod types here. With the new dependence on zk-sdk-pod and also with some of the audit changes, we will need to do a major release. Maybe we can just remove the re-export here?

@samkim-crypto samkim-crypto marked this pull request as ready for review October 17, 2025 08:43
@samkim-crypto samkim-crypto marked this pull request as draft October 27, 2025 08:53
@samkim-crypto samkim-crypto marked this pull request as ready for review October 28, 2025 03:45
@samkim-crypto samkim-crypto marked this pull request as draft October 28, 2025 22:53
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.

1 participant