Skip to content

Swap-out solana-zk-sdk for solana-zk-elgamal-proof-interface and solana-zk-sdk-pod#1090

Merged
samkim-crypto merged 9 commits intosolana-program:mainfrom
samkim-crypto:swap-zk-sdk
Apr 22, 2026
Merged

Swap-out solana-zk-sdk for solana-zk-elgamal-proof-interface and solana-zk-sdk-pod#1090
samkim-crypto merged 9 commits intosolana-program:mainfrom
samkim-crypto:swap-zk-sdk

Conversation

@samkim-crypto
Copy link
Copy Markdown
Contributor

@samkim-crypto samkim-crypto commented Apr 8, 2026

Summary of Changes

487e83c: I swapped out solana-zk-sdk for solana-zk-elgamal-proof-interface and solana-zk-sdk-pod in token-2022 interface and program. The solana-zk-sdk is needed in some places like proof-generation. For these places, I bumped the version to v6.0.0. This commit should be pretty straightforward and mechanical, just re-organizing the imports. The exception is replacing the OptionalNonZeroElGamalPubkey with MaybeNull<PodElGamalPubkey>.

0fb0bed: I bumped agave crates like solana-test-validator and solana-program-test to v4-beta while downgrading some of the solana-sdk dependencies to resolve some dependency conflicts. I divided this commit in smaller commits in #1106.

e814132: in 487e83c, I made a mistake in comparing MaybeNull ElGamalPubkeys, so I fixed it here.

76e9728: Addressed #1116 (comment).

Copy link
Copy Markdown
Member

@grod220 grod220 left a comment

Choose a reason for hiding this comment

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

Thanks for this work! Unraveling dependencies can be tricky. Just have some cleanup comments.

Comment thread clients/cli/Cargo.toml Outdated
Comment on lines +33 to +34
solana-zk-sdk = "6.0.0"
solana-zk-sdk-pod = "0.1.1"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you put these in alphabetical order?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in cfea17c.

Comment thread clients/cli/Cargo.toml

[dev-dependencies]
solana-nonce = "3.2.0"
solana-nonce = "3.1.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Think we can keep v3.2 here?

Copy link
Copy Markdown
Contributor Author

@samkim-crypto samkim-crypto Apr 21, 2026

Choose a reason for hiding this comment

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

I actually can't get this to work due to wincode.

  • solana-nonce v3.2 requires solana-hash v4.3, which requires wincode` v0.5.3
  • agave crates like solana-ledger v4.0.0 requires wincode v0.4

This causes dependency conflict in the token-cli.

The crate solana-nonce v3.1 requires solana-hash v4.2, which requires wincode v0.4, so I can make this work.

Comment thread clients/rust-legacy/src/token.rs Outdated
Comment on lines +70 to +85
// solana_zk_sdk::{
// encryption::{
// auth_encryption::AeKey,
// elgamal::{ElGamalCiphertext, ElGamalKeypair, ElGamalPubkey, ElGamalSecretKey},
// pod::{
// auth_encryption::PodAeCiphertext,
// elgamal::{PodElGamalCiphertext, PodElGamalPubkey},
// },
// },
// zk_elgamal_proof_program::{
// self,
// instruction::{close_context_state, ContextStateInfo},
// proof_data::*,
// state::ProofContextState,
// },
// },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: remove

Copy link
Copy Markdown
Contributor Author

@samkim-crypto samkim-crypto Apr 20, 2026

Choose a reason for hiding this comment

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

Sorry, this should have removed prior to asking for review 🙏

Comment thread clients/rust-legacy/Cargo.toml Outdated
solana-address = "2.6.0"
solana-banks-client = { version = "3.0.0", optional = true }
solana-banks-interface = { version = "3.0.0", optional = true }
solana-address = "2.5.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: v2.6 here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I downgrade solana-address for the same reason as #1090 (comment):

  • solana-address v2.6.0 requires wincode v0.5
  • solana-address v2.5.0 requires wincode v0.4

But unlike with solana-hash, it doesn't create conflicts in the token-cli (though we do get two versions of wincode in Cargo.lock), so I think we can keep v2.6.0 here.

Fixed in 91b1fa3.

solana-cli-output = { version = "3.1.0", features = ["agave-unstable-api"], optional = true }
solana-hash = "4.3.0"
solana-cli-output = { version = "4.0.0-beta.7", features = ["agave-unstable-api"], optional = true }
solana-hash = "4.2.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe some of these version regressions are rebase artifacts? Perhaps you can do another pass to catch these in the rest of the PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I couldn't get this to work with solana-hash v4.3 due to the same reason as #1090 (comment).

[package]
name = "spl-token-confidential-transfer-proof-extraction"
version = "0.5.1"
version = "0.6.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't bump these ourselves right? Think the publish github action is responsible for that. See a few examples in this PR of this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did this to actually resolve version conflicts. Some of the agave crates (e.g. solana-account-decoder) depend on spl-token-2022-interface v2.1.0, which depends on the spl-token-confidential-transfer-proof-extraction crate v0.5.1.

So if I leave the local crate version to v0.5.1, then cargo will try to be efficient and just use my local spl-token-confidential-transfer-proof-extraction version, which is not compatible with solana-account-decoder.

If I bump the local crate version to v0.6.0, then cargo has no choice and will maintain two versions of ``spl-token-confidential-transfer-proof-extractionin theCargo.lock` file, the local version with v0.6.0 and the crate.io v5.1, so things will compile.

I think the publish script will not bump Cargo.toml if it is already set to be correctly (or we can also manually specify the version in the CI publish UI), so I think this should be fine, though let me know if I am missing something.

Comment on lines +88 to +95
// test_transfer_with_fee_proof_validity(65535, 65535, 5, 10);
// test_transfer_with_fee_proof_validity(65535, 65535, 5, 1);

test_transfer_with_fee_proof_validity(65536, 65536, 5, 10);
test_transfer_with_fee_proof_validity(65536, 65536, 5, 1);

test_transfer_with_fee_proof_validity(281474976710655, 281474976710655, 5, 10); // 2^48 - 1
test_transfer_with_fee_proof_validity(281474976710655, 281474976710655, 5, 1);
// test_transfer_with_fee_proof_validity(65536, 65536, 5, 10);
// test_transfer_with_fee_proof_validity(65536, 65536, 5, 1);
//
// test_transfer_with_fee_proof_validity(281474976710655, 281474976710655, 5, 10); // 2^48 - 1
// test_transfer_with_fee_proof_validity(281474976710655, 281474976710655, 5, 1);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably can re-enable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah sorry, I forgot about addressing this before asking for review 🙏 . This requires a small in on the zk-sdk side, so I will address this once solana-program/zk-elgamal-proof#377 is merged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, this is fixed in e897b95.

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 great overall! I agree with all of Gabe's comments

@samkim-crypto
Copy link
Copy Markdown
Contributor Author

Thanks for the patience. This PR should be ready for another set of reviews! 🙏

Copy link
Copy Markdown
Member

@grod220 grod220 left a comment

Choose a reason for hiding this comment

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

Thanks for those changes! Definitely some tricky dep combinations. Let's get Jon's eyes on this too though.

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! We'll just need to be careful when doing the publishes on the confidential-transfer crates

@samkim-crypto samkim-crypto merged commit fc61b7f into solana-program:main Apr 22, 2026
40 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.

3 participants