Skip to content

Commit

Permalink
Update everything to use non-deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque committed Sep 20, 2023
1 parent 9cec7a1 commit 84ae880
Show file tree
Hide file tree
Showing 50 changed files with 62 additions and 52 deletions.
2 changes: 1 addition & 1 deletion feature-proposal/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ mod tests {
fn test_get_packed_len() {
assert_eq!(
FeatureProposalInstruction::get_packed_len(),
solana_program::borsh::get_packed_len::<FeatureProposalInstruction>()
solana_program::borsh0_10::get_packed_len::<FeatureProposalInstruction>()
)
}

Expand Down
2 changes: 1 addition & 1 deletion feature-proposal/program/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mod tests {
fn test_get_packed_len() {
assert_eq!(
FeatureProposal::get_packed_len(),
solana_program::borsh::get_packed_len::<FeatureProposal>()
solana_program::borsh0_10::get_packed_len::<FeatureProposal>()
);
}

Expand Down
2 changes: 1 addition & 1 deletion governance/program/src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use process_update_program_metadata::*;
use process_withdraw_governing_tokens::*;

use solana_program::{
account_info::AccountInfo, borsh::try_from_slice_unchecked, entrypoint::ProgramResult, msg,
account_info::AccountInfo, borsh0_10::try_from_slice_unchecked, entrypoint::ProgramResult, msg,
program_error::ProgramError, pubkey::Pubkey,
};

Expand Down
2 changes: 1 addition & 1 deletion governance/program/src/state/realm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ pub fn assert_valid_realm_config_args(
mod test {

use crate::instruction::GovernanceInstruction;
use solana_program::borsh::try_from_slice_unchecked;
use solana_program::borsh0_10::try_from_slice_unchecked;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion governance/program/src/state/token_owner_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ pub fn get_token_owner_record_data_for_proposal_owner(

#[cfg(test)]
mod test {
use solana_program::{borsh::get_packed_len, stake_history::Epoch};
use solana_program::{borsh0_10::get_packed_len, stake_history::Epoch};

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion governance/test-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::borrow::Borrow;
use borsh::{BorshDeserialize, BorshSerialize};
use cookies::{TokenAccountCookie, WalletCookie};
use solana_program::{
borsh::try_from_slice_unchecked, clock::Clock, instruction::Instruction,
borsh0_10::try_from_slice_unchecked, clock::Clock, instruction::Instruction,
program_error::ProgramError, program_pack::Pack, pubkey::Pubkey, rent::Rent,
stake_history::Epoch, system_instruction, system_program, sysvar,
};
Expand Down
2 changes: 1 addition & 1 deletion governance/tools/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
account_info::AccountInfo,
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
msg,
program::invoke,
program::invoke_signed,
Expand Down
2 changes: 1 addition & 1 deletion libraries/type-length-value-derive-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
pub mod test {
use {
borsh::{BorshDeserialize, BorshSerialize},
solana_program::borsh::{get_instance_packed_len, try_from_slice_unchecked},
solana_program::borsh0_10::{get_instance_packed_len, try_from_slice_unchecked},
spl_discriminator::SplDiscriminate,
spl_type_length_value::{variable_len_pack::VariableLenPack, SplBorshVariableLenPack},
};
Expand Down
4 changes: 2 additions & 2 deletions libraries/type-length-value/derive/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ impl From<&SplBorshVariableLenPackBuilder> for TokenStream {
}

fn unpack_from_slice(src: &[u8]) -> Result<Self, solana_program::program_error::ProgramError> {
solana_program::borsh::try_from_slice_unchecked(src).map_err(Into::into)
solana_program::borsh0_10::try_from_slice_unchecked(src).map_err(Into::into)
}

fn get_packed_len(&self) -> Result<usize, solana_program::program_error::ProgramError> {
solana_program::borsh::get_instance_packed_len(self).map_err(Into::into)
solana_program::borsh0_10::get_instance_packed_len(self).map_err(Into::into)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion record/program/tests/functional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use {
borsh::BorshSerialize,
solana_program::{
borsh::get_packed_len,
borsh0_10::get_packed_len,
instruction::{AccountMeta, Instruction, InstructionError},
pubkey::Pubkey,
rent::Rent,
Expand Down
2 changes: 1 addition & 1 deletion single-pool/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
rpc_filter::{Memcmp, RpcFilterType},
},
solana_sdk::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
pubkey::Pubkey,
signature::Signature,
signature::{Keypair, Signer},
Expand Down
1 change: 1 addition & 0 deletions single-pool/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ pub fn initialize_pool(program_id: &Pubkey, vote_account_address: &Pubkey) -> In
AccountMeta::new_readonly(sysvar::rent::id(), false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(sysvar::stake_history::id(), false),
#[allow(deprecated)]
AccountMeta::new_readonly(stake::config::id(), false),
AccountMeta::new_readonly(system_program::id(), false),
AccountMeta::new_readonly(spl_token::id(), false),
Expand Down
2 changes: 1 addition & 1 deletion single-pool/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use {
borsh::BorshDeserialize,
solana_program::{
account_info::{next_account_info, AccountInfo},
borsh::{get_packed_len, try_from_slice_unchecked},
borsh0_10::{get_packed_len, try_from_slice_unchecked},
entrypoint::ProgramResult,
msg,
native_token::LAMPORTS_PER_SOL,
Expand Down
4 changes: 2 additions & 2 deletions single-pool/program/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use {
crate::{error::SinglePoolError, find_pool_address},
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
solana_program::{
account_info::AccountInfo, borsh::try_from_slice_unchecked, program_error::ProgramError,
pubkey::Pubkey,
account_info::AccountInfo, borsh0_10::try_from_slice_unchecked,
program_error::ProgramError, pubkey::Pubkey,
},
};

Expand Down
2 changes: 1 addition & 1 deletion single-pool/program/tests/helpers/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use {
borsh::BorshDeserialize,
solana_program_test::BanksClient,
solana_sdk::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
hash::Hash,
program_pack::Pack,
pubkey::Pubkey,
Expand Down
4 changes: 3 additions & 1 deletion stake-pool/cli/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ use {
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig},
rpc_filter::{Memcmp, RpcFilterType},
},
solana_program::{borsh::try_from_slice_unchecked, program_pack::Pack, pubkey::Pubkey, stake},
solana_program::{
borsh0_10::try_from_slice_unchecked, program_pack::Pack, pubkey::Pubkey, stake,
},
spl_stake_pool::{
find_withdraw_authority_program_address,
state::{StakePool, ValidatorList},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use {
solana_cli_output::OutputFormat,
solana_client::rpc_client::RpcClient,
solana_program::{
borsh::{get_instance_packed_len, get_packed_len},
borsh0_10::{get_instance_packed_len, get_packed_len},
instruction::Instruction,
program_pack::Pack,
pubkey::Pubkey,
Expand Down
4 changes: 4 additions & 0 deletions stake-pool/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ pub fn add_validator_to_pool(
AccountMeta::new_readonly(sysvar::rent::id(), false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(sysvar::stake_history::id(), false),
#[allow(deprecated)]
AccountMeta::new_readonly(stake::config::id(), false),
AccountMeta::new_readonly(system_program::id(), false),
AccountMeta::new_readonly(stake::program::id(), false),
Expand Down Expand Up @@ -859,6 +860,7 @@ pub fn increase_validator_stake(
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
AccountMeta::new_readonly(sysvar::stake_history::id(), false),
#[allow(deprecated)]
AccountMeta::new_readonly(stake::config::id(), false),
AccountMeta::new_readonly(system_program::id(), false),
AccountMeta::new_readonly(stake::program::id(), false),
Expand Down Expand Up @@ -904,6 +906,7 @@ pub fn increase_additional_validator_stake(
AccountMeta::new_readonly(*validator, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(sysvar::stake_history::id(), false),
#[allow(deprecated)]
AccountMeta::new_readonly(stake::config::id(), false),
AccountMeta::new_readonly(system_program::id(), false),
AccountMeta::new_readonly(stake::program::id(), false),
Expand Down Expand Up @@ -954,6 +957,7 @@ pub fn redelegate(
AccountMeta::new_readonly(*validator, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(sysvar::stake_history::id(), false),
#[allow(deprecated)]
AccountMeta::new_readonly(stake::config::id(), false),
AccountMeta::new_readonly(system_program::id(), false),
AccountMeta::new_readonly(stake::program::id(), false),
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use {
num_traits::FromPrimitive,
solana_program::{
account_info::{next_account_info, AccountInfo},
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
clock::{Clock, Epoch},
decode_error::DecodeError,
entrypoint::ProgramResult,
Expand Down
4 changes: 2 additions & 2 deletions stake-pool/program/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
num_traits::{FromPrimitive, ToPrimitive},
solana_program::{
account_info::AccountInfo,
borsh::get_instance_packed_len,
borsh0_10::get_instance_packed_len,
msg,
program_error::ProgramError,
program_memory::sol_memcmp,
Expand Down Expand Up @@ -1035,7 +1035,7 @@ mod test {
super::*,
proptest::prelude::*,
solana_program::{
borsh::{get_instance_packed_len, get_packed_len, try_from_slice_unchecked},
borsh0_10::{get_packed_len, try_from_slice_unchecked},
clock::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_S_PER_SLOT, SECONDS_PER_DAY},
native_token::LAMPORTS_PER_SOL,
},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
borsh::BorshSerialize,
helpers::*,
solana_program::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
instruction::{AccountMeta, Instruction, InstructionError},
pubkey::Pubkey,
stake, sysvar,
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/deposit_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
solana_program::{instruction::InstructionError, stake},
solana_program_test::*,
solana_sdk::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
signature::{Keypair, Signer},
transaction::TransactionError,
},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/deposit_edge_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod helpers;
use {
helpers::*,
solana_program::{
borsh::try_from_slice_unchecked, instruction::InstructionError, pubkey::Pubkey, stake,
borsh0_10::try_from_slice_unchecked, instruction::InstructionError, pubkey::Pubkey, stake,
},
solana_program_test::*,
solana_sdk::{
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/deposit_sol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod helpers;
use {
helpers::*,
solana_program::{
borsh::try_from_slice_unchecked, instruction::InstructionError, pubkey::Pubkey,
borsh0_10::try_from_slice_unchecked, instruction::InstructionError, pubkey::Pubkey,
},
solana_program_test::*,
solana_sdk::{
Expand Down
4 changes: 2 additions & 2 deletions stake-pool/program/tests/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use {
borsh::{BorshDeserialize, BorshSerialize},
solana_program::{
borsh::{get_instance_packed_len, get_packed_len, try_from_slice_unchecked},
borsh0_10::{get_instance_packed_len, get_packed_len, try_from_slice_unchecked},
hash::Hash,
instruction::Instruction,
program_option::COption,
Expand Down Expand Up @@ -2377,7 +2377,7 @@ pub fn add_validator_stake_account(
stake: stake_amount,
activation_epoch: FIRST_NORMAL_EPOCH,
deactivation_epoch: u64::MAX,
warmup_cooldown_rate: 0.25, // default
..Default::default()
},
credits_observed: 0,
};
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/huge_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod helpers;

use {
helpers::*,
solana_program::{borsh::try_from_slice_unchecked, pubkey::Pubkey, stake},
solana_program::{borsh0_10::try_from_slice_unchecked, pubkey::Pubkey, stake},
solana_program_test::*,
solana_sdk::{
native_token::LAMPORTS_PER_SOL,
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
borsh::BorshSerialize,
helpers::*,
solana_program::{
borsh::{get_instance_packed_len, get_packed_len, try_from_slice_unchecked},
borsh0_10::{get_instance_packed_len, get_packed_len, try_from_slice_unchecked},
hash::Hash,
instruction::{AccountMeta, Instruction},
program_pack::Pack,
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/set_deposit_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
helpers::*,
solana_program_test::*,
solana_sdk::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
instruction::InstructionError,
signature::{Keypair, Signer},
transaction::{Transaction, TransactionError},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/set_epoch_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
helpers::*,
solana_program_test::*,
solana_sdk::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
instruction::InstructionError,
signature::{Keypair, Signer},
transaction::{Transaction, TransactionError},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/set_funding_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
borsh::BorshSerialize,
helpers::*,
solana_program::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
hash::Hash,
instruction::{AccountMeta, Instruction},
},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/set_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
borsh::BorshSerialize,
helpers::*,
solana_program::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
hash::Hash,
instruction::{AccountMeta, Instruction},
},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/set_preferred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
solana_program::hash::Hash,
solana_program_test::*,
solana_sdk::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
instruction::InstructionError,
pubkey::Pubkey,
signature::{Keypair, Signer},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/set_referral_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
helpers::*,
solana_program_test::*,
solana_sdk::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
instruction::InstructionError,
signature::{Keypair, Signer},
transaction::{Transaction, TransactionError},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/set_staker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
borsh::BorshSerialize,
helpers::*,
solana_program::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
hash::Hash,
instruction::{AccountMeta, Instruction},
},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/set_withdrawal_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
helpers::*,
solana_program_test::*,
solana_sdk::{
borsh::try_from_slice_unchecked,
borsh0_10::try_from_slice_unchecked,
instruction::InstructionError,
signature::{Keypair, Signer},
transaction::{Transaction, TransactionError},
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/update_stake_pool_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod helpers;
use {
helpers::*,
solana_program::{
borsh::try_from_slice_unchecked, instruction::InstructionError, pubkey::Pubkey,
borsh0_10::try_from_slice_unchecked, instruction::InstructionError, pubkey::Pubkey,
},
solana_program_test::*,
solana_sdk::{
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/program/tests/update_validator_list_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod helpers;

use {
helpers::*,
solana_program::{borsh::try_from_slice_unchecked, program_pack::Pack, pubkey::Pubkey},
solana_program::{borsh0_10::try_from_slice_unchecked, program_pack::Pack, pubkey::Pubkey},
solana_program_test::*,
solana_sdk::{hash::Hash, signature::Signer, stake::state::StakeState},
spl_stake_pool::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod helpers;

use {
helpers::*,
solana_program::{borsh::try_from_slice_unchecked, pubkey::Pubkey, stake},
solana_program::{borsh0_10::try_from_slice_unchecked, pubkey::Pubkey, stake},
solana_program_test::*,
solana_sdk::{
hash::Hash,
Expand Down
Loading

0 comments on commit 84ae880

Please sign in to comment.