Skip to content

Commit

Permalink
backport solana-labs#448 to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay committed Sep 22, 2020
1 parent 4f5e706 commit 51dc1ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 0 additions & 3 deletions token/program/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ pub enum TokenError {
/// Invalid number of required signers.
#[error("Invalid number of required signers")]
InvalidNumberOfRequiredSigners,
/// State is uninitialized.
#[error("State is unititialized")]
UninitializedState,
/// Instruction does not support native tokens
#[error("Instruction does not support native tokens")]
NativeNotSupported,
Expand Down
3 changes: 1 addition & 2 deletions token/program/src/pack.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! State transition types
use crate::error::TokenError;
use solana_sdk::program_error::ProgramError;

/// Check is a token state is initialized
Expand Down Expand Up @@ -35,7 +34,7 @@ pub trait Pack: Sealed {
if value.is_initialized() {
Ok(value)
} else {
Err(TokenError::UninitializedState.into())
Err(ProgramError::UninitializedAccount)
}
}

Expand Down
7 changes: 3 additions & 4 deletions token/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ impl PrintProgramError for TokenError {
TokenError::InvalidNumberOfRequiredSigners => {
info!("Error: Invalid number of required signers")
}
TokenError::UninitializedState => info!("Error: State is uninitialized"),
TokenError::NativeNotSupported => {
info!("Error: Instruction does not support native tokens")
}
Expand Down Expand Up @@ -2511,7 +2510,7 @@ mod tests {

// invalid account
assert_eq!(
Err(TokenError::UninitializedState.into()),
Err(ProgramError::UninitializedAccount),
do_process_instruction(
set_authority(
&program_id,
Expand Down Expand Up @@ -3063,7 +3062,7 @@ mod tests {

// uninitialized destination account
assert_eq!(
Err(TokenError::UninitializedState.into()),
Err(ProgramError::UninitializedAccount),
do_process_instruction(
mint_to(
&program_id,
Expand Down Expand Up @@ -4218,7 +4217,7 @@ mod tests {

// uninitialized
assert_eq!(
Err(TokenError::UninitializedState.into()),
Err(ProgramError::UninitializedAccount),
do_process_instruction(
close_account(&program_id, &account_key, &account3_key, &owner2_key, &[]).unwrap(),
vec![
Expand Down

0 comments on commit 51dc1ae

Please sign in to comment.