Skip to content

remove solana-decode-error #104

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
Jun 24, 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
8 changes: 2 additions & 6 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ members = [
"commitment-config",
"compute-budget-interface",
"cpi",
"decode-error",
"define-syscall",
"derivation-path",
"ed25519-program",
Expand Down Expand Up @@ -224,7 +223,6 @@ solana-cluster-type = { path = "cluster-type", version = "2.2.1" }
solana-commitment-config = { path = "commitment-config", version = "2.2.1" }
solana-compute-budget-interface = { path = "compute-budget-interface", version = "2.2.1" }
solana-cpi = { path = "cpi", version = "2.2.1" }
solana-decode-error = { path = "decode-error", version = "2.2.1" }
solana-define-syscall = { path = "define-syscall", version = "2.2.1" }
solana-derivation-path = { path = "derivation-path", version = "2.2.1" }
solana-ed25519-program = { path = "ed25519-program", version = "2.2.1" }
Expand Down Expand Up @@ -361,7 +359,6 @@ opt-level = 1
solana-account = { path = "account" }
solana-clock = { path = "clock" }
solana-cpi = { path = "cpi" }
solana-decode-error = { path = "decode-error" }
solana-frozen-abi = { path = "frozen-abi" }
solana-frozen-abi-macro = { path = "frozen-abi-macro" }
solana-instruction = { path = "instruction" }
Expand Down
16 changes: 0 additions & 16 deletions decode-error/Cargo.toml

This file was deleted.

62 changes: 0 additions & 62 deletions decode-error/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion precompile-error/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
num-traits = { workspace = true }
solana-decode-error = { workspace = true }
7 changes: 0 additions & 7 deletions precompile-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,3 @@ impl fmt::Display for PrecompileError {
}
}
}

#[allow(deprecated)]
impl<T> solana_decode_error::DecodeError<T> for PrecompileError {
fn type_of() -> &'static str {
"PrecompileError"
}
}
1 change: 0 additions & 1 deletion program-error/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ borsh = { workspace = true, optional = true }
num-traits = { workspace = true }
serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-decode-error = { workspace = true }
solana-instruction = { workspace = true, default-features = false, features = [
"std",
] }
Expand Down
14 changes: 3 additions & 11 deletions program-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,26 +129,18 @@ impl fmt::Display for ProgramError {
pub trait PrintProgramError {
fn print<E>(&self)
where
E: 'static
+ std::error::Error
+ solana_decode_error::DecodeError<E>
+ PrintProgramError
+ FromPrimitive;
E: 'static + std::error::Error + PrintProgramError + FromPrimitive;
}

#[allow(deprecated)]
impl PrintProgramError for ProgramError {
fn print<E>(&self)
where
E: 'static
+ std::error::Error
+ solana_decode_error::DecodeError<E>
+ PrintProgramError
+ FromPrimitive,
E: 'static + std::error::Error + PrintProgramError + FromPrimitive,
{
match self {
Self::Custom(error) => {
if let Some(custom_error) = E::decode_custom_error_to_enum(*error) {
if let Some(custom_error) = E::from_u32(*error) {
custom_error.print::<E>();
} else {
msg!("Error: Unknown");
Expand Down
1 change: 0 additions & 1 deletion program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ solana-blake3-hasher = { workspace = true, features = ["blake3"] }
solana-borsh = { workspace = true, optional = true }
solana-clock = { workspace = true, features = ["serde", "sysvar"] }
solana-cpi = { workspace = true }
solana-decode-error = { workspace = true }
solana-epoch-rewards = { workspace = true, features = ["serde", "sysvar"] }
solana-epoch-schedule = { workspace = true, features = ["serde", "sysvar"] }
solana-fee-calculator = { workspace = true, features = ["serde"] }
Expand Down
1 change: 0 additions & 1 deletion pubkey/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ rand = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-atomic-u64 = { workspace = true }
solana-decode-error = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true, features = [
"frozen-abi",
] }
Expand Down
13 changes: 0 additions & 13 deletions pubkey/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@ impl fmt::Display for PubkeyError {
}
}

#[allow(deprecated)]
impl<T> solana_decode_error::DecodeError<T> for PubkeyError {
fn type_of() -> &'static str {
"PubkeyError"
}
}
impl From<u64> for PubkeyError {
fn from(error: u64) -> Self {
match error {
Expand Down Expand Up @@ -381,13 +375,6 @@ impl From<Infallible> for ParsePubkeyError {
}
}

#[allow(deprecated)]
impl<T> solana_decode_error::DecodeError<T> for ParsePubkeyError {
fn type_of() -> &'static str {
"ParsePubkeyError"
}
}

impl FromStr for Pubkey {
type Err = ParsePubkeyError;

Expand Down
1 change: 0 additions & 1 deletion scripts/patch-crates-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ crate_dirs=(
commitment-config
compute-budget-interface
cpi
decode-error
define-syscall
derivation-path
ed25519-program
Expand Down
1 change: 0 additions & 1 deletion vote-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ num-traits = { workspace = true }
serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-clock = { workspace = true }
solana-decode-error = { workspace = true }
solana-frozen-abi = { workspace = true, features = [
"frozen-abi",
], optional = true }
Expand Down
39 changes: 0 additions & 39 deletions vote-interface/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,42 +71,3 @@ impl fmt::Display for VoteError {
})
}
}

#[allow(deprecated)]
impl<E> solana_decode_error::DecodeError<E> for VoteError {
fn type_of() -> &'static str {
"VoteError"
}
}

#[cfg(test)]
mod tests {
use {super::*, solana_instruction::error::InstructionError};

#[test]
fn test_custom_error_decode() {
use num_traits::FromPrimitive;
#[allow(deprecated)]
fn pretty_err<T>(err: InstructionError) -> String
where
T: 'static + std::error::Error + solana_decode_error::DecodeError<T> + FromPrimitive,
{
if let InstructionError::Custom(code) = err {
let specific_error: T = T::decode_custom_error_to_enum(code).unwrap();
format!(
"{:?}: {}::{:?} - {}",
err,
T::type_of(),
specific_error,
specific_error,
)
} else {
"".to_string()
}
}
assert_eq!(
"Custom(0): VoteError::VoteTooOld - vote already recorded or not in slot hashes history",
pretty_err::<VoteError>(VoteError::VoteTooOld.into())
)
}
}