Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,353 changes: 611 additions & 1,742 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ check-cfg = [
]

[workspace.metadata.cli]
solana = "4.0.3"
solana = "4.2.2"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUST_TOOLCHAIN_NIGHTLY = nightly-2026-01-22
RUST_TOOLCHAIN_NIGHTLY = nightly-2026-04-16
SOLANA_CLI_VERSION = $(shell toml get ./Cargo.toml workspace.metadata.cli.solana)

nightly = +${RUST_TOOLCHAIN_NIGHTLY}
Expand Down Expand Up @@ -91,7 +91,7 @@ format-rust:
cargo $(nightly) fmt --all $(ARGS)

build-sbf-%:
cargo build-sbf --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
cargo build-sbf --arch v3 --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)

build-wasm-%:
cargo build --target wasm32-unknown-unknown --manifest-path $(call make-path,$*)/Cargo.toml --all-features $(ARGS)
Expand Down
16 changes: 8 additions & 8 deletions clients/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ edition = "2021"
[dependencies]
clap = "2.33.3"
serde = "1.0.219"
solana-account-decoder = "3.0.0"
solana-clap-utils = "3.0.0"
solana-cli-config = "3.0.0"
solana-cli-output = { version = "3.0.0", features = ["agave-unstable-api"] }
solana-client = "3.0.0"
solana-account-decoder = "4.2.2"
solana-clap-utils = "4.2.2"
solana-cli-config = "4.2.2"
solana-cli-output = { version = "4.2.2", features = ["agave-unstable-api"] }
solana-client = "4.2.2"
solana-compute-budget-interface = "3.0.0"
solana-commitment-config = "3.1.1"
solana-logger = "3.0.0"
solana-message = "3.0.0"
solana-message = "4.4.0"
solana-program = "4.0.0"
solana-remote-wallet = "3.0.0"
solana-sdk = "3.0.0"
solana-remote-wallet = { version = "4.2.2", features = ["agave-unstable-api"] }
solana-sdk = "4.0.0"
solana-stake-interface = { version = "4", features = ["bincode"] }
solana-system-interface = { version = "3", features = ["bincode"] }
spl-associated-token-account-interface = "2.0.0"
Expand Down
12 changes: 8 additions & 4 deletions clients/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use {
Arg, ArgGroup, ArgMatches, SubCommand,
},
solana_clap_utils::{
compute_unit_price::{compute_unit_price_arg, COMPUTE_UNIT_PRICE_ARG},
compute_budget::{compute_unit_price_arg, COMPUTE_UNIT_PRICE_ARG},
input_parsers::{keypair_of, pubkey_of},
input_validators::{
is_amount, is_keypair_or_ask_keyword, is_parsable, is_pubkey, is_url,
Expand Down Expand Up @@ -58,7 +58,12 @@ use {
spl_token_2022_interface::{
check_spl_token_program_account, extension::StateWithExtensions, state::Mint,
},
std::{cmp::Ordering, num::NonZeroU32, process::exit, rc::Rc},
std::{
cmp::{Ordering, Reverse},
num::NonZeroU32,
process::exit,
rc::Rc,
},
};

pub(crate) struct Config {
Expand Down Expand Up @@ -1459,8 +1464,7 @@ fn command_list(

match sort_by {
Some("stake") => {
cli_stake_pool_stake_account_infos
.sort_by(|a, b| b.validator_lamports.cmp(&a.validator_lamports));
cli_stake_pool_stake_account_infos.sort_by_key(|b| Reverse(b.validator_lamports));
}
Some("update-epoch") => {
cli_stake_pool_stake_account_infos.sort_by(|a, b| {
Expand Down
2 changes: 1 addition & 1 deletion clients/py/stake/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
LAMPORTS_PER_SOL: int = 1_000_000_000
"""Number of lamports per SOL"""

MINIMUM_DELEGATION: int = 1
MINIMUM_DELEGATION: int = LAMPORTS_PER_SOL
"""Minimum delegation allowed by the stake program"""
2 changes: 1 addition & 1 deletion clients/py/stake_pool/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
MINIMUM_RESERVE_LAMPORTS: int = 0
"""Minimum balance required in the stake pool reserve"""

MINIMUM_ACTIVE_STAKE: int = 1_000_000
MINIMUM_ACTIVE_STAKE: int = 1_000_000_000
"""Minimum active delegated staked required in a stake account"""

METADATA_PROGRAM_ID = Pubkey.from_string("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s")
Expand Down
6 changes: 3 additions & 3 deletions clients/py/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from stake_pool.actions import deposit_sol, create_all, add_validator_to_pool
from stake_pool.state import Fee

NUM_SLOTS_PER_EPOCH: int = 32
NUM_SLOTS_PER_EPOCH: int = 64
AIRDROP_LAMPORTS: int = 30_000_000_000


Expand Down Expand Up @@ -107,10 +107,10 @@ async def wait_for_next_epoch(async_client: AsyncClient):
current_epoch = resp.value.epoch
next_epoch = current_epoch
while current_epoch == next_epoch:
await asyncio.sleep(1.0)
await asyncio.sleep(0.3)
resp = await async_client.get_epoch_info(commitment=Confirmed)
next_epoch = resp.value.epoch
await asyncio.sleep(0.4) # wait one more block to avoid reward payout time
await asyncio.sleep(0.3) # wait one more block to avoid reward payout time

@staticmethod
async def wait_for_next_epoch_if_soon(async_client: AsyncClient):
Expand Down
7 changes: 4 additions & 3 deletions clients/py/tests/test_deposit_withdraw_stake.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ async def test_deposit_withdraw_stake(async_client, validators, payer, stake_poo
data = resp.value.data if resp.value else bytes()
stake_pool = StakePool.decode(data)
validator = next(iter(validators))
stake_amount = MINIMUM_ACTIVE_STAKE
stake_amount = MINIMUM_ACTIVE_STAKE * 3
withdraw_amount = MINIMUM_ACTIVE_STAKE
stake = Keypair()
await create_stake(async_client, payer, stake, payer.pubkey(), stake_amount)
stake = stake.pubkey()
Expand All @@ -44,9 +45,9 @@ async def test_deposit_withdraw_stake(async_client, validators, payer, stake_poo
destination_stake = Keypair()
await withdraw_stake(
async_client, payer, payer, destination_stake, stake_pool_address, validator,
payer.pubkey(), token_account, stake_amount
payer.pubkey(), token_account, withdraw_amount
)

pool_token_balance = await async_client.get_token_account_balance(token_account, Confirmed)
pool_token_balance = pool_token_balance.value.amount
assert pool_token_balance == str(stake_rent_exemption + pre_pool_token_balance)
assert pool_token_balance == str(stake_amount + stake_rent_exemption + pre_pool_token_balance - withdraw_amount)
6 changes: 3 additions & 3 deletions program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ solana-system-interface = { version = "3.2.0", features = ["bincode"] }
spl-pod = { version = "0.7.3", features = [
"borsh",
] }
spl-token-2022-interface = "3.0.1"
spl-token-2022-interface = "3.1.1"
thiserror = "2.0"
bincode = "1.3.1"

[dev-dependencies]
agave-feature-set = "4.2.0-rc"
agave-feature-set = "4.2.2"
assert_matches = "1.5.0"
proptest = "1.11"
solana-account = { version = "4.3.1", features = ["bincode"] }
solana-compute-budget-interface = "3.0.0"
solana-native-token = "3.0.0"
solana-program = "4.0.0"
solana-program-test = { version = "4.2.0-rc.1", features = ["agave-unstable-api"] }
solana-program-test = { version = "4.2.2", features = ["agave-unstable-api"] }
solana-sdk = "4.0.0"
solana-vote-interface = { version = "6.0.0", features = ["bincode"] }
spl-token-interface = "3.0.0"
Expand Down
20 changes: 9 additions & 11 deletions program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,18 +1124,16 @@ impl Processor {
&meta,
withdraw_authority_info.key,
&stake_pool.lockup,
) =>
) && stake.delegation.deactivation_epoch == Epoch::MAX =>
{
if stake.delegation.deactivation_epoch == Epoch::MAX {
Self::stake_deactivate(
transient_stake_account_info.clone(),
clock_info.clone(),
withdraw_authority_info.clone(),
stake_pool_info.key,
AUTHORITY_WITHDRAW,
stake_pool.stake_withdraw_bump_seed,
)?;
}
Self::stake_deactivate(
transient_stake_account_info.clone(),
clock_info.clone(),
withdraw_authority_info.clone(),
stake_pool_info.key,
AUTHORITY_WITHDRAW,
stake_pool.stake_withdraw_bump_seed,
)?;
}
_ => (),
}
Expand Down
6 changes: 3 additions & 3 deletions program/tests/create_pool_token_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
transaction::{Transaction, TransactionError},
},
spl_stake_pool::{
error::StakePoolError::{AlreadyInUse, SignatureMissing, WrongManager},
error::StakePoolError::{SignatureMissing, WrongManager},
instruction, MINIMUM_RESERVE_LAMPORTS,
},
test_case::test_case,
Expand Down Expand Up @@ -264,8 +264,8 @@ async fn fail_create_metadata_twice() {

match error {
TransactionError::InstructionError(_, InstructionError::Custom(error_index)) => {
let program_error = AlreadyInUse as u32;
assert_eq!(error_index, program_error);
const METAPLEX_ERROR_CODE: u32 = 199;
assert_eq!(error_index, METAPLEX_ERROR_CODE);
}
_ => panic!("Wrong error occurs while trying to create pool token metadata twice"),
}
Expand Down
Binary file modified program/tests/fixtures/mpl_token_metadata.so
Binary file not shown.
25 changes: 19 additions & 6 deletions program/tests/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,19 @@ async fn create_required_accounts(
.await
.unwrap();

let required_extensions = ExtensionType::get_required_init_account_extensions(mint_extensions);
let mut required_extensions = vec![];
for extension in mint_extensions {
match extension {
ExtensionType::NonTransferable => {
required_extensions.push(ExtensionType::NonTransferableAccount);
required_extensions.push(ExtensionType::ImmutableOwner);
}
ExtensionType::TransferFeeConfig => {
required_extensions.push(ExtensionType::TransferFeeAmount);
}
_ => {}
}
}
create_token_account(
banks_client,
payer,
Expand Down Expand Up @@ -516,9 +528,7 @@ async fn success_with_supported_extensions() {
)
.await;

let mut account_extensions =
ExtensionType::get_required_init_account_extensions(&mint_extensions);
account_extensions.push(ExtensionType::CpiGuard);
let account_extensions = [ExtensionType::TransferFeeAmount, ExtensionType::CpiGuard];
let pool_fee_account = Keypair::new();
create_token_account(
&mut banks_client,
Expand Down Expand Up @@ -565,7 +575,7 @@ async fn fail_with_unsupported_mint_extension() {
let stake_pool_accounts =
StakePoolAccounts::new_with_token_program(spl_token_2022_interface::id());

let mint_extensions = vec![ExtensionType::NonTransferable];
let mint_extensions = [ExtensionType::NonTransferable];
create_required_accounts(
&mut banks_client,
&payer,
Expand All @@ -575,7 +585,10 @@ async fn fail_with_unsupported_mint_extension() {
)
.await;

let required_extensions = ExtensionType::get_required_init_account_extensions(&mint_extensions);
let required_extensions = [
ExtensionType::NonTransferableAccount,
ExtensionType::ImmutableOwner,
];
let pool_fee_account = Keypair::new();
create_token_account(
&mut banks_client,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.93.0"
channel = "1.95.0"
Loading