-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Add commit_diff_and_undelegate_accounts() #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughUpdates workspace dependencies to use path-based references for two Magicblock crates, introduces a new CommitPolicy enum to control commit strategies (diff-based vs. full-byte), adds a new commit function for diff-based operations with undelegation, and modifies existing commit functions to route through the new policy system. Changes
Sequence DiagramsequenceDiagram
participant caller as Caller
participant commit as Commit Functions
participant policy as CommitPolicy Router
participant instr as MagicBlockInstruction
caller->>commit: commit_diff_and_undelegate_accounts()
commit->>policy: create_schedule_commit_ix(CommitPolicy::UseDiff, allow_undelegation=true)
activate policy
policy->>instr: Select ScheduleCommitDiffAndUndelegate
deactivate policy
instr-->>caller: Instruction
caller->>commit: commit_accounts() or commit_and_undelegate_accounts()
commit->>policy: create_schedule_commit_ix(CommitPolicy::UseFullBytes, ...)
activate policy
policy->>instr: Select ScheduleCommitAndUndelegate
deactivate policy
instr-->>caller: Instruction
note over policy: panic if UseDiff + allow_undelegation=false
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related issues
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
5a2cfb3 to
e8efc4c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
rust/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
rust/Cargo.toml(1 hunks)rust/sdk/src/ephem.rs(4 hunks)ts/web3js/package.json(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-28T14:28:30.386Z
Learnt from: GabrielePicco
Repo: magicblock-labs/ephemeral-rollups-sdk PR: 69
File: rust/pinocchio/src/instruction/undelegate.rs:22-0
Timestamp: 2025-10-28T14:28:30.386Z
Learning: In the undelegate function in rust/pinocchio/src/instruction/undelegate.rs, the buffer account is intentionally required to be a signer to enforce CPI (Cross-Program Invocation) authorization as part of the security model.
Applied to files:
rust/sdk/src/ephem.rs
|
We do not need this PR anymore, as magicblock-labs/magicblock-validator#575 is redesigned to not introduce |

This PR adds
commit_diff_and_undelegate_accounts()that invokesScheduleCommitDiffAndUndelegatein the magic program.I think this PR will eventually be reverted or at least this function will be removed, once I worked on top of magicblock-labs/magicblock-validator#575 and redesign the work eventually removing
ScheduleCommitDiffAndUndelegate. But for now, this works great and can stay till the redesign.Summary by CodeRabbit
New Features
Chores