Skip to content

Commit 7eaaa13

Browse files
committed
Cleanup
1 parent 5e300b3 commit 7eaaa13

File tree

11 files changed

+340
-78
lines changed

11 files changed

+340
-78
lines changed

Cargo.lock

Lines changed: 137 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

magicblock-committor-service/src/tasks/args_task.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl BaseTask for ArgsTask {
8787
{
8888
Ok(account) => account,
8989
Err(e) => {
90-
log::warn!("Fallback to commit_state and send full-bytes, as rpc failed to fetch the delegated-account from base chain: {}", e);
90+
log::warn!("Fallback to commit_state and send full-bytes, as rpc failed to fetch the delegated-account from base chain, commmit_id: {} , error: {}", value.commit_id, e);
9191
let args = CommitStateArgs {
9292
nonce: value.commit_id,
9393
lamports: value.committed_account.account.lamports,
@@ -109,10 +109,10 @@ impl BaseTask for ArgsTask {
109109
diff: compute_diff(
110110
account.data(),
111111
value.committed_account.account.data(),
112-
),
112+
)
113+
.to_vec(),
113114
allow_undelegation: value.allow_undelegation,
114115
};
115-
log::warn!("DIFF computed: {:?}", args.diff);
116116
dlp::instruction_builder::commit_diff(
117117
*validator,
118118
value.committed_account.pubkey,
@@ -168,9 +168,8 @@ impl BaseTask for ArgsTask {
168168
BufferTaskType::Commit(value),
169169
)))
170170
}
171-
ArgsTaskType::CommitDiff(_) => {
172-
panic!("ArgsTaskType::CommitDiff not handled")
173-
}
171+
// TODO (snawaz): discuss this with reviewers
172+
ArgsTaskType::CommitDiff(_) => Err(self),
174173
ArgsTaskType::BaseAction(_)
175174
| ArgsTaskType::Finalize(_)
176175
| ArgsTaskType::Undelegate(_) => Err(self),
@@ -227,9 +226,8 @@ impl BaseTask for ArgsTask {
227226
}
228227

229228
fn reset_commit_id(&mut self, commit_id: u64) {
230-
// TODO (snawaz): handle CommitDiff as well?
229+
// TODO (snawaz): handle CommitDiff as well? what is it about?
231230
let ArgsTaskType::Commit(commit_task) = &mut self.task_type else {
232-
log::error!("reset_commit_id");
233231
return;
234232
};
235233

magicblock-rpc-client/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ impl MagicblockRpcClient {
427427
.await?;
428428

429429
if let Err(err) = processed_status {
430-
error!("> ERROR: {:?}", err);
431430
return Err(MagicBlockRpcClientError::SentTransactionError(
432431
err, sig,
433432
));

programs/magicblock/src/magic_scheduled_base_intent.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,7 @@ impl CommitType {
446446
}
447447

448448
pub fn is_commit_diff(&self) -> bool {
449-
let Self::StandaloneDiff(_) = self else {
450-
return false;
451-
};
452-
true
449+
matches!(self, Self::StandaloneDiff(_))
453450
}
454451

455452
pub fn get_committed_accounts(&self) -> &Vec<CommittedAccount> {

programs/magicblock/src/magicblock_processor.rs

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use magicblock_magic_program_api::instruction::MagicBlockInstruction;
2-
use solana_log_collector::ic_msg;
32
use solana_program_runtime::declare_process_instruction;
43
use solana_sdk::program_utils::limited_deserialize;
54

@@ -35,8 +34,6 @@ declare_process_instruction!(
3534
transaction_context.get_current_instruction_context()?;
3635
let signers = instruction_context.get_signers(transaction_context)?;
3736

38-
ic_msg!(invoke_context, "MagicBlockInstruction: {:?}", instruction);
39-
4037
match instruction {
4138
ModifyAccounts(mut account_mods) => process_mutate_accounts(
4239
signers,
@@ -52,17 +49,15 @@ declare_process_instruction!(
5249
request_diff: false,
5350
},
5451
),
55-
MagicBlockInstruction::ScheduleCommitAndUndelegate => {
56-
process_schedule_commit(
57-
signers,
58-
invoke_context,
59-
ProcessScheduleCommitOptions {
60-
request_undelegation: true,
61-
request_diff: false,
62-
},
63-
)
64-
}
65-
MagicBlockInstruction::AcceptScheduleCommits => {
52+
ScheduleCommitAndUndelegate => process_schedule_commit(
53+
signers,
54+
invoke_context,
55+
ProcessScheduleCommitOptions {
56+
request_undelegation: true,
57+
request_diff: false,
58+
},
59+
),
60+
AcceptScheduleCommits => {
6661
process_accept_scheduled_commits(signers, invoke_context)
6762
}
6863
ScheduledCommitSent((id, _bump)) => process_scheduled_commit_sent(
@@ -87,16 +82,14 @@ declare_process_instruction!(
8782
EnableExecutableCheck => {
8883
process_toggle_executable_check(signers, invoke_context, true)
8984
}
90-
MagicBlockInstruction::ScheduleCommitDiffAndUndelegate => {
91-
process_schedule_commit(
92-
signers,
93-
invoke_context,
94-
ProcessScheduleCommitOptions {
95-
request_undelegation: true,
96-
request_diff: true,
97-
},
98-
)
99-
}
85+
ScheduleCommitDiffAndUndelegate => process_schedule_commit(
86+
signers,
87+
invoke_context,
88+
ProcessScheduleCommitOptions {
89+
request_undelegation: true,
90+
request_diff: true,
91+
},
92+
),
10093
}
10194
}
10295
);

programs/magicblock/src/schedule_transactions/process_schedule_commit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ pub(crate) fn process_schedule_commit(
222222
let commit_sent_sig = action_sent_transaction.signatures[0];
223223

224224
let commit_action = if opts.request_diff {
225-
ic_msg!(invoke_context, "CommitType::StandaloneDiff");
226225
CommitType::StandaloneDiff(committed_accounts)
227226
} else {
228227
CommitType::Standalone(committed_accounts)

0 commit comments

Comments
 (0)