Skip to content
Closed
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
13 changes: 5 additions & 8 deletions programs/compressed-token/program/src/mint_action/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,14 +449,11 @@ impl AccountsConfig {
create_mint: parsed_instruction_data.create_mint.is_some(),
})
} else {
// For MintTo or MintToCToken actions
// - needed for tokens_out_queue and authority validation
let has_mint_to_actions = parsed_instruction_data.actions.iter().any(|action| {
matches!(
action,
ZAction::MintToCompressed(_) | ZAction::MintToCToken(_)
)
});
// Used to expect tokens_out_queue for MintToCompressed action.
let has_mint_to_actions = parsed_instruction_data
.actions
.iter()
.any(|action| matches!(action, ZAction::MintToCompressed(_)));
Comment on lines +452 to +456
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify that MintToCToken actions don't require tokens_out_queue.

The narrowing of the condition to only check MintToCompressed aligns with the PR objective and the comment at line 121 ("Only needed for minting to compressed token accounts"). This change will cause tokens_out_queue to not be expected when only MintToCToken actions are present.

However, confirm that MintToCToken action processing doesn't rely on tokens_out_queue being present in the ExecutingAccounts struct, and that recipient token accounts from packed_accounts (mentioned in the comment at line 36) are sufficient.

Run the following script to verify the implementation:


🏁 Script executed:

#!/bin/bash
# Description: Verify MintToCToken action implementation doesn't use tokens_out_queue

# Search for MintToCToken action processing to check if it accesses tokens_out_queue
ast-grep --pattern $'match $_ {
  $$$
  ZAction::MintToCToken($_) => {
    $$$
  }
  $$$
}'

# Also search for any direct references to tokens_out_queue in action processing
rg -n -C5 'tokens_out_queue' --type=rust -g '!target/**'

# Search for where MintToCToken actions are handled
rg -n -C5 'MintToCToken' --type=rust -g '!target/**'

Length of output: 94730


Looking at the script output provided, I can now identify a critical inconsistency that the review comment missed:

The script output shows that the test file contradicts the program change. At programs/compressed-token/program/tests/mint_action.rs lines 227-232, the test checks for both MintToCompressed and MintToCToken:

let has_mint_to_actions = data.actions.iter().any(|action| {
    matches!(
        action,
        Action::MintToCompressed(_) | Action::MintToCToken(_)
    )
});

However, the program change in accounts.rs lines 452-456 narrows this to only MintToCompressed. This creates a mismatch: the test expects tokens_out_queue to be required for both actions, but the program code now only requires it for MintToCompressed.


Test file condition still checks both MintToCompressed and MintToCToken actions.

The narrowed condition in the program (lines 452-456) now only checks for MintToCompressed, but the test file (programs/compressed-token/program/tests/mint_action.rs:227-232) still checks for both actions when calculating has_mint_to_actions. This creates a test-to-implementation mismatch.

Verify that the test file was updated to match the narrowed condition. If the test wasn't updated, it will have incorrect expectations about when tokens_out_queue is required, potentially masking bugs where MintToCToken actions incorrectly pass without the required tokens_out_queue account.

🤖 Prompt for AI Agents
In programs/compressed-token/program/src/mint_action/accounts.rs around lines
452-456 the code only treats MintToCompressed as requiring tokens_out_queue, but
the test programs/compressed-token/program/tests/mint_action.rs (lines 227-232)
still checks for both MintToCompressed and MintToCToken; update the test to
match the program change by changing its has_mint_to_actions predicate to only
check for Action::MintToCompressed(_) (or alternatively, if the original
behavior is desired, revert/expand the program check to include MintToCToken),
then run the test suite to confirm the expectation and account requirement are
aligned.


Ok(AccountsConfig {
with_cpi_context,
Expand Down
Loading