Skip to content

Deprecate re-exports more loudly #151

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

Merged
merged 2 commits into from
May 6, 2025
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 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions decode-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use num_traits::FromPrimitive;
/// [`ProgramError`]: https://docs.rs/solana-program-error/latest/solana_program_error/enum.ProgramError.html
/// [`ProgramError::Custom`]: https://docs.rs/solana-program-error/latest/solana_program_error/enum.ProgramError.html#variant.Custom
/// [`ToPrimitive`]: num_traits::ToPrimitive
#[deprecated(since = "2.3.0", note = "Use `num_traits::FromPrimitive` instead")]
pub trait DecodeError<E> {
fn decode_custom_error_to_enum(custom: u32) -> Option<E>
where
Expand All @@ -32,6 +33,7 @@ pub trait DecodeError<E> {
}

#[cfg(test)]
#[allow(deprecated)]
mod tests {
use {super::*, num_derive::FromPrimitive};

Expand Down
5 changes: 3 additions & 2 deletions precompile-error/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Precompile errors
use {core::fmt, solana_decode_error::DecodeError};
use core::fmt;

/// Precompile errors
#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -69,7 +69,8 @@ impl fmt::Display for PrecompileError {
}
}

impl<T> DecodeError<T> for PrecompileError {
#[allow(deprecated)]
impl<T> solana_decode_error::DecodeError<T> for PrecompileError {
fn type_of() -> &'static str {
"PrecompileError"
}
Expand Down
14 changes: 11 additions & 3 deletions program-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use serde_derive::{Deserialize, Serialize};
use {
core::fmt,
num_traits::FromPrimitive,
solana_decode_error::DecodeError,
solana_instruction::error::{
InstructionError, ACCOUNT_ALREADY_INITIALIZED, ACCOUNT_BORROW_FAILED,
ACCOUNT_DATA_TOO_SMALL, ACCOUNT_NOT_RENT_EXEMPT, ARITHMETIC_OVERFLOW, BORSH_IO_ERROR,
Expand Down Expand Up @@ -126,17 +125,26 @@ impl fmt::Display for ProgramError {
since = "2.2.2",
note = "Use `ToStr` instead with `solana_msg::msg!` or any other logging"
)]
#[allow(deprecated)]
pub trait PrintProgramError {
fn print<E>(&self)
where
E: 'static + std::error::Error + DecodeError<E> + PrintProgramError + FromPrimitive;
E: 'static
+ std::error::Error
+ solana_decode_error::DecodeError<E>
+ PrintProgramError
+ FromPrimitive;
}

#[allow(deprecated)]
impl PrintProgramError for ProgramError {
fn print<E>(&self)
where
E: 'static + std::error::Error + DecodeError<E> + PrintProgramError + FromPrimitive,
E: 'static
+ std::error::Error
+ solana_decode_error::DecodeError<E>
+ PrintProgramError
+ FromPrimitive,
{
match self {
Self::Custom(error) => {
Expand Down
13 changes: 8 additions & 5 deletions program/src/address_lookup_table.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#[deprecated(
since = "2.2.0",
note = "Use solana-address-lookup-table interface instead"
#![deprecated(
since = "2.3.0",
note = "Use solana-address-lookup-table-interface and solana-message instead"
)]
pub use solana_address_lookup_table_interface::{error, instruction, program, state};
pub use solana_message::AddressLookupTableAccount;

pub use {
solana_address_lookup_table_interface::{error, instruction, program, state},
solana_message::AddressLookupTableAccount,
};
3 changes: 2 additions & 1 deletion program/src/bpf_loader_upgradeable.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[deprecated(since = "2.2.0", note = "Use solana-loader-v3-interface instead")]
#![deprecated(since = "2.3.0", note = "Use solana-loader-v3-interface instead")]

#[allow(deprecated)]
pub use solana_loader_v3_interface::{
get_program_data_address,
Expand Down
56 changes: 36 additions & 20 deletions program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,25 +483,29 @@ pub mod hash;
pub mod incinerator;
pub mod instruction;
pub mod lamports;
#[deprecated(
since = "2.3.0",
note = "Use solana_loader_v3_interface::instruction instead"
)]
pub mod loader_upgradeable_instruction {
#[deprecated(
since = "2.2.0",
note = "Use solana_loader_v3_interface::instruction instead"
)]
pub use solana_loader_v3_interface::instruction::UpgradeableLoaderInstruction;
}
pub mod loader_v4;
#[deprecated(
since = "2.3.0",
note = "Use solana_loader_v4_interface::instruction instead"
)]
pub mod loader_v4_instruction {
#[deprecated(
since = "2.2.0",
note = "Use solana_loader_v4_interface::instruction instead"
)]
pub use solana_loader_v4_interface::instruction::LoaderV4Instruction;
}
pub mod log;
pub mod nonce;
pub mod program;
pub mod program_error;
#[deprecated(
since = "2.3.0",
note = "Use `solana_bincode::limited_deserialize` instead"
)]
pub mod program_utils;
pub mod secp256k1_program;
pub mod slot_hashes;
Expand Down Expand Up @@ -530,29 +534,37 @@ pub use solana_borsh::v1 as borsh1;
#[deprecated(since = "2.1.0", note = "Use `solana-epoch-rewards` crate instead")]
pub use solana_epoch_rewards as epoch_rewards;
#[deprecated(
since = "2.2.0",
since = "2.3.0",
note = "Use `solana-feature-gate-interface` crate instead"
)]
pub use solana_feature_gate_interface as feature;
pub mod feature {
pub use solana_feature_gate_interface::*;
}
#[deprecated(since = "2.1.0", note = "Use `solana-fee-calculator` crate instead")]
pub use solana_fee_calculator as fee_calculator;
#[deprecated(since = "2.2.0", note = "Use `solana-keccak-hasher` crate instead")]
pub use solana_keccak_hasher as keccak;
#[deprecated(since = "2.1.0", note = "Use `solana-last-restart-slot` crate instead")]
pub use solana_last_restart_slot as last_restart_slot;
#[deprecated(
since = "2.2.0",
since = "2.3.0",
note = "Use `solana-loader-v2-interface` crate instead"
)]
pub use solana_loader_v2_interface as loader_instruction;
#[deprecated(since = "2.2.0", note = "Use `solana-message` crate instead")]
pub use solana_message as message;
pub mod loader_instruction {
pub use solana_loader_v2_interface::*;
}
#[deprecated(since = "2.3.0", note = "Use `solana-message` crate instead")]
pub mod message {
pub use solana_message::*;
}
#[deprecated(since = "2.1.0", note = "Use `solana-program-memory` crate instead")]
pub use solana_program_memory as program_memory;
#[deprecated(since = "2.1.0", note = "Use `solana-program-pack` crate instead")]
pub use solana_program_pack as program_pack;
#[deprecated(since = "2.1.0", note = "Use `solana-sanitize` crate instead")]
pub use solana_sanitize as sanitize;
#[deprecated(since = "2.3.0", note = "Use `solana-sanitize` crate instead")]
pub mod sanitize {
pub use solana_sanitize::*;
}
#[deprecated(since = "2.1.0", note = "Use `solana-secp256k1-recover` crate instead")]
pub use solana_secp256k1_recover as secp256k1_recover;
#[deprecated(since = "2.1.0", note = "Use `solana-serde-varint` crate instead")]
Expand All @@ -565,8 +577,10 @@ pub use solana_short_vec as short_vec;
pub use solana_stable_layout as stable_layout;
#[cfg(not(target_os = "solana"))]
pub use solana_sysvar::program_stubs;
#[deprecated(since = "2.2.0", note = "Use `solana-vote-interface` crate instead")]
pub use solana_vote_interface as vote;
#[deprecated(since = "2.3.0", note = "Use `solana-vote-interface` crate instead")]
pub mod vote {
pub use solana_vote_interface::*;
}
#[cfg(target_arch = "wasm32")]
pub use wasm_bindgen::prelude::wasm_bindgen;
pub use {
Expand Down Expand Up @@ -632,8 +646,10 @@ pub mod sdk_ids {
}
}

