From f2da063df93927b5f0f386f1d5954acdb385fc39 Mon Sep 17 00:00:00 2001 From: ananas-block Date: Mon, 9 Feb 2026 08:04:57 +0100 Subject: [PATCH 1/2] fix: add MintCloseAuthority as restricted extension (M-03) A mint with MintCloseAuthority can be closed and re-opened with different extensions. Treating it as restricted ensures compressed tokens from such mints require CompressedOnly mode. --- program-libs/token-interface/src/token_2022_extensions.rs | 7 ++++++- .../program/src/extensions/check_mint_extensions.rs | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/program-libs/token-interface/src/token_2022_extensions.rs b/program-libs/token-interface/src/token_2022_extensions.rs index f0a6b3b363..b428512c1a 100644 --- a/program-libs/token-interface/src/token_2022_extensions.rs +++ b/program-libs/token-interface/src/token_2022_extensions.rs @@ -6,12 +6,13 @@ use crate::state::ExtensionStructConfig; /// Restricted extension types that require compression_only mode. /// These extensions have special behaviors (pausable, permanent delegate, fees, hooks, /// default frozen state) that are incompatible with standard compressed token transfers. -pub const RESTRICTED_EXTENSION_TYPES: [ExtensionType; 5] = [ +pub const RESTRICTED_EXTENSION_TYPES: [ExtensionType; 6] = [ ExtensionType::Pausable, ExtensionType::PermanentDelegate, ExtensionType::TransferFeeConfig, ExtensionType::TransferHook, ExtensionType::DefaultAccountState, + ExtensionType::MintCloseAuthority, ]; /// Allowed mint extension types for Token accounts. @@ -53,6 +54,7 @@ pub const fn is_restricted_extension(ext: &ExtensionType) -> bool { | ExtensionType::TransferFeeConfig | ExtensionType::TransferHook | ExtensionType::DefaultAccountState + | ExtensionType::MintCloseAuthority ) } @@ -71,6 +73,8 @@ pub struct MintExtensionFlags { pub has_transfer_fee: bool, /// Whether the mint has the TransferHook extension (with nil program_id) pub has_transfer_hook: bool, + /// Whether the mint has the MintCloseAuthority extension + pub has_mint_close_authority: bool, } impl MintExtensionFlags { @@ -152,5 +156,6 @@ impl MintExtensionFlags { || self.has_transfer_fee || self.has_transfer_hook || self.has_default_account_state + || self.has_mint_close_authority } } diff --git a/programs/compressed-token/program/src/extensions/check_mint_extensions.rs b/programs/compressed-token/program/src/extensions/check_mint_extensions.rs index fd8de46947..05fea28f21 100644 --- a/programs/compressed-token/program/src/extensions/check_mint_extensions.rs +++ b/programs/compressed-token/program/src/extensions/check_mint_extensions.rs @@ -190,6 +190,7 @@ pub fn has_mint_extensions(mint_account: &AccountInfo) -> Result Result has_transfer_fee = true, ExtensionType::TransferHook => has_transfer_hook = true, ExtensionType::DefaultAccountState => has_default_account_state = true, + ExtensionType::MintCloseAuthority => has_mint_close_authority = true, _ => {} } } @@ -224,5 +226,6 @@ pub fn has_mint_extensions(mint_account: &AccountInfo) -> Result Date: Tue, 10 Feb 2026 00:37:10 +0000 Subject: [PATCH 2/2] test: add MintCloseAuthority compression_only requirement tests Add test coverage for MintCloseAuthority requiring compression_only mode, complementing the fix in f2da063df. --- .../tests/compress_only/restricted_required.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs b/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs index 5c3619eb37..8737379c5e 100644 --- a/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs +++ b/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs @@ -2,7 +2,7 @@ //! //! These tests verify that Light Token accounts cannot be created without compression_only //! when the mint has restricted extensions (Pausable, PermanentDelegate, TransferFeeConfig, -//! TransferHook, DefaultAccountState). +//! TransferHook, DefaultAccountState, MintCloseAuthority). use light_program_test::{ program_test::LightProgramTest, utils::assert::assert_rpc_error, ProgramTestConfig, Rpc, @@ -96,6 +96,12 @@ async fn test_default_account_state_requires_compression_only() { test_compression_only_required_for_extensions(&[ExtensionType::DefaultAccountState]).await; } +#[tokio::test] +#[serial] +async fn test_mint_close_authority_requires_compression_only() { + test_compression_only_required_for_extensions(&[ExtensionType::MintCloseAuthority]).await; +} + #[tokio::test] #[serial] async fn test_multiple_restricted_requires_compression_only() { @@ -104,6 +110,7 @@ async fn test_multiple_restricted_requires_compression_only() { ExtensionType::PermanentDelegate, ExtensionType::TransferFeeConfig, ExtensionType::TransferHook, + ExtensionType::MintCloseAuthority, ]) .await; }