-
Notifications
You must be signed in to change notification settings - Fork 14
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
Open
taco-paco
wants to merge
11
commits into
feat/base-layer-ix/main
Choose a base branch
from
feat/base-layer-ix/magicblock-program
base: feat/base-layer-ix/main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b7b6e4b
feat: added construction of ScheduleAction
taco-paco 0cfda9c
refactor: changed file structure
taco-paco f9f0307
feat: replace ScheduledCommit -> SceduledAction in MagicContext
taco-paco a2a372b
refactor: namings + some logging
taco-paco c0cf401
refactor: separate file for accepted commits
taco-paco 9775d7d
feat: error on process_schedule_action call until feature fully suppo…
taco-paco 597435e
feat: until supported converting ScheduledAction to old ScheduledComm…
taco-paco a955a12
fix: tests + bug
taco-paco 39c4fd4
refactor: renamings
taco-paco 1abe69c
fix: bug
taco-paco 0073370
fix: rebase
taco-paco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,8 @@ use magicblock_committor_service::{ | |
}; | ||
use magicblock_processor::execute_transaction::execute_legacy_transaction; | ||
use magicblock_program::{ | ||
register_scheduled_commit_sent, FeePayerAccount, Pubkey, SentCommit, | ||
TransactionScheduler, | ||
register_scheduled_commit_sent, FeePayerAccount, Pubkey, ScheduledCommit, | ||
SentCommit, TransactionScheduler, | ||
}; | ||
use magicblock_transaction_status::TransactionStatusSender; | ||
use solana_sdk::{ | ||
|
@@ -47,8 +47,19 @@ impl ScheduledCommitsProcessor for RemoteScheduledCommitsProcessor { | |
IAP: InternalAccountProvider, | ||
CC: ChangesetCommittor, | ||
{ | ||
let scheduled_commits = | ||
self.transaction_scheduler.take_scheduled_commits(); | ||
let scheduled_actions = | ||
self.transaction_scheduler.take_scheduled_actions(); | ||
|
||
// TODO(edwin): remove once actions are supported | ||
let scheduled_commits: Vec<ScheduledCommit> = scheduled_actions | ||
.into_iter() | ||
.filter_map(|action| { | ||
action | ||
.try_into() | ||
.inspect_err(|err| error!("Unexpected action: {:?}", err)) | ||
.ok() | ||
}) | ||
.collect(); | ||
|
||
if scheduled_commits.is_empty() { | ||
return Ok(()); | ||
|
@@ -182,11 +193,11 @@ impl ScheduledCommitsProcessor for RemoteScheduledCommitsProcessor { | |
} | ||
|
||
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(); | ||
} | ||
Comment on lines
195
to
201
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
} | ||
|
||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
pub struct HandlerArgs { | ||
pub escrow_index: u8, | ||
pub data: Vec<u8>, | ||
} | ||
|
||
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] | ||
pub struct CallHandlerArgs { | ||
pub args: HandlerArgs, | ||
pub destination_program: u8, // index of the account | ||
pub accounts: Vec<u8>, // indices of account | ||
taco-paco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] | ||
pub enum CommitTypeArgs { | ||
Standalone(Vec<u8>), // indices on accounts | ||
WithHandler { | ||
committed_accounts: Vec<u8>, // indices of accounts | ||
call_handlers: Vec<CallHandlerArgs>, | ||
}, | ||
} | ||
|
||
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] | ||
pub enum UndelegateTypeArgs { | ||
Standalone, | ||
WithHandler { call_handlers: Vec<CallHandlerArgs> }, | ||
} | ||
|
||
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] | ||
pub struct CommitAndUndelegateArgs { | ||
pub commit_type: CommitTypeArgs, | ||
pub undelegate_type: UndelegateTypeArgs, | ||
} | ||
|
||
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] | ||
pub enum MagicActionArgs { | ||
L1Action(Vec<CallHandlerArgs>), | ||
Commit(CommitTypeArgs), | ||
CommitAndUndelegate(CommitAndUndelegateArgs), | ||
} |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.