Skip to content

Commit efd0c95

Browse files
authored
program: Remove solana-program / sdk (#264)
* program: Remove solana-program / sdk #### 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! * Fixup tests to run program in bpf mode
1 parent 4662931 commit efd0c95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+352
-335
lines changed

Cargo.lock

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/rust-legacy/tests/interest_bearing_mint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,12 @@ fn process_instruction(
281281
async fn amount_conversions() {
282282
let rate_authority = Keypair::new();
283283
let mut program_test = ProgramTest::default();
284-
program_test.prefer_bpf(false);
285284
program_test.add_program(
286285
"spl_token_2022",
287286
spl_token_2022::id(),
288287
processor!(Processor::process),
289288
);
289+
program_test.prefer_bpf(false);
290290
let program_id = Pubkey::new_unique();
291291
program_test.add_program(
292292
"ui_amount_to_amount",

clients/rust-legacy/tests/scaled_ui_amount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,12 @@ fn process_instruction(
322322
async fn amount_conversions() {
323323
let authority = Keypair::new();
324324
let mut program_test = ProgramTest::default();
325-
program_test.prefer_bpf(false);
326325
program_test.add_program(
327326
"spl_token_2022",
328327
spl_token_2022::id(),
329328
processor!(Processor::process),
330329
);
330+
program_test.prefer_bpf(false);
331331
let program_id = Pubkey::new_unique();
332332
program_test.add_program(
333333
"ui_amount_to_amount",

program/Cargo.toml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,24 @@ bytemuck = { version = "1.22.0", features = ["derive"] }
2424
num-derive = "0.4"
2525
num-traits = "0.2"
2626
num_enum = "0.7.3"
27-
solana-program = "2.2.1"
27+
solana-account-info = "2.2.1"
28+
solana-clock = "2.2.1"
29+
solana-cpi = "2.2.1"
30+
solana-decode-error = "2.2.1"
31+
solana-instruction = "2.2.1"
32+
solana-msg = "2.2.1"
33+
solana-native-token = "2.2.1"
34+
solana-program-entrypoint = "2.2.1"
35+
solana-program-error = "2.2.1"
36+
solana-program-memory = "2.2.1"
37+
solana-program-option = "2.2.1"
38+
solana-program-pack = "2.2.1"
39+
solana-pubkey = "2.2.1"
40+
solana-rent = "2.2.1"
41+
solana-sdk-ids = "2.2.1"
2842
solana-security-txt = "1.1.1"
43+
solana-sysvar = "2.2.1"
44+
solana-system-interface = "1.0.0"
2945
solana-zk-sdk = "2.2.0"
3046
spl-elgamal-registry = { version = "0.1.1", path = "../confidential-transfer/elgamal-registry", features = ["no-entrypoint"] }
3147
spl-memo = { version = "6.0", features = ["no-entrypoint"] }
@@ -49,8 +65,13 @@ spl-token-confidential-transfer-proof-generation = { version = "0.3.0", path = "
4965
lazy_static = "1.5.0"
5066
proptest = "1.6"
5167
serial_test = "3.2.0"
68+
solana-account = "2.2.1"
69+
solana-hash = "2.2.1"
70+
solana-keypair = "2.2.1"
5271
solana-program-test = "2.2.0"
53-
solana-sdk = "2.2.1"
72+
solana-signer = "2.2.1"
73+
solana-transaction = "2.2.1"
74+
solana-transaction-error = "2.2.1"
5475
spl-tlv-account-resolution = { version = "0.9.0" }
5576
serde_json = "1.0.140"
5677
test-case = "3.3.1"

program/src/entrypoint.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
33
use {
44
crate::{error::TokenError, processor::Processor},
5-
solana_program::{
6-
account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
7-
pubkey::Pubkey,
8-
},
5+
solana_account_info::AccountInfo,
6+
solana_program_error::{PrintProgramError, ProgramResult},
7+
solana_pubkey::Pubkey,
98
solana_security_txt::security_txt,
109
};
1110

12-
solana_program::entrypoint!(process_instruction);
11+
solana_program_entrypoint::entrypoint!(process_instruction);
1312
fn process_instruction(
1413
program_id: &Pubkey,
1514
accounts: &[AccountInfo],

program/src/error.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
use spl_token_confidential_transfer_proof_generation::errors::TokenProofGenerationError;
55
use {
66
num_derive::FromPrimitive,
7-
solana_program::{
8-
decode_error::DecodeError,
9-
msg,
10-
program_error::{PrintProgramError, ProgramError},
11-
},
7+
solana_decode_error::DecodeError,
8+
solana_msg::msg,
9+
solana_program_error::{PrintProgramError, ProgramError},
1210
spl_token_confidential_transfer_proof_extraction::errors::TokenProofExtractionError,
1311
thiserror::Error,
1412
};

program/src/extension/confidential_mint_burn/instruction.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ use {
1313
},
1414
bytemuck::{Pod, Zeroable},
1515
num_enum::{IntoPrimitive, TryFromPrimitive},
16-
solana_program::{
17-
instruction::{AccountMeta, Instruction},
18-
program_error::ProgramError,
19-
pubkey::Pubkey,
20-
},
16+
solana_instruction::{AccountMeta, Instruction},
17+
solana_program_error::ProgramError,
18+
solana_pubkey::Pubkey,
2119
solana_zk_sdk::encryption::pod::{
2220
auth_encryption::PodAeCiphertext,
2321
elgamal::{PodElGamalCiphertext, PodElGamalPubkey},

program/src/extension/confidential_mint_burn/processor.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ use {
2222
pod::{PodAccount, PodMint},
2323
processor::Processor,
2424
},
25-
solana_program::{
26-
account_info::{next_account_info, AccountInfo},
27-
entrypoint::ProgramResult,
28-
msg,
29-
program_error::ProgramError,
30-
pubkey::Pubkey,
31-
},
25+
solana_account_info::{next_account_info, AccountInfo},
26+
solana_msg::msg,
27+
solana_program_error::{ProgramError, ProgramResult},
28+
solana_pubkey::Pubkey,
3229
solana_zk_sdk::{
3330
encryption::pod::{
3431
auth_encryption::PodAeCiphertext,

program/src/extension/confidential_mint_burn/verify_proof.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
use crate::error::TokenError;
22
#[cfg(feature = "zk-ops")]
33
use {
4-
solana_program::{
5-
account_info::{next_account_info, AccountInfo},
6-
program_error::ProgramError,
7-
},
4+
solana_account_info::{next_account_info, AccountInfo},
5+
solana_program_error::ProgramError,
86
solana_zk_sdk::zk_elgamal_proof_program::proof_data::{
97
BatchedGroupedCiphertext3HandlesValidityProofContext,
108
BatchedGroupedCiphertext3HandlesValidityProofData, BatchedRangeProofContext,

program/src/extension/confidential_transfer/instruction.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ use {
1414
},
1515
bytemuck::Zeroable,
1616
num_enum::{IntoPrimitive, TryFromPrimitive},
17-
solana_program::{
18-
instruction::{AccountMeta, Instruction},
19-
program_error::ProgramError,
20-
pubkey::Pubkey,
21-
system_program, sysvar,
22-
},
17+
solana_instruction::{AccountMeta, Instruction},
18+
solana_program_error::ProgramError,
19+
solana_pubkey::Pubkey,
20+
solana_sdk_ids::{system_program, sysvar},
2321
spl_token_confidential_transfer_proof_extraction::instruction::{ProofData, ProofLocation},
2422
};
2523

0 commit comments

Comments
 (0)