Skip to content

fix: execute post-delegation actions after clone#1278

Merged
GabrielePicco merged 18 commits into
masterfrom
fix/dedup-action-by-construction
Jun 3, 2026
Merged

fix: execute post-delegation actions after clone#1278
GabrielePicco merged 18 commits into
masterfrom
fix/dedup-action-by-construction

Conversation

@GabrielePicco
Copy link
Copy Markdown
Collaborator

@GabrielePicco GabrielePicco commented Jun 2, 2026

Summary

  • Move post-delegation actions behind clone completion by emitting a dedicated top-level executor instruction immediately after clone or final clone-continue.
  • The executor validates the immediately previous top-level Magic clone sibling through the instruction sysvar before invoking actions, so actions run once and only after the delegated account has been cloned. Note: direct invoke from clone is not viable as there is re-entracy if post-delegations actions commit/undelegated
  • Depend on the magicblock-svm solana-svm crate fix from magicblock-svm#24 to keep that exact clone -> PostAct transaction shape privileged.
  • NOTE: this makes post-delegation actions fully replicable as self-contained in a single transaction

Breaking Changes

  • None
  • Yes — migration path described below

Summary by CodeRabbit

  • New Features

    • Post-delegation actions can be embedded in clone flows and executed via a new executor program; clone instructions carry explicit action payloads.
    • Task assembly can include a standalone-action noop instruction to support single-action flows.
  • Bug Fixes

    • Stronger validation and ordering for delegated clones to prevent invalid or duplicate action-bearing clones and ordering regressions.
  • Tests

    • Expanded unit and integration tests covering delegated cloning, post-delegation execution, and related invariants.

@coderabbitai

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as outdated.

@GabrielePicco GabrielePicco changed the title fix: dedup by contructions fix: execute post-delegation actions after clone Jun 2, 2026
coderabbitai[bot]

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as outdated.

@GabrielePicco GabrielePicco marked this pull request as ready for review June 2, 2026 23:29
@GabrielePicco GabrielePicco requested review from bmuddha and snawaz June 2, 2026 23:30
chatgpt-codex-connector[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@snawaz snawaz left a comment

Choose a reason for hiding this comment

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

I skimmed through it. Haven't finished reviewing it yet.

So far it looks good, especially the idea of executing actions inside a top-level ix. Looks clean!

It works on my machine!

I posted one comment with the concern tag. 🤔

Review still in progress.

Comment thread magicblock-account-cloner/src/lib.rs Outdated
Comment thread magicblock-magic-program-api/src/instruction.rs Outdated
Comment thread programs/magicblock/src/clone_account/common.rs
Comment thread programs/magicblock/src/clone_account/common.rs
Comment thread magicblock-magic-program-api/src/instruction.rs Outdated
coderabbitai[bot]

This comment was marked as outdated.

Comment thread magicblock-account-cloner/src/lib.rs Outdated
Comment thread magicblock-magic-program-api/src/instruction.rs Outdated
Comment thread magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs
Comment thread magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs
Comment thread programs/magicblock/src/clone_account/common.rs
Comment thread programs/magicblock/src/clone_account/common.rs Outdated
chatgpt-codex-connector[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa356415ac

ℹ️ 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".

Comment thread magicblock-account-cloner/src/lib.rs
Copy link
Copy Markdown
Contributor

@snawaz snawaz left a comment

Choose a reason for hiding this comment

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

LGTM.

Comment thread magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs
@GabrielePicco GabrielePicco merged commit 70b1dc6 into master Jun 3, 2026
37 checks passed
@GabrielePicco GabrielePicco deleted the fix/dedup-action-by-construction branch June 3, 2026 13:14
Comment thread magicblock-account-cloner/src/lib.rs Outdated
Comment thread magicblock-account-cloner/src/lib.rs
thlorenz added a commit that referenced this pull request Jun 4, 2026
* master:
  chore: simplify, rename out_of_order_slot and add a comment (#1284)
  fix: execute post-delegation actions after clone (#1278)
  Handle oversized single-stage committor transactions (#1277)
  Reduce committor RPC confirmation calls (#1271)
  fix: preserve streams on optimize failure (#1273)
  perf: reduce TableMania ALT polling (#1276)
  feat: bundle session-key program in mb-test-validator (#1275)
  fix: limit pending intent recovery window (#1274)
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