Skip to content

fix(lang): Enforce mut constraint on Migration accounts - #4951

Open
spellsaif wants to merge 1 commit into
otter-sec:masterfrom
spellsaif:fix/migration-require-mut
Open

fix(lang): Enforce mut constraint on Migration accounts#4951
spellsaif wants to merge 1 commit into
otter-sec:masterfrom
spellsaif:fix/migration-require-mut

Conversation

@spellsaif

Copy link
Copy Markdown

Migration<'info, From, To> relies on AccountsExit::exit to persist the migrated state to storage. Because exit.rs skips generating exit routines for non-mutable fields (match f.constraints.is_mutable() { false => quote! {} }), declaring a Migration without #[account(mut)] resulted in silent state loss despite the instruction succeeding.

This PR adds a compile-time check in constraints_cross_checks requiring Migration accounts to be marked mut.

Testing

  • Added unit tests in lang/syn/tests/migration_mut.rs verifying:
    • Migration without #[account(mut)] produces a compile-time parse error.
    • Migration with #[account(mut)] parses successfully.
  • cargo test -p anchor-syn passed.
  • cargo clippy -p anchor-syn -- -D warnings passed (0 warnings).

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

@spellsaif is attempting to deploy a commit to the OtterSec Team on Vercel.

A member of the Team first needs to authorize it.

@0x4ka5h

0x4ka5h commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

fix CI

@spellsaif

spellsaif commented Aug 20, 2026

Copy link
Copy Markdown
Author

@0x4ka5h can you rerun it again it. I think it is rate limit problem

@swaroop-osec swaroop-osec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants