Assessment reports>SPL Token 2022>Discussion>Unnecessary initialization check

Unnecessary initialization check in _process_initialize_mint

When _process_initialize_mint calls StateWithExtensionMut::<Mint>::unpack_uninitialized(...), a check is performed internally that validates that the unpacked account is not initialized. This specifically validates that the base field is not initialized. As this condition is validated, the immediately proceding check is unnecessary and can never be true.

if mint.base.is_initialized {
    return Err(TokenError::AlreadyInUse.into());
}

The Solana Foundation engineering team addressed this discussion point and removed the redundant check in pull request #3763. The head commit of the PR d331f47 was merged in the master branch on October 26, 2022.

Zellic © 2024Back to top ↑