Message difference in process_initialize_immutable_owner
In the previous implementation of process_initialize_immutable_owner, a message was emitted to indicate that the user should upgrade to SPL Token 2022.
pub fn process_initialize_immutable_owner(accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let token_account_info = next_account_info(account_info_iter)?;
let account = Account::unpack_unchecked(&token_account_info.data.borrow())?;
if account.is_initialized() {
return Err(TokenError::AlreadyInUse.into());
}
! msg!("Please upgrade to SPL Token 2022 for immutable owner support");
Ok(())
}This message is not emitted in the new implementation; instead, it is just a comment in the code. We do not think there is any security implication in not emitting the message, but we mention it because we noticed the slight difference in behavior.
pub fn process_initialize_immutable_owner(accounts: &[AccountInfo]) -> ProgramResult {
let token_account_info = accounts.first().ok_or(ProgramError::NotEnoughAccountKeys)?;
// SAFETY: single immutable borrow to `token_account_info` account data.
let account = unsafe { load_unchecked::<Account>(token_account_info.borrow_data_unchecked())? };
if account.is_initialized()? {
return Err(TokenError::AlreadyInUse.into());
}
! // Please upgrade to SPL Token 2022 for immutable owner support.
Ok(())
}