From aff515acd1fdaec3c82b2e6bcec9335cee3a1a60 Mon Sep 17 00:00:00 2001 From: febo Date: Wed, 3 Jun 2026 11:40:48 +0100 Subject: [PATCH 1/2] Update comments --- program/src/instruction.rs | 8 +++++--- program/src/processor/trim.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/program/src/instruction.rs b/program/src/instruction.rs index ce2c879..5aff66d 100644 --- a/program/src/instruction.rs +++ b/program/src/instruction.rs @@ -148,6 +148,8 @@ pub enum ProgramMetadataInstruction { /// minimum size required to be rent exempt, returning any extra /// lamports to the `destination` account. /// + /// Note: Immutable metadata accounts cannot be trimmed. + /// /// There are 2 optional accounts: /// - `program`: required to validate whether the authority is the program upgrade /// authority. @@ -160,8 +162,8 @@ pub enum ProgramMetadataInstruction { /// 1. `[s]` Authority account. /// 2. `[o]` Program account. /// 3. `[o]` Program data account. - /// 5. `[w]` Destination account. - /// 6. `[]` Rent sysvar account. + /// 4. `[w]` Destination account. + /// 5. `[ ]` Rent sysvar account. Trim, /// Closes a program-owned buffer or metadata account. @@ -184,7 +186,7 @@ pub enum ProgramMetadataInstruction { /// 1. `[s]` Metadata authority or buffer account. /// 2. `[o]` Program account. /// 3. `[o]` Program data account. - /// 5. `[w]` Destination account. + /// 4. `[w]` Destination account. Close, /// Allocates a buffer account. diff --git a/program/src/processor/trim.rs b/program/src/processor/trim.rs index 826c15d..3bf3365 100644 --- a/program/src/processor/trim.rs +++ b/program/src/processor/trim.rs @@ -23,7 +23,7 @@ pub fn trim(accounts: &mut [AccountView]) -> ProgramResult { // account // - authority must be a signer (checked by `validate_authority`) - // - must be a buffer or metadata account + // - must be a buffer or mutable metadata account // - must have a valid authority if account.is_data_empty() { From 44cd826feef0e51e6e3677241cd834ca88557c46 Mon Sep 17 00:00:00 2001 From: febo Date: Wed, 3 Jun 2026 12:22:40 +0100 Subject: [PATCH 2/2] One more update --- program/src/instruction.rs | 2 ++ program/src/processor/extend.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/program/src/instruction.rs b/program/src/instruction.rs index 5aff66d..fdd0c30 100644 --- a/program/src/instruction.rs +++ b/program/src/instruction.rs @@ -227,6 +227,8 @@ pub enum ProgramMetadataInstruction { /// The account is expected to be pre-funded with the required lamports /// for the new size. /// + /// Note: Immutable metadata accounts cannot be extended. + /// /// There are 2 optional accounts: /// - `program`: required to validate whether the authority is the program upgrade /// authority. diff --git a/program/src/processor/extend.rs b/program/src/processor/extend.rs index d0e4fc4..564e155 100644 --- a/program/src/processor/extend.rs +++ b/program/src/processor/extend.rs @@ -36,7 +36,7 @@ pub fn extend(accounts: &mut [AccountView], instruction_data: &[u8]) -> ProgramR // account // - authority must be a signer (validated by `validate_authority`) - // - must be a buffer or metadata account + // - must be a buffer or mutable metadata account // - must have a valid authority // - must be rent exempt (pre-funded account) since we are reallocating the buffer // account