Skip to content

Commit 76fc336

Browse files
authored
deps: Update Solana v2.3.4 and rust toolchain (#76)
* deps: Update Solana v2.3.4 and rust toolchain #### Problem The v2.3 Solana crates are out, and the toolchain on this repo is a bit old. #### Summary of changes Bump the Solana version, crates, and rust toolchain. * Use local solana-stake-interface
1 parent e59c123 commit 76fc336

File tree

9 files changed

+1208
-767
lines changed

9 files changed

+1208
-767
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ license = "Apache-2.0"
1414
edition = "2021"
1515

1616
[workspace.metadata.cli]
17-
solana = "2.2.0"
17+
solana = "2.3.4"
1818

1919
[workspace.lints.rust.unexpected_cfgs]
2020
level = "warn"
@@ -24,7 +24,10 @@ check-cfg = [
2424
]
2525

2626
[workspace.metadata.toolchains]
27-
build = "1.84.1"
28-
format = "nightly-2024-11-22"
29-
lint = "nightly-2024-11-22"
30-
test = "nightly-2024-11-22"
27+
build = "1.86.0"
28+
format = "nightly-2025-02-16"
29+
lint = "nightly-2025-02-16"
30+
test = "nightly-2025-02-16"
31+
32+
[patch.crates-io]
33+
solana-stake-interface = { path = "interface" }

clients/rust/Cargo.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ test-sbf = []
1212
serde = ["dep:serde", "dep:serde_with"]
1313

1414
[dependencies]
15-
borsh = "^0.10"
16-
num-derive = "^0.3"
17-
num-traits = "^0.2"
18-
serde = { version = "^1.0", features = ["derive"], optional = true }
19-
serde_with = { version = "^3.0", optional = true }
15+
borsh = "0.10"
16+
num-derive = "0.3"
17+
num-traits = "0.2"
18+
serde = { version = "1.0", features = ["derive"], optional = true }
19+
serde_with = { version = "3.0", optional = true }
2020
solana-program = "2.2.1"
21-
thiserror = "^1.0"
21+
thiserror = "1.0"
2222

2323
[dev-dependencies]
2424
assert_matches = "1.5.0"
25-
solana-program-test = "2.2.0"
2625
solana-sdk = "2.2.1"

interface/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "solana-stake-interface"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
description = "Instructions and constructors for the Stake program"
55
readme = "README.md"
66
authors = { workspace = true }
@@ -29,7 +29,7 @@ solana-frozen-abi-macro = { version = "2.2.1", features = ["frozen-abi"], option
2929
solana-instruction = "2.2.1"
3030
solana-program-error = "2.2.1"
3131
solana-pubkey = { version = "2.2.1", default-features = false }
32-
solana-system-interface = "^1.0"
32+
solana-system-interface = "1.0.0"
3333
solana-sysvar-id = "2.2.1"
3434

3535
[dev-dependencies]

program/Cargo.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ thiserror = "1.0.63"
2424
[dev-dependencies]
2525
assert_matches = "1.5.0"
2626
arbitrary = { version = "1.4.1", features = ["derive"] }
27-
mollusk-svm = { version = "0.1.0", features = ["all-builtins"] }
27+
mollusk-svm = { version = "0.4.0", features = ["all-builtins"] }
2828
proptest = "1.6.0"
2929
solana-account = { version = "2.2.1", features = ["bincode"] }
30+
solana-config-interface = { version = "1", features = ["serde"] }
31+
solana-feature-set = "2.2.1"
3032
solana-logger = "2.2.1"
31-
solana-program-test = "2.2.0"
33+
solana-program-test = "2.3.4"
3234
solana-program-runtime = "2.2.0"
33-
solana-config-program = "2.2.0"
35+
solana-stake-interface = { path = "../interface", features = ["bincode"] }
36+
solana-system-interface = { version = "1", features = ["bincode"] }
3437
solana-vote-program = "2.2.0"
3538
solana-sdk = "2.2.1"
36-
solana-feature-set = "2.2.1"
39+
solana-sdk-ids = "2.2.1"
40+
solana-sysvar = { version = "2.2.1", features = ["bincode"] }
3741
rand = "0.8.5"
3842
test-case = "3.3.1"
3943

program/tests/interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use {
1717
},
1818
},
1919
stake_history::StakeHistoryEntry,
20-
system_program,
2120
sysvar::{
2221
clock::Clock, epoch_rewards::EpochRewards, epoch_schedule::EpochSchedule, rent::Rent,
2322
stake_history::StakeHistory, SysvarId,
@@ -27,6 +26,7 @@ use {
2726
state::{VoteState, VoteStateVersions},
2827
},
2928
},
29+
solana_sdk_ids::system_program,
3030
solana_stake_program::{get_minimum_delegation, id},
3131
std::{
3232
collections::{HashMap, HashSet},

program/tests/program_test.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,22 @@ use {
1010
pubkey::Pubkey,
1111
signature::{Keypair, Signer},
1212
signers::Signers,
13-
stake::{
14-
self,
15-
instruction::{self as ixn, LockupArgs, StakeError},
16-
state::{Authorized, Delegation, Lockup, Meta, Stake, StakeAuthorize, StakeStateV2},
17-
},
18-
system_instruction, system_program,
19-
sysvar::{clock::Clock, stake_history::StakeHistory},
2013
transaction::{Transaction, TransactionError},
2114
vote::{
2215
instruction as vote_instruction,
2316
state::{VoteInit, VoteState, VoteStateVersions},
2417
},
2518
},
26-
solana_stake_program::id,
19+
solana_sdk_ids::system_program,
20+
solana_stake_interface::{
21+
error::StakeError,
22+
instruction::{self as ixn, LockupArgs},
23+
program::id,
24+
stake_history::StakeHistory,
25+
state::{Authorized, Delegation, Lockup, Meta, Stake, StakeAuthorize, StakeStateV2},
26+
},
27+
solana_system_interface::instruction as system_instruction,
28+
solana_sysvar::clock::Clock,
2729
test_case::{test_case, test_matrix},
2830
};
2931

@@ -186,7 +188,7 @@ pub async fn get_stake_account(
186188

187189
pub async fn get_stake_account_rent(banks_client: &mut BanksClient) -> u64 {
188190
let rent = banks_client.get_rent().await.unwrap();
189-
rent.minimum_balance(std::mem::size_of::<stake::state::StakeStateV2>())
191+
rent.minimum_balance(std::mem::size_of::<StakeStateV2>())
190192
}
191193

192194
pub async fn get_effective_stake(banks_client: &mut BanksClient, pubkey: &Pubkey) -> u64 {
@@ -206,7 +208,7 @@ pub async fn get_effective_stake(banks_client: &mut BanksClient, pubkey: &Pubkey
206208

207209
async fn get_minimum_delegation(context: &mut ProgramTestContext) -> u64 {
208210
let transaction = Transaction::new_signed_with_payer(
209-
&[stake::instruction::get_minimum_delegation()],
211+
&[ixn::get_minimum_delegation()],
210212
Some(&context.payer.pubkey()),
211213
&[&context.payer],
212214
context.last_blockhash,
@@ -254,10 +256,10 @@ pub async fn create_independent_stake_account_with_lockup(
254256
&context.payer.pubkey(),
255257
&stake.pubkey(),
256258
lamports,
257-
std::mem::size_of::<stake::state::StakeStateV2>() as u64,
259+
std::mem::size_of::<StakeStateV2>() as u64,
258260
&id(),
259261
),
260-
stake::instruction::initialize(&stake.pubkey(), authorized, lockup),
262+
ixn::initialize(&stake.pubkey(), authorized, lockup),
261263
];
262264

263265
let transaction = Transaction::new_signed_with_payer(

program/tests/stake_instruction.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use {
2828
MINIMUM_DELINQUENT_EPOCHS_FOR_DEACTIVATION,
2929
},
3030
stake_history::{Epoch, StakeHistoryEntry},
31-
system_program,
3231
sysvar::{
3332
clock::{self, Clock},
3433
epoch_rewards::{self, EpochRewards},
@@ -38,6 +37,7 @@ use {
3837
stake_history::{self, StakeHistory},
3938
},
4039
},
40+
solana_sdk_ids::system_program,
4141
solana_stake_program::{get_minimum_delegation, id},
4242
solana_vote_program::{
4343
self,
@@ -308,13 +308,21 @@ fn create_stake_history_from_delegations(
308308
mod config {
309309
#[allow(deprecated)]
310310
use {
311-
solana_config_program::create_config_account,
312-
solana_sdk::{account::AccountSharedData, stake::config::Config},
311+
solana_account::{Account, AccountSharedData},
312+
solana_config_interface::state::ConfigKeys,
313+
solana_sdk::stake::config::Config,
313314
};
314315

315316
#[allow(deprecated)]
316317
pub fn create_account(lamports: u64, config: &Config) -> AccountSharedData {
317-
create_config_account(vec![], config, lamports)
318+
let mut data = bincode::serialize(&ConfigKeys { keys: vec![] }).unwrap();
319+
data.extend_from_slice(&bincode::serialize(config).unwrap());
320+
AccountSharedData::from(Account {
321+
lamports,
322+
data,
323+
owner: solana_config_interface::id(),
324+
..Account::default()
325+
})
318326
}
319327
}
320328

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "1.84.1"
2+
channel = "1.86.0"

0 commit comments

Comments
 (0)