Skip to content

program: Remove solana-program / sdk #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 5, 2025

Conversation

joncinque
Copy link
Contributor

Problem

The token-2022 program still uses solana-program and solana-sdk, which are heavy dependencies.

Summary of changes

The component crates exist to do everything needed in token-2022, so we can remove solana-program usage entirely.

NOTE: since some spl-token-2022's dependencies still use solana-program, there is no huge gain just yet. That will happen when we upgrade the upstream dependencies and then upgrade token-2022 to use those.

Also NOTE: this is a breaking change since we've removed the re-export of the sdk types. Considering we're now respecting semver, this shouldn't be a problem, but we did add a version of re-exports in solana-program/token#26, so maybe we should do the same thing here. Let me know!

#### Problem

The token-2022 program still uses solana-program and solana-sdk, which
are heavy dependencies.

#### Summary of changes

The component crates exist to do everything needed in token-2022, so we
can remove solana-program usage entirely.

NOTE: since some spl-token-2022's dependencies still use solana-program,
there is no huge gain just yet. That will happen when we upgrade the
upstream dependencies and then upgrade token-2022 to use those.

Also NOTE: this is a breaking change since we've removed the re-export
of the sdk types. Considering we're now respecting semver, this
shouldn't be a problem, but we did add a version of re-exports in
solana-program/token#26, so maybe we should do
the same thing here. Let me know!
@joncinque joncinque requested a review from samkim-crypto March 4, 2025 12:27
Copy link
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.

Okay, went over a couple places where the previously imported functions are hard-coded and everything seems fine to me. Just one clarifying question for my own understanding.

@@ -281,12 +281,12 @@ fn process_instruction(
async fn amount_conversions() {
let rate_authority = Keypair::new();
let mut program_test = ProgramTest::default();
program_test.prefer_bpf(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

So what is the reason why the tests fail if we don't prefer bpf here?

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 prefer_bpf(false) mode of solana-program-test uses solana_program::program_stubs to implement the syscalls, which no longer works when not using solana-program. So to fix the issue, we force token-2022 to run in the VM rather than the "fake native" mode of solana-program-test.

@joncinque joncinque merged commit efd0c95 into solana-program:main Mar 5, 2025
19 of 20 checks passed
@joncinque joncinque deleted the nospprog branch March 5, 2025 12:06
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