Skip to content
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

token metadata: replace IncorrectMintAuthority with TokenError::OwnerMismatch #5615

Closed
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
3 changes: 2 additions & 1 deletion token-metadata/example/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use {
},
spl_pod::optional_keys::OptionalNonZeroPubkey,
spl_token_2022::{
error::TokenError,
extension::{update_authority::check_update_authority, StateWithExtensions},
state::Mint,
},
Expand Down Expand Up @@ -53,7 +54,7 @@ pub fn process_initialize(
return Err(ProgramError::MissingRequiredSignature);
}
if mint.base.mint_authority.as_ref() != COption::Some(mint_authority_info.key) {
return Err(TokenMetadataError::IncorrectMintAuthority.into());
return Err(TokenError::OwnerMismatch.into());
}
}

Expand Down
7 changes: 3 additions & 4 deletions token-metadata/example/tests/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ use {
system_instruction,
transaction::{Transaction, TransactionError},
},
spl_token_metadata_interface::{
error::TokenMetadataError, instruction::initialize, state::TokenMetadata,
},
spl_token_2022::error::TokenError,
spl_token_metadata_interface::{instruction::initialize, state::TokenMetadata},
spl_type_length_value::{
error::TlvError,
state::{TlvState, TlvStateBorrowed},
Expand Down Expand Up @@ -265,7 +264,7 @@ async fn fail_incorrect_authority() {
error,
TransactionError::InstructionError(
1,
InstructionError::Custom(TokenMetadataError::IncorrectMintAuthority as u32)
InstructionError::Custom(TokenError::OwnerMismatch as u32)
)
);
}
3 changes: 0 additions & 3 deletions token-metadata/interface/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ pub enum TokenMetadataError {
/// Mint has no mint authority
#[error("Mint has no mint authority")]
MintHasNoMintAuthority,
/// Incorrect mint authority has signed the instruction
#[error("Incorrect mint authority has signed the instruction")]
IncorrectMintAuthority,
/// Incorrect metadata update authority has signed the instruction
#[error("Incorrect metadata update authority has signed the instruction")]
IncorrectUpdateAuthority,
Expand Down
4 changes: 2 additions & 2 deletions token/program-2022-test/tests/token_metadata_initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
},
spl_token_2022::{error::TokenError, extension::BaseStateWithExtensions, processor::Processor},
spl_token_client::token::{ExtensionInitializationParams, TokenError as TokenClientError},
spl_token_metadata_interface::{error::TokenMetadataError, state::TokenMetadata},
spl_token_metadata_interface::state::TokenMetadata,
std::{convert::TryInto, sync::Arc},
};

Expand Down Expand Up @@ -110,7 +110,7 @@ async fn success_initialize() {
TokenClientError::Client(Box::new(TransportError::TransactionError(
TransactionError::InstructionError(
1,
InstructionError::Custom(TokenMetadataError::IncorrectMintAuthority as u32)
InstructionError::Custom(TokenError::OwnerMismatch as u32)
)
)))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn process_initialize(
return Err(ProgramError::MissingRequiredSignature);
}
if mint.base.mint_authority.as_ref() != COption::Some(mint_authority_info.key) {
return Err(TokenMetadataError::IncorrectMintAuthority.into());
return Err(TokenError::OwnerMismatch.into());
}

if mint.get_extension::<MetadataPointer>().is_err() {
Expand Down
Loading