fix: don't expect tokens out queue for mint to ctoken#2077
fix: don't expect tokens out queue for mint to ctoken#2077ananas-block wants to merge 1 commit intomainfrom
Conversation
WalkthroughThe change modifies the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
programs/compressed-token/program/src/mint_action/accounts.rs(1 hunks)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: cli-v1
- GitHub Check: Forester e2e test
- GitHub Check: stateless-js-v1
- GitHub Check: stateless-js-v2
| // 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(_))); |
There was a problem hiding this comment.
🧩 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.
Issue:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.