-
Notifications
You must be signed in to change notification settings - Fork 23
update program and cli to sdk 3.0 #407
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| #![allow(clippy::arithmetic_side_effects)] | ||
| #![allow(clippy::uninlined_format_args)] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noticed you made a number of fixes that would pass this rule. Maybe worth just fixing the remaining? Up to you. |
||
|
|
||
| use { | ||
| clap::{ArgMatches, CommandFactory, Parser}, | ||
|
|
@@ -16,7 +17,7 @@ use { | |
| solana_signer::Signer, | ||
| solana_stake_interface as stake, | ||
| solana_transaction::Transaction, | ||
| solana_vote_program::{self as vote_program, vote_state::VoteState}, | ||
| solana_vote_program::{self as vote_program, vote_state::VoteStateV4}, | ||
| spl_associated_token_account_interface::instruction::create_associated_token_account, | ||
| spl_single_pool::{ | ||
| self, find_pool_address, find_pool_mint_address, find_pool_onramp_address, | ||
|
|
@@ -117,7 +118,7 @@ async fn command_initialize(config: &Config, command_config: InitializeCli) -> C | |
| match get_initialized_account(config, vote_account_address).await? { | ||
| Some(vote_account) | ||
| if vote_account.owner == vote_program::id() | ||
| && VoteState::deserialize(&vote_account.data).is_ok() => {} | ||
| && VoteStateV4::deserialize(&vote_account.data, &vote_account_address).is_ok() => {} | ||
| _ => return Err(format!("{} is not a valid vote account", vote_account_address).into()), | ||
| } | ||
|
|
||
|
|
@@ -645,7 +646,8 @@ async fn command_update_metadata( | |
| .get_account(vote_account_address) | ||
| .await? | ||
| { | ||
| let vote_account = VoteState::deserialize(&vote_account_data.data)?; | ||
| let vote_account = | ||
| VoteStateV4::deserialize(&vote_account_data.data, &vote_account_address)?; | ||
|
|
||
| if authorized_withdrawer.pubkey() != vote_account.authorized_withdrawer { | ||
| return Err(format!( | ||
|
|
@@ -777,6 +779,7 @@ async fn command_display(config: &Config, command_config: DisplayCli) -> Command | |
| let minimum_pool_balance = quarantine::get_minimum_pool_balance(config).await?; | ||
| let pool_and_vote_addresses = if command_config.all { | ||
| // the filter isn't necessary now but makes the cli forward-compatible | ||
| #[allow(deprecated)] | ||
| let pools = config | ||
| .rpc_client | ||
| .get_program_accounts_with_config( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,41 +9,42 @@ edition = "2021" | |
|
|
||
| [features] | ||
| no-entrypoint = [] | ||
| custom-heap = [] | ||
| custom-panic = [] | ||
|
Comment on lines
10
to
+13
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. someone on stack exchange claims you dont need this to silence warnings on the latest |
||
|
|
||
| [dependencies] | ||
| arrayref = "0.3.9" | ||
| borsh = "1.5.7" | ||
| borsh = "1.6.0" | ||
| num-derive = "0.4" | ||
| num-traits = "0.2" | ||
| num_enum = "0.7.4" | ||
| solana-account-info = "2.3" | ||
| num_enum = "0.7.5" | ||
| solana-account-info = "3.1" | ||
| solana-borsh = "3.0" | ||
| solana-clock = "2.2" | ||
| solana-cpi = "2.2" | ||
| solana-instruction = "2.2" | ||
| solana-clock = "3.0" | ||
| solana-cpi = "3.1" | ||
| solana-instruction = "3.0" | ||
| solana-msg = "3.0" | ||
| solana-native-token = "3.0" | ||
| solana-program-entrypoint = "2.3" | ||
| solana-program-error = "2.2" | ||
| solana-program-pack = "2.2" | ||
| solana-pubkey = { version = "2.2", features = ["borsh", "curve25519"] } | ||
| solana-rent = "2.2" | ||
| solana-stake-interface = { version = "1.2.1", features = ["borsh"] } | ||
| solana-system-interface = "1.0.0" | ||
| solana-sysvar = "2.2" | ||
| solana-vote-interface = "2.2.6" | ||
| solana-program-entrypoint = "3.1" | ||
| solana-program-error = "3.0" | ||
| solana-program-pack = "3.0" | ||
| solana-pubkey = { version = "4.0", features = ["borsh", "curve25519"] } | ||
| solana-rent = "3.0" | ||
| solana-stake-interface = { version = "2.0.1", features = ["bincode", "borsh", "sysvar"] } | ||
| solana-system-interface = { version = "3.0.0", features = ["bincode"] } | ||
| solana-sysvar = "3.1" | ||
| solana-vote-interface = { version = "4.0.4", features = ["bincode"] } | ||
| solana-security-txt = "1.1.2" | ||
| spl-token = { version = "8.0", features = ["no-entrypoint"] } | ||
| spl-token-interface = "2.0.0" | ||
| thiserror = "2.0" | ||
|
|
||
| [dev-dependencies] | ||
| agave-feature-set = "2.2" | ||
| solana-program-test = "2.3.4" | ||
| solana-sdk = "2.2" | ||
| spl-associated-token-account = { version = "7.0.0", features = ["no-entrypoint"] } | ||
| spl-associated-token-account-client = { version = "2.0.0" } | ||
| agave-feature-set = "3.1" | ||
| solana-program-test = { version = "3.1.3", features = ["agave-unstable-api"] } | ||
| solana-sdk = "3.0" | ||
| spl-associated-token-account-interface = "2.0.0" | ||
| test-case = "3.3" | ||
| bincode = "1.3.1" | ||
| bincode = "1.3.3" | ||
| rand = "0.9.2" | ||
| approx = "0.5.1" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ use { | |
| borsh::BorshDeserialize, | ||
| solana_account_info::{next_account_info, AccountInfo}, | ||
| solana_borsh::v1::{get_packed_len, try_from_slice_unchecked}, | ||
| solana_clock::Epoch, | ||
| solana_clock::{Clock, Epoch}, | ||
| solana_cpi::invoke_signed, | ||
| solana_msg::msg, | ||
| solana_native_token::LAMPORTS_PER_SOL, | ||
|
|
@@ -31,11 +31,12 @@ use { | |
| solana_stake_interface::{ | ||
| self as stake, | ||
| state::{Meta, Stake, StakeActivationStatus, StakeStateV2}, | ||
| sysvar::stake_history::StakeHistorySysvar, | ||
| }, | ||
| solana_system_interface::{instruction as system_instruction, program as system_program}, | ||
| solana_sysvar::{clock::Clock, stake_history::StakeHistorySysvar, Sysvar}, | ||
| solana_sysvar::SysvarSerialize, | ||
| solana_vote_interface::program as vote_program, | ||
| spl_token::state::Mint, | ||
| spl_token_interface::{self as spl_token, state::Mint}, | ||
| }; | ||
|
|
||
| /// Calculate pool tokens to mint, given outstanding token supply, pool active | ||
|
|
@@ -248,8 +249,9 @@ fn check_vote_account(vote_account_info: &AccountInfo) -> Result<(), ProgramErro | |
| .and_then(|s| s.try_into().ok()) | ||
| .ok_or(SinglePoolError::UnparseableVoteAccount)?; | ||
|
|
||
| #[allow(clippy::manual_range_patterns)] | ||
| match u32::from_le_bytes(state_variant) { | ||
| 1 | 2 => Ok(()), | ||
| 1 | 2 | 3 => Ok(()), | ||
| 0 => Err(SinglePoolError::LegacyVoteAccount.into()), | ||
| _ => Err(SinglePoolError::UnparseableVoteAccount.into()), | ||
| } | ||
|
Comment on lines
253
to
257
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this gives us |
||
|
|
@@ -1635,8 +1637,7 @@ mod tests { | |
| #[test_case(rand::random(), true, true; "no_minimum")] | ||
| fn random_deposit_withdraw(seed: u64, with_rewards: bool, no_minimum: bool) { | ||
| println!( | ||
| "TEST SEED: {}. edit the test case to pass this value if needed to debug failures", | ||
| seed | ||
| "TEST SEED: {seed}. edit the test case to pass this value if needed to debug failures", | ||
| ); | ||
| let mut prng = rand::rngs::StdRng::seed_from_u64(seed); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a future PR, may be nice to use workspace deps for these