Fix: token2022 support#1249
Conversation
|
Warning Review limit reached
More reviews will be available in 16 minutes and 4 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR extends ATA and eATA handling throughout the codebase to support the Token-2022 program alongside the standard Token Program. Core changes include introducing a Suggested reviewers
✨ 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 |
80c6028 to
a1f8a1d
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 945eda8181
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5332ee4e2e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6e7581ee4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs`:
- Around line 1375-1396: The code currently defaults ata_pubkey to
legacy_ata_pubkey and proceeds to project from eata_account even when neither
token_2022_ata_pubkey nor legacy_ata_pubkey were found in self.accounts_bank;
change the logic so that ata_pubkey is not pre-seeded (use Option for ata_pubkey
or only assign when a candidate is found), and after the loop if
in_bank_ata.is_none() simply return None instead of falling back to
eata_account; then call maybe_project_delegated_ata_from_eata only with the
found in_bank_ata (use in_bank_ata.as_ref().unwrap() safely) so the function
maybe_project_delegated_ata_from_eata(ata_account, eata_account, deleg_record)
is only invoked when an ATA was actually present in the bank.
In `@magicblock-chainlink/src/testing/eatas.rs`:
- Around line 25-32: The function create_token_2022_ata_account currently uses a
magic number 187 for the Token-2022 account data length; update the code by
adding a concise comment above or inline with create_token_2022_ata_account
(and/or where create_ata_account_with_token_program is called with
TOKEN_2022_PROGRAM_ID) explaining the breakdown of 187 (e.g., base account 165
bytes + 22 bytes for specific Token-2022 extensions used) so future maintainers
understand why 187 is chosen and when it should be changed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a9269482-2dea-47a8-9ffd-99319b1caad3
📒 Files selected for processing (10)
magicblock-chainlink/src/chainlink/fetch_cloner/ata_projection.rsmagicblock-chainlink/src/chainlink/fetch_cloner/delegation.rsmagicblock-chainlink/src/chainlink/fetch_cloner/mod.rsmagicblock-chainlink/src/chainlink/fetch_cloner/tests.rsmagicblock-chainlink/src/testing/eatas.rsmagicblock-core/src/token_programs.rsprograms/magicblock/src/clone_account/process_clone.rsprograms/magicblock/src/magic_scheduled_base_intent.rsprograms/magicblock/src/schedule_transactions/process_schedule_commit_tests.rstest-integration/configs/cloning-conf.ephem.toml
💤 Files with no reviewable changes (1)
- programs/magicblock/src/clone_account/process_clone.rs
thlorenz
left a comment
There was a problem hiding this comment.
LGTM regarding correctness, but the implementation has some repetition and adds eATA specific knowledge to the fetch cloner which isn't ideal.
I explained in the comments how we should improve this before merging.
Thanks @thlorenz, applied the suggestions |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@magicblock-chainlink/src/testing/eatas.rs`:
- Around line 37-53: The helper create_token_2022_ata_account_with_extensions
currently only computes data_len but returns an ATA whose data region beyond
SplAccount::LEN is zeroed; update it to actually initialize the Token-2022
TLV/extensions: after calling create_ata_account_with_token_program (or instead
of returning its Account directly), create/pack a spl_token_2022::state::Account
(Token2022Account) for the same owner/mint and use ExtensionType::populate or
the token-2022 packing helpers to write the requested account_extensions into
the account.data buffer so the returned Account contains the proper
Token2022Account header and initialized extension TLVs (referencing
create_token_2022_ata_account_with_extensions,
create_ata_account_with_token_program, Token2022Account, ExtensionType, and
TOKEN_2022_PROGRAM_ID).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 057ec09a-409b-4305-8f9b-2fbbb3978fea
📒 Files selected for processing (5)
magicblock-chainlink/src/chainlink/fetch_cloner/ata_projection.rsmagicblock-chainlink/src/chainlink/fetch_cloner/mod.rsmagicblock-chainlink/src/chainlink/fetch_cloner/tests.rsmagicblock-chainlink/src/testing/eatas.rsmagicblock-core/src/token_programs.rs
Summary by CodeRabbit
Release Notes
New Features
Tests