Skip to content

feat: prepare empty accounts - #104

Draft
Dodecahedr0x wants to merge 2 commits into
dode/adb-slot-reusefrom
dode/prepare-empty-writable
Draft

feat: prepare empty accounts#104
Dodecahedr0x wants to merge 2 commits into
dode/adb-slot-reusefrom
dode/prepare-empty-writable

Conversation

@Dodecahedr0x

@Dodecahedr0x Dodecahedr0x commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What changed

AccountAccessor::create now scans the bundled post-finalize actions for writable accounts that are absent (or only a slot-0 placeholder) and prepends a new MagicRootInstruction::Prepare per missing account to the same transaction. Prepare (magic-root-program) materializes the target as an empty system-owned account only if it still does not exist at execution time and is a no-op otherwise, making the "create the shared writables my actions need" step idempotent.

Closes #101

Impact

Post-finalize actions can initialize ER-only PDAs that did not exist when the create was composed, and concurrent creates naming the same missing account converge on whichever transaction materializes it first instead of failing each other with PostFinalize: Immutable. Adds one instruction variant to the magic-root interface; existing instructions are unchanged.

Reviewer notes

The idempotency check in account::prepare is is(AccountMode::Placeholder) && slot() == 0, i.e. "never materialized"; anything else is left untouched. missing_writable_action_accounts deduplicates and skips the created account itself. Tests: prepare_creates_missing_and_noops_on_existing and concurrent_creates_share_one_missing_writable in engine/tests/accounts.rs.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 6 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 08fde231-d0ea-40e3-9c29-f546089047bb

📥 Commits

Reviewing files that changed from the base of the PR and between 965d339 and d71c8b2.

📒 Files selected for processing (8)
  • engine/Cargo.toml
  • engine/src/accessor.rs
  • engine/tests/accounts.rs
  • programs/magic-root-interface/src/lib.rs
  • programs/magic-root-program/Cargo.toml
  • programs/magic-root-program/README.md
  • programs/magic-root-program/src/account.rs
  • programs/magic-root-program/src/processor.rs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Dodecahedr0x
Dodecahedr0x force-pushed the dode/prepare-empty-writable branch from 596da51 to ab148d3 Compare August 28, 2026 09:52
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.

Concurrent creates sharing a missing writable action account fail their post-finalize actions

1 participant