Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 51dc1ae

Browse files
committed
backport #448 to v2
1 parent 4f5e706 commit 51dc1ae

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

token/program/src/error.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ pub enum TokenError {
3434
/// Invalid number of required signers.
3535
#[error("Invalid number of required signers")]
3636
InvalidNumberOfRequiredSigners,
37-
/// State is uninitialized.
38-
#[error("State is unititialized")]
39-
UninitializedState,
4037
/// Instruction does not support native tokens
4138
#[error("Instruction does not support native tokens")]
4239
NativeNotSupported,

token/program/src/pack.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! State transition types
22
3-
use crate::error::TokenError;
43
use solana_sdk::program_error::ProgramError;
54

65
/// Check is a token state is initialized
@@ -35,7 +34,7 @@ pub trait Pack: Sealed {
3534
if value.is_initialized() {
3635
Ok(value)
3736
} else {
38-
Err(TokenError::UninitializedState.into())
37+
Err(ProgramError::UninitializedAccount)
3938
}
4039
}
4140

token/program/src/processor.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,6 @@ impl PrintProgramError for TokenError {
754754
TokenError::InvalidNumberOfRequiredSigners => {
755755
info!("Error: Invalid number of required signers")
756756
}
757-
TokenError::UninitializedState => info!("Error: State is uninitialized"),
758757
TokenError::NativeNotSupported => {
759758
info!("Error: Instruction does not support native tokens")
760759
}
@@ -2511,7 +2510,7 @@ mod tests {
25112510

25122511
// invalid account
25132512
assert_eq!(
2514-
Err(TokenError::UninitializedState.into()),
2513+
Err(ProgramError::UninitializedAccount),
25152514
do_process_instruction(
25162515
set_authority(
25172516
&program_id,
@@ -3063,7 +3062,7 @@ mod tests {
30633062

30643063
// uninitialized destination account
30653064
assert_eq!(
3066-
Err(TokenError::UninitializedState.into()),
3065+
Err(ProgramError::UninitializedAccount),
30673066
do_process_instruction(
30683067
mint_to(
30693068
&program_id,
@@ -4218,7 +4217,7 @@ mod tests {
42184217

42194218
// uninitialized
42204219
assert_eq!(
4221-
Err(TokenError::UninitializedState.into()),
4220+
Err(ProgramError::UninitializedAccount),
42224221
do_process_instruction(
42234222
close_account(&program_id, &account_key, &account3_key, &owner2_key, &[]).unwrap(),
42244223
vec![

0 commit comments

Comments
 (0)