diff --git a/CHANGELOG.md b/CHANGELOG.md index d44adb162a44a7..bb17813eea273f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Release channels have their own copy of this changelog: getConfirmedTransaction, getConfirmedSignaturesForAddress2, getRecentBlockhash, getFees, getFeeCalculatorForBlockhash, getFeeRateGovernor, getSnapshotSlot * `--enable-rpc-obsolete_v1_7` flag removed + * Deprecated methods are removed from `RpcClient` and `RpcClient::nonblocking` * Changes * `central-scheduler` as default option for `--block-production-method` (#34891) * `solana-rpc-client-api`: `RpcFilterError` depends on `base64` version 0.22, so users may need to upgrade to `base64` version 0.22 diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 6b21703908a690..af1b84493298fa 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -65,9 +65,6 @@ pub enum CliCommand { ClusterVersion, Feature(FeatureCliCommand), Inflation(InflationCliCommand), - Fees { - blockhash: Option, - }, FindProgramDerivedAddress { seeds: Vec>, program_id: Pubkey, @@ -640,12 +637,6 @@ pub fn parse_command( ("feature", Some(matches)) => { parse_feature_subcommand(matches, default_signer, wallet_manager) } - ("fees", Some(matches)) => { - let blockhash = value_of::(matches, "blockhash"); - Ok(CliCommandInfo::without_signers(CliCommand::Fees { - blockhash, - })) - } ("first-available-block", Some(_matches)) => Ok(CliCommandInfo::without_signers( CliCommand::FirstAvailableBlock, )), @@ -911,7 +902,6 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { seed, program_id, } => process_create_address_with_seed(config, from_pubkey.as_ref(), seed, program_id), - CliCommand::Fees { ref blockhash } => process_fees(&rpc_client, config, blockhash.as_ref()), CliCommand::Feature(feature_subcommand) => { process_feature_subcommand(&rpc_client, config, feature_subcommand) } diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index 6d2bd30714dad6..3d9d2f2b90e0f4 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -171,19 +171,6 @@ impl ClusterQuerySubCommands for App<'_, '_> { SubCommand::with_name("cluster-version") .about("Get the version of the cluster entrypoint"), ) - // Deprecated in v1.8.0 - .subcommand( - SubCommand::with_name("fees") - .about("Display current cluster fees (Deprecated in v1.8.0)") - .arg( - Arg::with_name("blockhash") - .long("blockhash") - .takes_value(true) - .value_name("BLOCKHASH") - .validator(is_hash) - .help("Query fees for BLOCKHASH instead of the most recent blockhash"), - ), - ) .subcommand( SubCommand::with_name("first-available-block") .about("Get the first available block in the storage"), @@ -982,42 +969,6 @@ pub fn process_cluster_version(rpc_client: &RpcClient, config: &CliConfig) -> Pr } } -pub fn process_fees( - rpc_client: &RpcClient, - config: &CliConfig, - blockhash: Option<&Hash>, -) -> ProcessResult { - let fees = if let Some(recent_blockhash) = blockhash { - #[allow(deprecated)] - let result = rpc_client.get_fee_calculator_for_blockhash_with_commitment( - recent_blockhash, - config.commitment, - )?; - if let Some(fee_calculator) = result.value { - CliFees::some( - result.context.slot, - *recent_blockhash, - fee_calculator.lamports_per_signature, - None, - None, - ) - } else { - CliFees::none() - } - } else { - #[allow(deprecated)] - let result = rpc_client.get_fees_with_commitment(config.commitment)?; - CliFees::some( - result.context.slot, - result.value.blockhash, - result.value.fee_calculator.lamports_per_signature, - None, - Some(result.value.last_valid_block_height), - ) - }; - Ok(config.output_format.formatted_string(&fees)) -} - pub fn process_first_available_block(rpc_client: &RpcClient) -> ProcessResult { let first_available_block = rpc_client.get_first_available_block()?; Ok(format!("{first_available_block}")) @@ -2376,26 +2327,6 @@ mod tests { CliCommandInfo::without_signers(CliCommand::ClusterVersion) ); - let test_fees = test_commands.clone().get_matches_from(vec!["test", "fees"]); - assert_eq!( - parse_command(&test_fees, &default_signer, &mut None).unwrap(), - CliCommandInfo::without_signers(CliCommand::Fees { blockhash: None }) - ); - - let blockhash = Hash::new_unique(); - let test_fees = test_commands.clone().get_matches_from(vec![ - "test", - "fees", - "--blockhash", - &blockhash.to_string(), - ]); - assert_eq!( - parse_command(&test_fees, &default_signer, &mut None).unwrap(), - CliCommandInfo::without_signers(CliCommand::Fees { - blockhash: Some(blockhash) - }) - ); - let slot = 100; let test_get_block_time = test_commands diff --git a/rpc-client-api/src/request.rs b/rpc-client-api/src/request.rs index f0bbe0af3e78c6..1bcc42179d96ec 100644 --- a/rpc-client-api/src/request.rs +++ b/rpc-client-api/src/request.rs @@ -8,9 +8,7 @@ use { #[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] pub enum RpcRequest { - Custom { - method: &'static str, - }, + Custom { method: &'static str }, DeregisterNode, GetAccountInfo, GetBalance, @@ -21,43 +19,9 @@ pub enum RpcRequest { GetBlocksWithLimit, GetBlockTime, GetClusterNodes, - #[deprecated(since = "1.7.0", note = "Please use RpcRequest::GetBlock instead")] - GetConfirmedBlock, - #[deprecated(since = "1.7.0", note = "Please use RpcRequest::GetBlocks instead")] - GetConfirmedBlocks, - #[deprecated( - since = "1.7.0", - note = "Please use RpcRequest::GetBlocksWithLimit instead" - )] - GetConfirmedBlocksWithLimit, - #[deprecated( - since = "1.7.0", - note = "Please use RpcRequest::GetSignaturesForAddress instead" - )] - GetConfirmedSignaturesForAddress2, - #[deprecated( - since = "1.7.0", - note = "Please use RpcRequest::GetTransaction instead" - )] - GetConfirmedTransaction, GetEpochInfo, GetEpochSchedule, - #[deprecated( - since = "1.9.0", - note = "Please use RpcRequest::GetFeeForMessage instead" - )] - GetFeeCalculatorForBlockhash, GetFeeForMessage, - #[deprecated( - since = "1.9.0", - note = "Please do not use, will no longer be available in the future" - )] - GetFeeRateGovernor, - #[deprecated( - since = "1.9.0", - note = "Please use RpcRequest::GetFeeForMessage instead" - )] - GetFees, GetFirstAvailableBlock, GetGenesisHash, GetHealth, @@ -73,19 +37,9 @@ pub enum RpcRequest { GetMinimumBalanceForRentExemption, GetMultipleAccounts, GetProgramAccounts, - #[deprecated( - since = "1.9.0", - note = "Please use RpcRequest::GetLatestBlockhash instead" - )] - GetRecentBlockhash, GetRecentPerformanceSamples, GetRecentPrioritizationFees, GetHighestSnapshotSlot, - #[deprecated( - since = "1.9.0", - note = "Please use RpcRequest::GetHighestSnapshotSlot instead" - )] - GetSnapshotSlot, GetSignaturesForAddress, GetSignatureStatuses, GetSlot, @@ -131,17 +85,9 @@ impl fmt::Display for RpcRequest { RpcRequest::GetBlocksWithLimit => "getBlocksWithLimit", RpcRequest::GetBlockTime => "getBlockTime", RpcRequest::GetClusterNodes => "getClusterNodes", - RpcRequest::GetConfirmedBlock => "getConfirmedBlock", - RpcRequest::GetConfirmedBlocks => "getConfirmedBlocks", - RpcRequest::GetConfirmedBlocksWithLimit => "getConfirmedBlocksWithLimit", - RpcRequest::GetConfirmedSignaturesForAddress2 => "getConfirmedSignaturesForAddress2", - RpcRequest::GetConfirmedTransaction => "getConfirmedTransaction", RpcRequest::GetEpochInfo => "getEpochInfo", RpcRequest::GetEpochSchedule => "getEpochSchedule", - RpcRequest::GetFeeCalculatorForBlockhash => "getFeeCalculatorForBlockhash", RpcRequest::GetFeeForMessage => "getFeeForMessage", - RpcRequest::GetFeeRateGovernor => "getFeeRateGovernor", - RpcRequest::GetFees => "getFees", RpcRequest::GetFirstAvailableBlock => "getFirstAvailableBlock", RpcRequest::GetGenesisHash => "getGenesisHash", RpcRequest::GetHealth => "getHealth", @@ -157,11 +103,9 @@ impl fmt::Display for RpcRequest { RpcRequest::GetMinimumBalanceForRentExemption => "getMinimumBalanceForRentExemption", RpcRequest::GetMultipleAccounts => "getMultipleAccounts", RpcRequest::GetProgramAccounts => "getProgramAccounts", - RpcRequest::GetRecentBlockhash => "getRecentBlockhash", RpcRequest::GetRecentPerformanceSamples => "getRecentPerformanceSamples", RpcRequest::GetRecentPrioritizationFees => "getRecentPrioritizationFees", RpcRequest::GetHighestSnapshotSlot => "getHighestSnapshotSlot", - RpcRequest::GetSnapshotSlot => "getSnapshotSlot", RpcRequest::GetSignaturesForAddress => "getSignaturesForAddress", RpcRequest::GetSignatureStatuses => "getSignatureStatuses", RpcRequest::GetSlot => "getSlot", @@ -303,20 +247,9 @@ mod tests { let request = test_request.build_request_json(1, Value::Null); assert_eq!(request["method"], "getEpochInfo"); - #[allow(deprecated)] - let test_request = RpcRequest::GetRecentBlockhash; - let request = test_request.build_request_json(1, Value::Null); - assert_eq!(request["method"], "getRecentBlockhash"); - - #[allow(deprecated)] - let test_request = RpcRequest::GetFeeCalculatorForBlockhash; - let request = test_request.build_request_json(1, json!([addr])); - assert_eq!(request["method"], "getFeeCalculatorForBlockhash"); - - #[allow(deprecated)] - let test_request = RpcRequest::GetFeeRateGovernor; + let test_request = RpcRequest::GetLatestBlockhash; let request = test_request.build_request_json(1, Value::Null); - assert_eq!(request["method"], "getFeeRateGovernor"); + assert_eq!(request["method"], "getLatestBlockhash"); let test_request = RpcRequest::GetSlot; let request = test_request.build_request_json(1, Value::Null); @@ -347,8 +280,7 @@ mod tests { let addr = json!("deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx"); // Test request with CommitmentConfig and no params - #[allow(deprecated)] - let test_request = RpcRequest::GetRecentBlockhash; + let test_request = RpcRequest::GetLatestBlockhash; let request = test_request.build_request_json(1, json!([commitment_config])); assert_eq!(request["params"], json!([commitment_config.clone()])); diff --git a/rpc-client-nonce-utils/src/blockhash_query.rs b/rpc-client-nonce-utils/src/blockhash_query.rs index 20b3e0572ff9f6..7a6c1c1f8441b2 100644 --- a/rpc-client-nonce-utils/src/blockhash_query.rs +++ b/rpc-client-nonce-utils/src/blockhash_query.rs @@ -6,10 +6,7 @@ use { offline::*, }, solana_rpc_client::rpc_client::RpcClient, - solana_sdk::{ - commitment_config::CommitmentConfig, fee_calculator::FeeCalculator, hash::Hash, - pubkey::Pubkey, - }, + solana_sdk::{commitment_config::CommitmentConfig, hash::Hash, pubkey::Pubkey}, }; #[derive(Debug, PartialEq, Eq)] @@ -19,56 +16,6 @@ pub enum Source { } impl Source { - #[deprecated(since = "1.9.0", note = "Please use `get_blockhash` instead")] - pub fn get_blockhash_and_fee_calculator( - &self, - rpc_client: &RpcClient, - commitment: CommitmentConfig, - ) -> Result<(Hash, FeeCalculator), Box> { - match self { - Self::Cluster => { - #[allow(deprecated)] - let res = rpc_client - .get_recent_blockhash_with_commitment(commitment)? - .value; - Ok((res.0, res.1)) - } - Self::NonceAccount(ref pubkey) => { - let data = crate::get_account_with_commitment(rpc_client, pubkey, commitment) - .and_then(|ref a| crate::data_from_account(a))?; - Ok((data.blockhash(), data.fee_calculator)) - } - } - } - - #[deprecated( - since = "1.9.0", - note = "Please do not use, will no longer be available in the future" - )] - pub fn get_fee_calculator( - &self, - rpc_client: &RpcClient, - blockhash: &Hash, - commitment: CommitmentConfig, - ) -> Result, Box> { - match self { - Self::Cluster => { - #[allow(deprecated)] - let res = rpc_client - .get_fee_calculator_for_blockhash_with_commitment(blockhash, commitment)? - .value; - Ok(res) - } - Self::NonceAccount(ref pubkey) => { - let res = crate::get_account_with_commitment(rpc_client, pubkey, commitment)?; - let res = crate::data_from_account(&res)?; - Ok(Some(res) - .filter(|d| d.blockhash() == *blockhash) - .map(|d| d.fee_calculator)) - } - } - } - pub fn get_blockhash( &self, rpc_client: &RpcClient, @@ -131,29 +78,6 @@ impl BlockhashQuery { BlockhashQuery::new(blockhash, sign_only, nonce_account) } - #[deprecated(since = "1.9.0", note = "Please use `get_blockhash` instead")] - pub fn get_blockhash_and_fee_calculator( - &self, - rpc_client: &RpcClient, - commitment: CommitmentConfig, - ) -> Result<(Hash, FeeCalculator), Box> { - match self { - BlockhashQuery::None(hash) => Ok((*hash, FeeCalculator::default())), - BlockhashQuery::FeeCalculator(source, hash) => { - #[allow(deprecated)] - let fee_calculator = source - .get_fee_calculator(rpc_client, hash, commitment)? - .ok_or(format!("Hash has expired {hash:?}"))?; - Ok((*hash, fee_calculator)) - } - BlockhashQuery::All(source) => - { - #[allow(deprecated)] - source.get_blockhash_and_fee_calculator(rpc_client, commitment) - } - } - } - pub fn get_blockhash( &self, rpc_client: &RpcClient, @@ -188,10 +112,11 @@ mod tests { solana_account_decoder::{UiAccount, UiAccountEncoding}, solana_rpc_client_api::{ request::RpcRequest, - response::{Response, RpcFeeCalculator, RpcFees, RpcResponseContext}, + response::{Response, RpcBlockhash, RpcResponseContext}, }, solana_sdk::{ account::Account, + fee_calculator::FeeCalculator, hash::hash, nonce::{self, state::DurableNonce}, system_program, @@ -350,65 +275,65 @@ mod tests { #[test] #[allow(deprecated)] - fn test_blockhash_query_get_blockhash_fee_calc() { + fn test_blockhash_query_get_blockhash() { let test_blockhash = hash(&[0u8]); let rpc_blockhash = hash(&[1u8]); - let rpc_fee_calc = FeeCalculator::new(42); - let get_recent_blockhash_response = json!(Response { + let get_latest_blockhash_response = json!(Response { context: RpcResponseContext { slot: 1, api_version: None }, - value: json!(RpcFees { + value: json!(RpcBlockhash { blockhash: rpc_blockhash.to_string(), - fee_calculator: rpc_fee_calc, - last_valid_slot: 42, last_valid_block_height: 42, }), }); - let get_fee_calculator_for_blockhash_response = json!(Response { + let is_blockhash_valid_response = json!(Response { context: RpcResponseContext { slot: 1, api_version: None }, - value: json!(RpcFeeCalculator { - fee_calculator: rpc_fee_calc - }), + value: true, }); let mut mocks = HashMap::new(); - mocks.insert(RpcRequest::GetFees, get_recent_blockhash_response.clone()); + mocks.insert( + RpcRequest::GetLatestBlockhash, + get_latest_blockhash_response.clone(), + ); let rpc_client = RpcClient::new_mock_with_mocks("".to_string(), mocks); assert_eq!( BlockhashQuery::default() - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) + .get_blockhash(&rpc_client, CommitmentConfig::default()) .unwrap(), - (rpc_blockhash, rpc_fee_calc), + rpc_blockhash, ); let mut mocks = HashMap::new(); - mocks.insert(RpcRequest::GetFees, get_recent_blockhash_response.clone()); mocks.insert( - RpcRequest::GetFeeCalculatorForBlockhash, - get_fee_calculator_for_blockhash_response, + RpcRequest::IsBlockhashValid, + is_blockhash_valid_response.clone(), ); let rpc_client = RpcClient::new_mock_with_mocks("".to_string(), mocks); assert_eq!( BlockhashQuery::FeeCalculator(Source::Cluster, test_blockhash) - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) + .get_blockhash(&rpc_client, CommitmentConfig::default()) .unwrap(), - (test_blockhash, rpc_fee_calc), + test_blockhash, ); let mut mocks = HashMap::new(); - mocks.insert(RpcRequest::GetFees, get_recent_blockhash_response); + mocks.insert( + RpcRequest::GetLatestBlockhash, + get_latest_blockhash_response, + ); let rpc_client = RpcClient::new_mock_with_mocks("".to_string(), mocks); assert_eq!( BlockhashQuery::None(test_blockhash) - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) + .get_blockhash(&rpc_client, CommitmentConfig::default()) .unwrap(), - (test_blockhash, FeeCalculator::default()), + test_blockhash, ); let rpc_client = RpcClient::new_mock("fails".to_string()); assert!(BlockhashQuery::default() - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) + .get_blockhash(&rpc_client, CommitmentConfig::default()) .is_err()); let durable_nonce = DurableNonce::from_blockhash(&Hash::new(&[2u8; 32])); @@ -447,40 +372,32 @@ mod tests { let rpc_client = RpcClient::new_mock_with_mocks("".to_string(), mocks); assert_eq!( BlockhashQuery::All(Source::NonceAccount(nonce_pubkey)) - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) + .get_blockhash(&rpc_client, CommitmentConfig::default()) .unwrap(), - (nonce_blockhash, nonce_fee_calc), + nonce_blockhash, ); let mut mocks = HashMap::new(); mocks.insert(RpcRequest::GetAccountInfo, get_account_response.clone()); let rpc_client = RpcClient::new_mock_with_mocks("".to_string(), mocks); assert_eq!( BlockhashQuery::FeeCalculator(Source::NonceAccount(nonce_pubkey), nonce_blockhash) - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) + .get_blockhash(&rpc_client, CommitmentConfig::default()) .unwrap(), - (nonce_blockhash, nonce_fee_calc), - ); - let mut mocks = HashMap::new(); - mocks.insert(RpcRequest::GetAccountInfo, get_account_response.clone()); - let rpc_client = RpcClient::new_mock_with_mocks("".to_string(), mocks); - assert!( - BlockhashQuery::FeeCalculator(Source::NonceAccount(nonce_pubkey), test_blockhash) - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) - .is_err() + nonce_blockhash, ); let mut mocks = HashMap::new(); mocks.insert(RpcRequest::GetAccountInfo, get_account_response); let rpc_client = RpcClient::new_mock_with_mocks("".to_string(), mocks); assert_eq!( BlockhashQuery::None(nonce_blockhash) - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) + .get_blockhash(&rpc_client, CommitmentConfig::default()) .unwrap(), - (nonce_blockhash, FeeCalculator::default()), + nonce_blockhash, ); let rpc_client = RpcClient::new_mock("fails".to_string()); assert!(BlockhashQuery::All(Source::NonceAccount(nonce_pubkey)) - .get_blockhash_and_fee_calculator(&rpc_client, CommitmentConfig::default()) + .get_blockhash(&rpc_client, CommitmentConfig::default()) .is_err()); } } diff --git a/rpc-client/src/nonblocking/rpc_client.rs b/rpc-client/src/nonblocking/rpc_client.rs index f6234e5367ccaf..386949eaeda570 100644 --- a/rpc-client/src/nonblocking/rpc_client.rs +++ b/rpc-client/src/nonblocking/rpc_client.rs @@ -7,11 +7,6 @@ //! [JSON-RPC]: https://www.jsonrpc.org/specification pub use crate::mock_sender::Mocks; -#[allow(deprecated)] -use solana_rpc_client_api::deprecated_config::{ - RpcConfirmedBlockConfig, RpcConfirmedTransactionConfig, - RpcGetConfirmedSignaturesForAddress2Config, -}; #[cfg(feature = "spinner")] use {crate::spinner, solana_sdk::clock::MAX_HASH_AGE_IN_SECONDS, std::cmp::min}; use { @@ -47,7 +42,6 @@ use { commitment_config::{CommitmentConfig, CommitmentLevel}, epoch_info::EpochInfo, epoch_schedule::EpochSchedule, - fee_calculator::{FeeCalculator, FeeRateGovernor}, hash::Hash, pubkey::Pubkey, signature::Signature, @@ -576,23 +570,6 @@ impl RpcClient { Ok(requested_commitment) } - #[allow(deprecated)] - async fn maybe_map_request(&self, mut request: RpcRequest) -> Result { - if self.get_node_version().await? < semver::Version::new(1, 7, 0) { - request = match request { - RpcRequest::GetBlock => RpcRequest::GetConfirmedBlock, - RpcRequest::GetBlocks => RpcRequest::GetConfirmedBlocks, - RpcRequest::GetBlocksWithLimit => RpcRequest::GetConfirmedBlocksWithLimit, - RpcRequest::GetSignaturesForAddress => { - RpcRequest::GetConfirmedSignaturesForAddress2 - } - RpcRequest::GetTransaction => RpcRequest::GetConfirmedTransaction, - _ => request, - }; - } - Ok(request) - } - #[allow(deprecated)] async fn maybe_map_filters( &self, @@ -1436,27 +1413,8 @@ impl RpcClient { /// # Ok::<(), Error>(()) /// ``` pub async fn get_highest_snapshot_slot(&self) -> ClientResult { - if self.get_node_version().await? < semver::Version::new(1, 9, 0) { - #[allow(deprecated)] - self.get_snapshot_slot() - .await - .map(|full| RpcSnapshotSlotInfo { - full, - incremental: None, - }) - } else { - self.send(RpcRequest::GetHighestSnapshotSlot, Value::Null) - .await - } - } - - #[deprecated( - since = "1.8.0", - note = "Please use RpcClient::get_highest_snapshot_slot() instead" - )] - #[allow(deprecated)] - pub async fn get_snapshot_slot(&self) -> ClientResult { - self.send(RpcRequest::GetSnapshotSlot, Value::Null).await + self.send(RpcRequest::GetHighestSnapshotSlot, Value::Null) + .await } /// Check if a transaction has been processed with the default [commitment level][cl]. @@ -2519,11 +2477,8 @@ impl RpcClient { slot: Slot, encoding: UiTransactionEncoding, ) -> ClientResult { - self.send( - self.maybe_map_request(RpcRequest::GetBlock).await?, - json!([slot, encoding]), - ) - .await + self.send(RpcRequest::GetBlock, json!([slot, encoding])) + .await } /// Returns identity and transaction information about a confirmed block in the ledger. @@ -2569,46 +2524,7 @@ impl RpcClient { slot: Slot, config: RpcBlockConfig, ) -> ClientResult { - self.send( - self.maybe_map_request(RpcRequest::GetBlock).await?, - json!([slot, config]), - ) - .await - } - - #[deprecated(since = "1.7.0", note = "Please use RpcClient::get_block() instead")] - #[allow(deprecated)] - pub async fn get_confirmed_block(&self, slot: Slot) -> ClientResult { - self.get_confirmed_block_with_encoding(slot, UiTransactionEncoding::Json) - .await - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_block_with_encoding() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_block_with_encoding( - &self, - slot: Slot, - encoding: UiTransactionEncoding, - ) -> ClientResult { - self.send(RpcRequest::GetConfirmedBlock, json!([slot, encoding])) - .await - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_block_with_config() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_block_with_config( - &self, - slot: Slot, - config: RpcConfirmedBlockConfig, - ) -> ClientResult { - self.send(RpcRequest::GetConfirmedBlock, json!([slot, config])) - .await + self.send(RpcRequest::GetBlock, json!([slot, config])).await } /// Returns a list of finalized blocks between two slots. @@ -2635,12 +2551,9 @@ impl RpcClient { /// /// # RPC Reference /// - /// This method corresponds directly to the [`getBlocks`] RPC method, unless - /// the remote node version is less than 1.7, in which case it maps to the - /// [`getConfirmedBlocks`] RPC method. + /// This method corresponds directly to the [`getBlocks`] RPC method. /// /// [`getBlocks`]: https://solana.com/docs/rpc/http/getblocks - /// [`getConfirmedBlocks`]: https://solana.com/docs/rpc/deprecated/getconfirmedblocks /// /// # Examples /// @@ -2662,11 +2575,8 @@ impl RpcClient { start_slot: Slot, end_slot: Option, ) -> ClientResult> { - self.send( - self.maybe_map_request(RpcRequest::GetBlocks).await?, - json!([start_slot, end_slot]), - ) - .await + self.send(RpcRequest::GetBlocks, json!([start_slot, end_slot])) + .await } /// Returns a list of confirmed blocks between two slots. @@ -2697,12 +2607,9 @@ impl RpcClient { /// /// # RPC Reference /// - /// This method corresponds directly to the [`getBlocks`] RPC method, unless - /// the remote node version is less than 1.7, in which case it maps to the - /// [`getConfirmedBlocks`] RPC method. + /// This method corresponds directly to the [`getBlocks`] RPC method. /// /// [`getBlocks`]: https://solana.com/docs/rpc/http/getblocks - /// [`getConfirmedBlocks`]: https://solana.com/docs/rpc/deprecated/getconfirmedblocks /// /// # Examples /// @@ -2744,8 +2651,7 @@ impl RpcClient { self.maybe_map_commitment(commitment_config).await? ]) }; - self.send(self.maybe_map_request(RpcRequest::GetBlocks).await?, json) - .await + self.send(RpcRequest::GetBlocks, json).await } /// Returns a list of finalized blocks starting at the given slot. @@ -2762,11 +2668,9 @@ impl RpcClient { /// # RPC Reference /// /// This method corresponds directly to the [`getBlocksWithLimit`] RPC - /// method, unless the remote node version is less than 1.7, in which case - /// it maps to the [`getConfirmedBlocksWithLimit`] RPC method. + /// method. /// /// [`getBlocksWithLimit`]: https://solana.com/docs/rpc/http/getblockswithlimit - /// [`getConfirmedBlocksWithLimit`]: https://solana.com/docs/rpc/deprecated/getconfirmedblockswithlimit /// /// # Examples /// @@ -2788,12 +2692,8 @@ impl RpcClient { start_slot: Slot, limit: usize, ) -> ClientResult> { - self.send( - self.maybe_map_request(RpcRequest::GetBlocksWithLimit) - .await?, - json!([start_slot, limit]), - ) - .await + self.send(RpcRequest::GetBlocksWithLimit, json!([start_slot, limit])) + .await } /// Returns a list of confirmed blocks starting at the given slot. @@ -2811,11 +2711,9 @@ impl RpcClient { /// # RPC Reference /// /// This method corresponds directly to the [`getBlocksWithLimit`] RPC - /// method, unless the remote node version is less than 1.7, in which case - /// it maps to the `getConfirmedBlocksWithLimit` RPC method. + /// method. /// /// [`getBlocksWithLimit`]: https://solana.com/docs/rpc/http/getblockswithlimit - /// [`getConfirmedBlocksWithLimit`]: https://solana.com/docs/rpc/deprecated/getconfirmedblockswithlimit /// /// # Examples /// @@ -2845,87 +2743,7 @@ impl RpcClient { commitment_config: CommitmentConfig, ) -> ClientResult> { self.send( - self.maybe_map_request(RpcRequest::GetBlocksWithLimit) - .await?, - json!([ - start_slot, - limit, - self.maybe_map_commitment(commitment_config).await? - ]), - ) - .await - } - - #[deprecated(since = "1.7.0", note = "Please use RpcClient::get_blocks() instead")] - #[allow(deprecated)] - pub async fn get_confirmed_blocks( - &self, - start_slot: Slot, - end_slot: Option, - ) -> ClientResult> { - self.send( - RpcRequest::GetConfirmedBlocks, - json!([start_slot, end_slot]), - ) - .await - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_blocks_with_commitment() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_blocks_with_commitment( - &self, - start_slot: Slot, - end_slot: Option, - commitment_config: CommitmentConfig, - ) -> ClientResult> { - let json = if end_slot.is_some() { - json!([ - start_slot, - end_slot, - self.maybe_map_commitment(commitment_config).await? - ]) - } else { - json!([ - start_slot, - self.maybe_map_commitment(commitment_config).await? - ]) - }; - self.send(RpcRequest::GetConfirmedBlocks, json).await - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_blocks_with_limit() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_blocks_with_limit( - &self, - start_slot: Slot, - limit: usize, - ) -> ClientResult> { - self.send( - RpcRequest::GetConfirmedBlocksWithLimit, - json!([start_slot, limit]), - ) - .await - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_blocks_with_limit_and_commitment() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_blocks_with_limit_and_commitment( - &self, - start_slot: Slot, - limit: usize, - commitment_config: CommitmentConfig, - ) -> ClientResult> { - self.send( - RpcRequest::GetConfirmedBlocksWithLimit, + RpcRequest::GetBlocksWithLimit, json!([ start_slot, limit, @@ -3050,51 +2868,7 @@ impl RpcClient { let result: Vec = self .send( - self.maybe_map_request(RpcRequest::GetSignaturesForAddress) - .await?, - json!([address.to_string(), config]), - ) - .await?; - - Ok(result) - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_signatures_for_address() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_signatures_for_address2( - &self, - address: &Pubkey, - ) -> ClientResult> { - self.get_confirmed_signatures_for_address2_with_config( - address, - GetConfirmedSignaturesForAddress2Config::default(), - ) - .await - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_signatures_for_address_with_config() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_signatures_for_address2_with_config( - &self, - address: &Pubkey, - config: GetConfirmedSignaturesForAddress2Config, - ) -> ClientResult> { - let config = RpcGetConfirmedSignaturesForAddress2Config { - before: config.before.map(|signature| signature.to_string()), - until: config.until.map(|signature| signature.to_string()), - limit: config.limit, - commitment: config.commitment, - }; - - let result: Vec = self - .send( - RpcRequest::GetConfirmedSignaturesForAddress2, + RpcRequest::GetSignaturesForAddress, json!([address.to_string(), config]), ) .await?; @@ -3111,12 +2885,9 @@ impl RpcClient { /// /// # RPC Reference /// - /// This method corresponds directly to the [`getTransaction`] RPC method, - /// unless the remote node version is less than 1.7, in which case it maps - /// to the [`getConfirmedTransaction`] RPC method. + /// This method corresponds directly to the [`getTransaction`] RPC method. /// /// [`getTransaction`]: https://solana.com/docs/rpc/http/gettransaction - /// [`getConfirmedTransaction`]: https://solana.com/docs/rpc/deprecated/getConfirmedTransaction /// /// # Examples /// @@ -3152,7 +2923,7 @@ impl RpcClient { encoding: UiTransactionEncoding, ) -> ClientResult { self.send( - self.maybe_map_request(RpcRequest::GetTransaction).await?, + RpcRequest::GetTransaction, json!([signature.to_string(), encoding]), ) .await @@ -3170,12 +2941,9 @@ impl RpcClient { /// /// # RPC Reference /// - /// This method corresponds directly to the [`getTransaction`] RPC method, - /// unless the remote node version is less than 1.7, in which case it maps - /// to the [`getConfirmedTransaction`] RPC method. + /// This method corresponds directly to the [`getTransaction`] RPC method. /// /// [`getTransaction`]: https://solana.com/docs/rpc/http/gettransaction - /// [`getConfirmedTransaction`]: https://solana.com/docs/rpc/deprecated/getConfirmedTransaction /// /// # Examples /// @@ -3220,41 +2988,7 @@ impl RpcClient { config: RpcTransactionConfig, ) -> ClientResult { self.send( - self.maybe_map_request(RpcRequest::GetTransaction).await?, - json!([signature.to_string(), config]), - ) - .await - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_transaction() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_transaction( - &self, - signature: &Signature, - encoding: UiTransactionEncoding, - ) -> ClientResult { - self.send( - RpcRequest::GetConfirmedTransaction, - json!([signature.to_string(), encoding]), - ) - .await - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_transaction_with_config() instead" - )] - #[allow(deprecated)] - pub async fn get_confirmed_transaction_with_config( - &self, - signature: &Signature, - config: RpcConfirmedTransactionConfig, - ) -> ClientResult { - self.send( - RpcRequest::GetConfirmedTransaction, + RpcRequest::GetTransaction, json!([signature.to_string(), config]), ) .await @@ -4549,228 +4283,6 @@ impl RpcClient { .await } - #[deprecated( - since = "1.9.0", - note = "Please use `get_latest_blockhash` and `get_fee_for_message` instead" - )] - #[allow(deprecated)] - pub async fn get_fees(&self) -> ClientResult { - #[allow(deprecated)] - Ok(self - .get_fees_with_commitment(self.commitment()) - .await? - .value) - } - - #[deprecated( - since = "1.9.0", - note = "Please use `get_latest_blockhash_with_commitment` and `get_fee_for_message` instead" - )] - #[allow(deprecated)] - pub async fn get_fees_with_commitment( - &self, - commitment_config: CommitmentConfig, - ) -> RpcResult { - let Response { - context, - value: fees, - } = self - .send::>( - RpcRequest::GetFees, - json!([self.maybe_map_commitment(commitment_config).await?]), - ) - .await?; - let blockhash = fees.blockhash.parse().map_err(|_| { - ClientError::new_with_request( - RpcError::ParseError("Hash".to_string()).into(), - RpcRequest::GetFees, - ) - })?; - Ok(Response { - context, - value: Fees { - blockhash, - fee_calculator: fees.fee_calculator, - last_valid_block_height: fees.last_valid_block_height, - }, - }) - } - - #[deprecated(since = "1.9.0", note = "Please use `get_latest_blockhash` instead")] - #[allow(deprecated)] - pub async fn get_recent_blockhash(&self) -> ClientResult<(Hash, FeeCalculator)> { - #[allow(deprecated)] - let (blockhash, fee_calculator, _last_valid_slot) = self - .get_recent_blockhash_with_commitment(self.commitment()) - .await? - .value; - Ok((blockhash, fee_calculator)) - } - - #[deprecated( - since = "1.9.0", - note = "Please use `get_latest_blockhash_with_commitment` instead" - )] - #[allow(deprecated)] - pub async fn get_recent_blockhash_with_commitment( - &self, - commitment_config: CommitmentConfig, - ) -> RpcResult<(Hash, FeeCalculator, Slot)> { - let (context, blockhash, fee_calculator, last_valid_slot) = if let Ok(Response { - context, - value: - RpcFees { - blockhash, - fee_calculator, - last_valid_slot, - .. - }, - }) = self - .send::>( - RpcRequest::GetFees, - json!([self.maybe_map_commitment(commitment_config).await?]), - ) - .await - { - (context, blockhash, fee_calculator, last_valid_slot) - } else if let Ok(Response { - context, - value: - DeprecatedRpcFees { - blockhash, - fee_calculator, - last_valid_slot, - }, - }) = self - .send::>( - RpcRequest::GetFees, - json!([self.maybe_map_commitment(commitment_config).await?]), - ) - .await - { - (context, blockhash, fee_calculator, last_valid_slot) - } else if let Ok(Response { - context, - value: - RpcBlockhashFeeCalculator { - blockhash, - fee_calculator, - }, - }) = self - .send::>( - RpcRequest::GetRecentBlockhash, - json!([self.maybe_map_commitment(commitment_config).await?]), - ) - .await - { - (context, blockhash, fee_calculator, 0) - } else { - return Err(ClientError::new_with_request( - RpcError::ParseError("RpcBlockhashFeeCalculator or RpcFees".to_string()).into(), - RpcRequest::GetRecentBlockhash, - )); - }; - - let blockhash = blockhash.parse().map_err(|_| { - ClientError::new_with_request( - RpcError::ParseError("Hash".to_string()).into(), - RpcRequest::GetRecentBlockhash, - ) - })?; - Ok(Response { - context, - value: (blockhash, fee_calculator, last_valid_slot), - }) - } - - #[deprecated(since = "1.9.0", note = "Please `get_fee_for_message` instead")] - #[allow(deprecated)] - pub async fn get_fee_calculator_for_blockhash( - &self, - blockhash: &Hash, - ) -> ClientResult> { - #[allow(deprecated)] - Ok(self - .get_fee_calculator_for_blockhash_with_commitment(blockhash, self.commitment()) - .await? - .value) - } - - #[deprecated( - since = "1.9.0", - note = "Please `get_latest_blockhash_with_commitment` and `get_fee_for_message` instead" - )] - #[allow(deprecated)] - pub async fn get_fee_calculator_for_blockhash_with_commitment( - &self, - blockhash: &Hash, - commitment_config: CommitmentConfig, - ) -> RpcResult> { - let Response { context, value } = self - .send::>>( - RpcRequest::GetFeeCalculatorForBlockhash, - json!([ - blockhash.to_string(), - self.maybe_map_commitment(commitment_config).await? - ]), - ) - .await?; - - Ok(Response { - context, - value: value.map(|rf| rf.fee_calculator), - }) - } - - #[deprecated( - since = "1.9.0", - note = "Please do not use, will no longer be available in the future" - )] - #[allow(deprecated)] - pub async fn get_fee_rate_governor(&self) -> RpcResult { - let Response { - context, - value: RpcFeeRateGovernor { fee_rate_governor }, - } = self - .send::>(RpcRequest::GetFeeRateGovernor, Value::Null) - .await?; - - Ok(Response { - context, - value: fee_rate_governor, - }) - } - - #[deprecated( - since = "1.9.0", - note = "Please do not use, will no longer be available in the future" - )] - #[allow(deprecated)] - pub async fn get_new_blockhash(&self, blockhash: &Hash) -> ClientResult<(Hash, FeeCalculator)> { - let mut num_retries = 0; - let start = Instant::now(); - while start.elapsed().as_secs() < 5 { - #[allow(deprecated)] - if let Ok((new_blockhash, fee_calculator)) = self.get_recent_blockhash().await { - if new_blockhash != *blockhash { - return Ok((new_blockhash, fee_calculator)); - } - } - debug!("Got same blockhash ({:?}), will retry...", blockhash); - - // Retry ~twice during a slot - sleep(Duration::from_millis(DEFAULT_MS_PER_SLOT / 2)).await; - num_retries += 1; - } - Err(RpcError::ForUser(format!( - "Unable to get new blockhash after {}ms (retried {} times), stuck at {}", - start.elapsed().as_millis(), - num_retries, - blockhash - )) - .into()) - } - pub async fn get_first_available_block(&self) -> ClientResult { self.send(RpcRequest::GetFirstAvailableBlock, Value::Null) .await @@ -5260,64 +4772,43 @@ impl RpcClient { Ok(blockhash) } - #[allow(deprecated)] pub async fn get_latest_blockhash_with_commitment( &self, commitment: CommitmentConfig, ) -> ClientResult<(Hash, u64)> { - let (blockhash, last_valid_block_height) = - if self.get_node_version().await? < semver::Version::new(1, 9, 0) { - let Fees { - blockhash, - last_valid_block_height, - .. - } = self.get_fees_with_commitment(commitment).await?.value; - (blockhash, last_valid_block_height) - } else { - let RpcBlockhash { - blockhash, - last_valid_block_height, - } = self - .send::>( - RpcRequest::GetLatestBlockhash, - json!([self.maybe_map_commitment(commitment).await?]), - ) - .await? - .value; - let blockhash = blockhash.parse().map_err(|_| { - ClientError::new_with_request( - RpcError::ParseError("Hash".to_string()).into(), - RpcRequest::GetLatestBlockhash, - ) - })?; - (blockhash, last_valid_block_height) - }; + let RpcBlockhash { + blockhash, + last_valid_block_height, + } = self + .send::>( + RpcRequest::GetLatestBlockhash, + json!([self.maybe_map_commitment(commitment).await?]), + ) + .await? + .value; + let blockhash = blockhash.parse().map_err(|_| { + ClientError::new_with_request( + RpcError::ParseError("Hash".to_string()).into(), + RpcRequest::GetLatestBlockhash, + ) + })?; Ok((blockhash, last_valid_block_height)) } - #[allow(deprecated)] pub async fn is_blockhash_valid( &self, blockhash: &Hash, commitment: CommitmentConfig, ) -> ClientResult { - let result = if self.get_node_version().await? < semver::Version::new(1, 9, 0) { - self.get_fee_calculator_for_blockhash_with_commitment(blockhash, commitment) - .await? - .value - .is_some() - } else { - self.send::>( + Ok(self + .send::>( RpcRequest::IsBlockhashValid, json!([blockhash.to_string(), commitment,]), ) .await? - .value - }; - Ok(result) + .value) } - #[allow(deprecated)] pub async fn get_fee_for_message( &self, message: &impl SerializableMessage, diff --git a/rpc-client/src/rpc_client.rs b/rpc-client/src/rpc_client.rs index b8cbba11d1eebd..ab7ddfcf533251 100644 --- a/rpc-client/src/rpc_client.rs +++ b/rpc-client/src/rpc_client.rs @@ -10,10 +10,6 @@ //! in [`crate::nonblocking::rpc_client`]. pub use crate::mock_sender::Mocks; -#[allow(deprecated)] -use solana_rpc_client_api::deprecated_config::{ - RpcConfirmedBlockConfig, RpcConfirmedTransactionConfig, -}; use { crate::{ http_sender::HttpSender, @@ -40,7 +36,6 @@ use { epoch_info::EpochInfo, epoch_schedule::EpochSchedule, feature::Feature, - fee_calculator::{FeeCalculator, FeeRateGovernor}, hash::Hash, message::{v0, Message as LegacyMessage}, pubkey::Pubkey, @@ -1175,15 +1170,6 @@ impl RpcClient { self.invoke((self.rpc_client.as_ref()).get_highest_snapshot_slot()) } - #[deprecated( - since = "1.8.0", - note = "Please use RpcClient::get_highest_snapshot_slot() instead" - )] - #[allow(deprecated)] - pub fn get_snapshot_slot(&self) -> ClientResult { - self.invoke((self.rpc_client.as_ref()).get_snapshot_slot()) - } - /// Check if a transaction has been processed with the default [commitment level][cl]. /// /// [cl]: https://solana.com/docs/rpc#configuring-state-commitment @@ -2122,38 +2108,6 @@ impl RpcClient { self.invoke((self.rpc_client.as_ref()).get_block_with_config(slot, config)) } - #[deprecated(since = "1.7.0", note = "Please use RpcClient::get_block() instead")] - #[allow(deprecated)] - pub fn get_confirmed_block(&self, slot: Slot) -> ClientResult { - self.invoke((self.rpc_client.as_ref()).get_confirmed_block(slot)) - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_block_with_encoding() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_block_with_encoding( - &self, - slot: Slot, - encoding: UiTransactionEncoding, - ) -> ClientResult { - self.invoke((self.rpc_client.as_ref()).get_confirmed_block_with_encoding(slot, encoding)) - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_block_with_config() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_block_with_config( - &self, - slot: Slot, - config: RpcConfirmedBlockConfig, - ) -> ClientResult { - self.invoke((self.rpc_client.as_ref()).get_confirmed_block_with_config(slot, config)) - } - /// Returns a list of finalized blocks between two slots. /// /// The range is inclusive, with results including the block for both @@ -2178,12 +2132,9 @@ impl RpcClient { /// /// # RPC Reference /// - /// This method corresponds directly to the [`getBlocks`] RPC method, unless - /// the remote node version is less than 1.7, in which case it maps to the - /// [`getConfirmedBlocks`] RPC method. + /// This method corresponds directly to the [`getBlocks`] RPC method. /// /// [`getBlocks`]: https://solana.com/docs/rpc/http/getblocks - /// [`getConfirmedBlocks`]: https://solana.com/docs/rpc/deprecated/getconfirmedblocks /// /// # Examples /// @@ -2229,12 +2180,9 @@ impl RpcClient { /// /// # RPC Reference /// - /// This method corresponds directly to the [`getBlocks`] RPC method, unless - /// the remote node version is less than 1.7, in which case it maps to the - /// [`getConfirmedBlocks`] RPC method. + /// This method corresponds directly to the [`getBlocks`] RPC method. /// /// [`getBlocks`]: https://solana.com/docs/rpc/http/getblocks - /// [`getConfirmedBlocks`]: https://solana.com/docs/rpc/deprecated/getconfirmedblocks /// /// # Examples /// @@ -2282,11 +2230,9 @@ impl RpcClient { /// # RPC Reference /// /// This method corresponds directly to the [`getBlocksWithLimit`] RPC - /// method, unless the remote node version is less than 1.7, in which case - /// it maps to the [`getConfirmedBlocksWithLimit`] RPC method. + /// method. /// /// [`getBlocksWithLimit`]: https://solana.com/docs/rpc/http/getblockswithlimit - /// [`getConfirmedBlocksWithLimit`]: https://solana.com/docs/rpc/deprecated/getconfirmedblockswithlimit /// /// # Examples /// @@ -2319,11 +2265,9 @@ impl RpcClient { /// # RPC Reference /// /// This method corresponds directly to the [`getBlocksWithLimit`] RPC - /// method, unless the remote node version is less than 1.7, in which case - /// it maps to the `getConfirmedBlocksWithLimit` RPC method. + /// method. /// /// [`getBlocksWithLimit`]: https://solana.com/docs/rpc/http/getblockswithlimit - /// [`getConfirmedBlocksWithLimit`]: https://solana.com/docs/rpc/deprecated/getconfirmedblockswithlimit /// /// # Examples /// @@ -2358,69 +2302,6 @@ impl RpcClient { ) } - #[deprecated(since = "1.7.0", note = "Please use RpcClient::get_blocks() instead")] - #[allow(deprecated)] - pub fn get_confirmed_blocks( - &self, - start_slot: Slot, - end_slot: Option, - ) -> ClientResult> { - self.invoke((self.rpc_client.as_ref()).get_confirmed_blocks(start_slot, end_slot)) - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_blocks_with_commitment() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_blocks_with_commitment( - &self, - start_slot: Slot, - end_slot: Option, - commitment_config: CommitmentConfig, - ) -> ClientResult> { - self.invoke( - (self.rpc_client.as_ref()).get_confirmed_blocks_with_commitment( - start_slot, - end_slot, - commitment_config, - ), - ) - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_blocks_with_limit() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_blocks_with_limit( - &self, - start_slot: Slot, - limit: usize, - ) -> ClientResult> { - self.invoke((self.rpc_client.as_ref()).get_confirmed_blocks_with_limit(start_slot, limit)) - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_blocks_with_limit_and_commitment() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_blocks_with_limit_and_commitment( - &self, - start_slot: Slot, - limit: usize, - commitment_config: CommitmentConfig, - ) -> ClientResult> { - self.invoke( - (self.rpc_client.as_ref()).get_confirmed_blocks_with_limit_and_commitment( - start_slot, - limit, - commitment_config, - ), - ) - } - /// Get confirmed signatures for transactions involving an address. /// /// Returns up to 1000 signatures, ordered from newest to oldest. @@ -2518,34 +2399,6 @@ impl RpcClient { ) } - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_signatures_for_address() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_signatures_for_address2( - &self, - address: &Pubkey, - ) -> ClientResult> { - self.invoke((self.rpc_client.as_ref()).get_confirmed_signatures_for_address2(address)) - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_signatures_for_address_with_config() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_signatures_for_address2_with_config( - &self, - address: &Pubkey, - config: GetConfirmedSignaturesForAddress2Config, - ) -> ClientResult> { - self.invoke( - (self.rpc_client.as_ref()) - .get_confirmed_signatures_for_address2_with_config(address, config), - ) - } - /// Returns transaction details for a confirmed transaction. /// /// This method uses the [`Finalized`] [commitment level][cl]. @@ -2555,12 +2408,9 @@ impl RpcClient { /// /// # RPC Reference /// - /// This method corresponds directly to the [`getTransaction`] RPC method, - /// unless the remote node version is less than 1.7, in which case it maps - /// to the [`getConfirmedTransaction`] RPC method. + /// This method corresponds directly to the [`getTransaction`] RPC method. /// /// [`getTransaction`]: https://solana.com/docs/rpc/http/gettransaction - /// [`getConfirmedTransaction`]: https://solana.com/docs/rpc/deprecated/getConfirmedTransaction /// /// # Examples /// @@ -2607,12 +2457,9 @@ impl RpcClient { /// /// # RPC Reference /// - /// This method corresponds directly to the [`getTransaction`] RPC method, - /// unless the remote node version is less than 1.7, in which case it maps - /// to the [`getConfirmedTransaction`] RPC method. + /// This method corresponds directly to the [`getTransaction`] RPC method. /// /// [`getTransaction`]: https://solana.com/docs/rpc/http/gettransaction - /// [`getConfirmedTransaction`]: https://solana.com/docs/rpc/deprecated/getConfirmedTransaction /// /// # Examples /// @@ -2656,34 +2503,6 @@ impl RpcClient { self.invoke((self.rpc_client.as_ref()).get_transaction_with_config(signature, config)) } - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_transaction() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_transaction( - &self, - signature: &Signature, - encoding: UiTransactionEncoding, - ) -> ClientResult { - self.invoke((self.rpc_client.as_ref()).get_confirmed_transaction(signature, encoding)) - } - - #[deprecated( - since = "1.7.0", - note = "Please use RpcClient::get_transaction_with_config() instead" - )] - #[allow(deprecated)] - pub fn get_confirmed_transaction_with_config( - &self, - signature: &Signature, - config: RpcConfirmedTransactionConfig, - ) -> ClientResult { - self.invoke( - (self.rpc_client.as_ref()).get_confirmed_transaction_with_config(signature, config), - ) - } - /// Returns the estimated production time of a block. /// /// # RPC Reference @@ -3697,87 +3516,6 @@ impl RpcClient { ) } - #[deprecated( - since = "1.9.0", - note = "Please use `get_latest_blockhash` and `get_fee_for_message` instead" - )] - #[allow(deprecated)] - pub fn get_fees(&self) -> ClientResult { - self.invoke((self.rpc_client.as_ref()).get_fees()) - } - - #[deprecated( - since = "1.9.0", - note = "Please use `get_latest_blockhash_with_commitment` and `get_fee_for_message` instead" - )] - #[allow(deprecated)] - pub fn get_fees_with_commitment(&self, commitment_config: CommitmentConfig) -> RpcResult { - self.invoke((self.rpc_client.as_ref()).get_fees_with_commitment(commitment_config)) - } - - #[deprecated(since = "1.9.0", note = "Please use `get_latest_blockhash` instead")] - #[allow(deprecated)] - pub fn get_recent_blockhash(&self) -> ClientResult<(Hash, FeeCalculator)> { - self.invoke((self.rpc_client.as_ref()).get_recent_blockhash()) - } - - #[deprecated( - since = "1.9.0", - note = "Please use `get_latest_blockhash_with_commitment` instead" - )] - #[allow(deprecated)] - pub fn get_recent_blockhash_with_commitment( - &self, - commitment_config: CommitmentConfig, - ) -> RpcResult<(Hash, FeeCalculator, Slot)> { - self.invoke( - (self.rpc_client.as_ref()).get_recent_blockhash_with_commitment(commitment_config), - ) - } - - #[deprecated(since = "1.9.0", note = "Please `get_fee_for_message` instead")] - #[allow(deprecated)] - pub fn get_fee_calculator_for_blockhash( - &self, - blockhash: &Hash, - ) -> ClientResult> { - self.invoke((self.rpc_client.as_ref()).get_fee_calculator_for_blockhash(blockhash)) - } - - #[deprecated( - since = "1.9.0", - note = "Please `get_latest_blockhash_with_commitment` and `get_fee_for_message` instead" - )] - #[allow(deprecated)] - pub fn get_fee_calculator_for_blockhash_with_commitment( - &self, - blockhash: &Hash, - commitment_config: CommitmentConfig, - ) -> RpcResult> { - self.invoke( - (self.rpc_client.as_ref()) - .get_fee_calculator_for_blockhash_with_commitment(blockhash, commitment_config), - ) - } - - #[deprecated( - since = "1.9.0", - note = "Please do not use, will no longer be available in the future" - )] - #[allow(deprecated)] - pub fn get_fee_rate_governor(&self) -> RpcResult { - self.invoke((self.rpc_client.as_ref()).get_fee_rate_governor()) - } - - #[deprecated( - since = "1.9.0", - note = "Please do not use, will no longer be available in the future" - )] - #[allow(deprecated)] - pub fn get_new_blockhash(&self, blockhash: &Hash) -> ClientResult<(Hash, FeeCalculator)> { - self.invoke((self.rpc_client.as_ref()).get_new_blockhash(blockhash)) - } - pub fn get_first_available_block(&self) -> ClientResult { self.invoke((self.rpc_client.as_ref()).get_first_available_block()) } @@ -3996,7 +3734,6 @@ impl RpcClient { self.invoke((self.rpc_client.as_ref()).get_latest_blockhash()) } - #[allow(deprecated)] pub fn get_latest_blockhash_with_commitment( &self, commitment: CommitmentConfig, @@ -4004,7 +3741,6 @@ impl RpcClient { self.invoke((self.rpc_client.as_ref()).get_latest_blockhash_with_commitment(commitment)) } - #[allow(deprecated)] pub fn is_blockhash_valid( &self, blockhash: &Hash, @@ -4013,7 +3749,6 @@ impl RpcClient { self.invoke((self.rpc_client.as_ref()).is_blockhash_valid(blockhash, commitment)) } - #[allow(deprecated)] pub fn get_fee_for_message(&self, message: &impl SerializableMessage) -> ClientResult { self.invoke((self.rpc_client.as_ref()).get_fee_for_message(message)) } @@ -4137,7 +3872,7 @@ mod tests { future::ok(Value::Number(Number::from(50))) }); // Failed request - io.add_method("getRecentBlockhash", |params: Params| { + io.add_method("getLatestBlockhash", |params: Params| { if params != Params::None { future::err(Error::invalid_request()) } else { @@ -4169,16 +3904,14 @@ mod tests { .unwrap(); assert_eq!(balance, 50); - #[allow(deprecated)] let blockhash: String = rpc_client - .send(RpcRequest::GetRecentBlockhash, Value::Null) + .send(RpcRequest::GetLatestBlockhash, Value::Null) .unwrap(); assert_eq!(blockhash, "deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx"); // Send erroneous parameter - #[allow(deprecated)] let blockhash: ClientResult = - rpc_client.send(RpcRequest::GetRecentBlockhash, json!(["parameter"])); + rpc_client.send(RpcRequest::GetLatestBlockhash, json!(["parameter"])); assert!(blockhash.is_err()); } @@ -4205,22 +3938,6 @@ mod tests { assert!(signature.is_err()); } - #[test] - fn test_get_recent_blockhash() { - let rpc_client = RpcClient::new_mock("succeeds".to_string()); - - let expected_blockhash: Hash = PUBKEY.parse().unwrap(); - - let blockhash = rpc_client.get_latest_blockhash().expect("blockhash ok"); - assert_eq!(blockhash, expected_blockhash); - - let rpc_client = RpcClient::new_mock("fails".to_string()); - - #[allow(deprecated)] - let result = rpc_client.get_recent_blockhash(); - assert!(result.is_err()); - } - #[test] fn test_custom_request() { let rpc_client = RpcClient::new_mock("succeeds".to_string()); @@ -4320,7 +4037,6 @@ mod tests { let rpc_client = RpcClient::new_mock("fails".to_string()); - #[allow(deprecated)] let is_err = rpc_client.get_latest_blockhash().is_err(); assert!(is_err); } diff --git a/test-validator/src/lib.rs b/test-validator/src/lib.rs index 364e527542a8e8..8c6fd289018113 100644 --- a/test-validator/src/lib.rs +++ b/test-validator/src/lib.rs @@ -44,8 +44,7 @@ use { epoch_schedule::EpochSchedule, exit::Exit, feature_set::FEATURE_NAMES, - fee_calculator::{FeeCalculator, FeeRateGovernor}, - hash::Hash, + fee_calculator::FeeRateGovernor, instruction::{AccountMeta, Instruction}, message::Message, native_token::sol_to_lamports, @@ -1163,20 +1162,6 @@ impl TestValidator { self.vote_account_address } - /// Return an RpcClient for the validator. As a convenience, also return a recent blockhash and - /// associated fee calculator - #[deprecated(since = "1.9.0", note = "Please use `get_rpc_client` instead")] - pub fn rpc_client(&self) -> (RpcClient, Hash, FeeCalculator) { - let rpc_client = - RpcClient::new_with_commitment(self.rpc_url.clone(), CommitmentConfig::processed()); - #[allow(deprecated)] - let (recent_blockhash, fee_calculator) = rpc_client - .get_recent_blockhash() - .expect("get_recent_blockhash"); - - (rpc_client, recent_blockhash, fee_calculator) - } - /// Return an RpcClient for the validator. pub fn get_rpc_client(&self) -> RpcClient { RpcClient::new_with_commitment(self.rpc_url.clone(), CommitmentConfig::processed())