feat: prepare empty accounts - #104
Draft
Dodecahedr0x wants to merge 2 commits into
Draft
Conversation
|
Warning Review limit reachedNext included review available in 6 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
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 |
Dodecahedr0x
force-pushed
the
dode/prepare-empty-writable
branch
2 times, most recently
from
August 28, 2026 09:52
8424cdd to
596da51
Compare
Dodecahedr0x
force-pushed
the
dode/prepare-empty-writable
branch
from
August 28, 2026 09:52
596da51 to
ab148d3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
AccountAccessor::createnow scans the bundled post-finalize actions for writable accounts that are absent (or only a slot-0 placeholder) and prepends a newMagicRootInstruction::Prepareper 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::prepareisis(AccountMode::Placeholder) && slot() == 0, i.e. "never materialized"; anything else is left untouched.missing_writable_action_accountsdeduplicates and skips the created account itself. Tests:prepare_creates_missing_and_noops_on_existingandconcurrent_creates_share_one_missing_writableinengine/tests/accounts.rs.