Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions magicblock-magic-program-api/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,16 @@ pub enum MagicBaseIntentArgs {
BaseActions(Vec<BaseActionArgs>),
Commit(CommitTypeArgs),
CommitAndUndelegate(CommitAndUndelegateArgs),
CommitFinalize(CommitTypeArgs),
CommitFinalizeAndUndelegate(CommitAndUndelegateArgs),
}

#[derive(Clone, Default, Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct MagicIntentBundleArgs {
pub commit: Option<CommitTypeArgs>,
pub commit_and_undelegate: Option<CommitAndUndelegateArgs>,
pub commit_finalize: Option<CommitTypeArgs>,
pub commit_finalize_and_undelegate: Option<CommitAndUndelegateArgs>,
pub standalone_actions: Vec<BaseActionArgs>,
}

Expand All @@ -105,6 +109,12 @@ impl From<MagicBaseIntentArgs> for MagicIntentBundleArgs {
MagicBaseIntentArgs::CommitAndUndelegate(value) => {
this.commit_and_undelegate = Some(value)
}
MagicBaseIntentArgs::CommitFinalize(value) => {
this.commit_finalize = Some(value)
}
MagicBaseIntentArgs::CommitFinalizeAndUndelegate(value) => {
this.commit_finalize_and_undelegate = Some(value)
}
}

this
Expand Down
16 changes: 16 additions & 0 deletions magicblock-magic-program-api/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,22 @@ pub enum MagicBlockInstruction {
/// - **1.** `[WRITE]` Ephemeral account to close
/// - **2.** `[WRITE]` Vault account (source of rent refund)
CloseEphemeralAccount,

/// Schedules the accounts provided at end of accounts Vec to be committed and finalized in a
/// single DLP instruction.
/// It should be invoked from the program whose PDA accounts are to be
/// committed.
///
/// This is the first part of scheduling a commit.
/// A second transaction [MagicBlockInstruction::AcceptScheduleCommits] has to run in order
/// to finish scheduling the commit.
///
/// # Account references
/// - **0.** `[WRITE, SIGNER]` Payer requesting the commit to be scheduled
/// - **1.** `[WRITE]` Magic Context Account containing to which we store
/// the scheduled commits
/// - **2..n** `[]` Accounts to be committed
ScheduleCommitFinalize { request_undelegation: bool },
}

impl MagicBlockInstruction {
Expand Down
2 changes: 2 additions & 0 deletions programs/magicblock/src/magic_scheduled_base_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ impl MagicBaseIntent {
CommitAndUndelegate::try_from_args(type_, context)?;
Ok(MagicBaseIntent::CommitAndUndelegate(commit_and_undelegate))
}
MagicBaseIntentArgs::CommitFinalize(_) => todo!(),
MagicBaseIntentArgs::CommitFinalizeAndUndelegate(_) => todo!(),
}
}

Expand Down
3 changes: 3 additions & 0 deletions programs/magicblock/src/magicblock_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ declare_process_instruction!(
request_undelegation: true,
},
),
ScheduleCommitFinalize {
request_undelegation: _,
} => todo!(),
AcceptScheduleCommits => {
process_accept_scheduled_commits(signers, invoke_context)
}
Expand Down
Loading