-
Notifications
You must be signed in to change notification settings - Fork 13
magicblock-program modification to migrate from ScheduledCommit to ScheduledAction #370
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
base: feat/base-layer-ix/main
Are you sure you want to change the base?
magicblock-program modification to migrate from ScheduledCommit to ScheduledAction #370
Conversation
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.
23 file(s) reviewed, 33 comment(s)
Edit PR Review Bot Settings | Greptile
fn scheduled_commits_len(&self) -> usize { | ||
self.transaction_scheduler.scheduled_commits_len() | ||
self.transaction_scheduler.scheduled_actions_len() | ||
} | ||
|
||
fn clear_scheduled_commits(&self) { | ||
self.transaction_scheduler.clear_scheduled_commits(); | ||
self.transaction_scheduler.clear_scheduled_actions(); | ||
} |
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.
style: Method names have been updated but the trait interface still uses 'commits' terminology. This inconsistency could cause confusion.
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.
Looks good overall, left a few questions and nits
pub commit_sent_transaction: Transaction, | ||
pub request_undelegation: bool, | ||
} | ||
// Q: can user initiate actions on arbitrary accounts? |
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.
Please rephrase the whole QA, currently it's not clear and incoherent.
pub request_undelegation: bool, | ||
} | ||
|
||
impl From<ScheduledCommit> for ScheduledAction { |
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.
Does this particular transition from commit to action (which is handled by delegation program) break anything. I.e. once the new delegation program is deployed, old validator code stops working until upgraded?
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.
Or does the DLP also maintain full backward compatibility, sorry for silly questions, I haven't seen the relevant changes to DLP.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
pub enum MagicAction { | ||
/// Actions without commitment or undelegation | ||
CallHandler(Vec<CallHandler>), |
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.
Are there any checks on how much data we can cram into this? As far as I understand this is further encoded into solana transaction which does have size limitation.
@@ -309,7 +307,9 @@ mod tests { | |||
data: Some(vec![1, 2, 3, 4, 5]), | |||
rent_epoch: Some(88), | |||
}; | |||
let ix = modify_accounts_instruction(vec![modification.clone()]); | |||
let ix = InstructionUtils::modify_accounts_instruction(vec![ |
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.
nit: but please turn this InstructionUtils to mod, it's so unrusty to use empty types for free functions, I know it's a matter of taste and yada-yada, but this is just a rust convention.
Pubkey, | ||
}; | ||
|
||
pub struct InstructionUtils; |
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.
please turn this into module
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.
Overall LGTM! Left a question
|
||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
pub struct Handler { | ||
pub escrow_index: u8, |
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.
Q: should the handler rely on a specific hardcoded index (e.g. 255) always used for the signing/handler or are there use-cases where multiple indexes are useful?
We could otherwise slightly simplify the code
83e7ba8
to
882edcb
Compare
…rted + some conversions
…it. Calling schedule action will throw an error for now
882edcb
to
0073370
Compare
This PR replaces
ScheduledCommit
withScheduledAction
in magicblock-program but not in validator. Replacement in validator will occur in follow up PR to split effort into smaller pieces. Right now ScheduledAction is converted to ScheduledCommit in validator, so it uses an old flowWith new ephemeral-sdk user can create something like:
Now our SDK will create
MagicActionArgs
from this information, so for example CallHandlerArgs will look like:And once we get this in
magicblock-program
we are able to reconstruct data from indices, seeMagicAction::try_from_args
.