Skip to content

feat: protect authoritative accounts from overwrites - #37

Merged
bmuddha merged 0 commit into
replicatorfrom
authoritative-flag
Aug 5, 2026
Merged

feat: protect authoritative accounts from overwrites#37
bmuddha merged 0 commit into
replicatorfrom
authoritative-flag

Conversation

@bmuddha

@bmuddha bmuddha commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Reinterpret persisted state-flag bit 1 as AUTHORITATIVE and remove the compressed-account builder API without changing the serialized account layout.
  • Mark delegated and transient targets authoritative after successful MagicRoot finalization, then reject later MagicRoot mutations with PrivilegeEscalation.
  • Preserve atomic create-with-actions by allowing PostFinalize only immediately after the matching successful Finalize at the same stack height and caller.
  • Keep non-authoritative replacement, large-transaction replication, and slot-ordering coverage aligned with the new boundary.

Closes #35, closes #36

Impact

Finalized delegated and transient accounts can no longer be overwritten by a higher-slot replacement, including through builtin CPI callers. Read-only, placeholder, system, ephemeral, and closed targets are not automatically marked authoritative. Existing persisted bit 1 values are intentionally reinterpreted; no migration or wire-layout change is introduced.

Validation

  • cargo test -p solana-account — passed
  • cargo test -p solana-transaction-context — passed
  • cargo test -p magic-root-program — passed
  • cargo test -p magicblock-engine --test accounts — passed
  • cargo test -p magicblock-engine --test security — passed
  • cargo test --workspace — passed
  • git diff --check — passed

Reviewer notes

The ordering-sensitive boundary is in MagicRoot target authorization: the authoritative flag is applied only after executable loading succeeds, and the PostFinalize exception matches the immediately preceding trace entry by program, target, stack height, and caller.

@bmuddha bmuddha self-assigned this Aug 5, 2026
@bmuddha
bmuddha force-pushed the authoritative-flag branch from 3080bb3 to 2a0c67f Compare August 5, 2026 11:57
@bmuddha
bmuddha marked this pull request as ready for review August 5, 2026 11:57
@bmuddha
bmuddha force-pushed the authoritative-flag branch 3 times, most recently from b451f22 to c61b395 Compare August 5, 2026 12:50
@bmuddha bmuddha closed this Aug 5, 2026
@bmuddha
bmuddha force-pushed the authoritative-flag branch from c61b395 to 9bda1be Compare August 5, 2026 13:26
@bmuddha
bmuddha merged commit 9bda1be into master Aug 5, 2026
@bmuddha
bmuddha deleted the authoritative-flag branch August 5, 2026 13:26
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.

Remove compressed state flag from account layout Prevent authoritative account overwrites in magic-root

1 participant