#[deprecated(since = "2.1.0", note = "Use `solana-decode-error` crate instead")]
pub use solana_decode_error as decode_error;
#[deprecated(since = "2.3.0", note = "Use `num_traits::FromPrimitive` instead")]
pub mod decode_error {
pub use solana_decode_error::*;
}
pub use solana_pubkey::{declare_deprecated_id, declare_id, pubkey};
#[deprecated(since = "2.1.0", note = "Use `solana-sysvar-id` crate instead")]
pub use solana_sysvar_id::{declare_deprecated_sysvar_id, declare_sysvar_id};
Expand Down
24 changes: 12 additions & 12 deletions program/src/loader_v4.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#[deprecated(since = "2.2.0", note = "Use solana-loader-v4-interface instead")]
pub use solana_loader_v4_interface::{
instruction::{
create_buffer, deploy, deploy_from_source, finalize, is_deploy_instruction,
is_finalize_instruction, is_retract_instruction, is_set_program_length_instruction,
is_set_program_length_instruction as is_truncate_instruction,
is_transfer_authority_instruction, is_write_instruction, retract,
set_program_length as truncate, set_program_length as truncate_uninitialized,
set_program_length, transfer_authority, write,
#![deprecated(since = "2.3.0", note = "Use solana-loader-v4-interface instead")]
pub use {
solana_loader_v4_interface::{
instruction::{
create_buffer, deploy, deploy_from_source, finalize, is_deploy_instruction,
is_finalize_instruction, is_retract_instruction, is_set_program_length_instruction,
is_transfer_authority_instruction, is_write_instruction, retract,
set_program_length as truncate, transfer_authority, write,
},
state::{LoaderV4State, LoaderV4Status},
DEPLOYMENT_COOLDOWN_IN_SLOTS,
},
state::{LoaderV4State, LoaderV4Status},
DEPLOYMENT_COOLDOWN_IN_SLOTS,
solana_sdk_ids::loader_v4::{check_id, id, ID},
};
pub use solana_sdk_ids::loader_v4::{check_id, id, ID};
2 changes: 2 additions & 0 deletions program/src/nonce.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deprecated(since = "2.3.0", note = "Use solana_nonce instead")]

pub use solana_nonce::{state::State, NONCED_TX_MARKER_IX_INDEX};
pub mod state {
pub use solana_nonce::{
Expand Down
3 changes: 1 addition & 2 deletions program/src/stake.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#[deprecated(since = "2.2.0", note = "Use solana-stake-interface instead")]
#![deprecated(since = "2.3.0", note = "Use solana-stake-interface instead")]
pub use solana_stake_interface::{
config, stake_flags, state, tools, MINIMUM_DELINQUENT_EPOCHS_FOR_DEACTIVATION,
};

pub mod instruction {
#[deprecated(since = "2.2.0", note = "Use solana-stake-interface instead")]
pub use solana_stake_interface::{error::StakeError, instruction::*};
}

Expand Down
1 change: 1 addition & 0 deletions program/src/stake_history.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deprecated(since = "2.3.0", note = "Use `solana-stake-interface` crate instead")]
pub use {
crate::sysvar::stake_history::{
StakeHistory, StakeHistoryEntry, StakeHistoryGetEntry, MAX_ENTRIES,
Expand Down
3 changes: 2 additions & 1 deletion program/src/system_instruction.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[deprecated(since = "2.2.0", note = "Use `solana_system_interface` crate instead")]
#![deprecated(since = "2.3.0", note = "Use `solana_system_interface` crate instead")]

pub use solana_system_interface::{
error::SystemError,
instruction::{
Expand Down
1 change: 1 addition & 0 deletions program/src/system_program.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deprecated(since = "2.3.0", note = "Use `solana_sdk_ids::system_program` instead")]
//! The [system native program][np].
//!
//! [np]: https://docs.solanalabs.com/runtime/programs#system-program
Expand Down
7 changes: 4 additions & 3 deletions pubkey/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use {
str::{from_utf8, FromStr},
},
num_traits::{FromPrimitive, ToPrimitive},
solana_decode_error::DecodeError,
};
#[cfg(target_arch = "wasm32")]
use {
Expand Down Expand Up @@ -120,7 +119,8 @@ impl fmt::Display for PubkeyError {
}
}

impl<T> DecodeError<T> for PubkeyError {
#[allow(deprecated)]
impl<T> solana_decode_error::DecodeError<T> for PubkeyError {
fn type_of() -> &'static str {
"PubkeyError"
}
Expand Down Expand Up @@ -381,7 +381,8 @@ impl From<Infallible> for ParsePubkeyError {
}
}

impl<T> DecodeError<T> for ParsePubkeyError {
#[allow(deprecated)]
impl<T> solana_decode_error::DecodeError<T> for ParsePubkeyError {
fn type_of() -> &'static str {
"ParsePubkeyError"
}
Expand Down
1 change: 1 addition & 0 deletions sdk/src/feature.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#[allow(deprecated)]
pub use solana_program::feature::*;
Loading