Skip to content

Commit d65bbb9

Browse files
committed
Cleanup
1 parent ef8cde8 commit d65bbb9

File tree

8 files changed

+15
-75
lines changed

8 files changed

+15
-75
lines changed

magicblock-committor-service/src/intent_execution_manager/intent_execution_engine.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ where
242242
execution_permit: OwnedSemaphorePermit,
243243
result_sender: broadcast::Sender<BroadcastedIntentExecutionResult>,
244244
) {
245-
info!("execute: {:#?}", intent);
246245
let result = executor
247246
.execute(intent.inner.clone(), persister)
248247
.await

magicblock-committor-service/src/intent_executor/mod.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ pub mod single_stage_executor;
44
pub mod task_info_fetcher;
55
pub mod two_stage_executor;
66

7-
use core::slice;
87
use std::{ops::ControlFlow, sync::Arc, time::Duration};
98

109
use async_trait::async_trait;
1110
use futures_util::future::try_join_all;
12-
use log::{error, info, trace, warn};
11+
use log::{error, trace, warn};
1312
use magicblock_program::{
1413
magic_scheduled_base_intent::ScheduledBaseIntent,
1514
validator::validator_authority,
@@ -21,7 +20,6 @@ use magicblock_rpc_client::{
2120
use solana_pubkey::Pubkey;
2221
use solana_rpc_client_api::client_error::ErrorKind;
2322
use solana_sdk::{
24-
instruction::CompiledInstruction,
2523
message::VersionedMessage,
2624
signature::{Keypair, Signature, Signer, SignerError},
2725
transaction::{TransactionError, VersionedTransaction},
@@ -687,26 +685,9 @@ where
687685
// This is needed because DEFAULT_MAX_TIME_TO_PROCESSED is 50 sec
688686
while start.elapsed() < RETRY_FOR || i < MIN_RETRIES {
689687
i += 1;
690-
let message = prepared_message.clone();
691-
let changed = {
692-
let len = message.instructions().len();
693-
let ixs = unsafe {
694-
let ix = message.instructions().as_ptr()
695-
as *mut CompiledInstruction;
696-
slice::from_raw_parts_mut(ix, len)
697-
};
698-
let mut changed = 0;
699-
for ix in ixs.iter_mut() {
700-
if ix.data.len() != 0 && ix.data[0] == 16 {
701-
//ix.data[0] = 1; // CommitState
702-
changed += 1;
703-
}
704-
}
705-
changed
706-
};
707-
info!("> changed [{changed}] prepared_message: {:?}", message);
708688

709-
let result = self.send_prepared_message(message).await;
689+
let result =
690+
self.send_prepared_message(prepared_message.clone()).await;
710691
let flow = match result {
711692
Ok(result) => {
712693
return match result.into_result() {
@@ -727,7 +708,6 @@ where
727708
// TransactionError can be mapped to known set of error
728709
// We return right away to retry recovery, because this can't be fixed with retries
729710
ControlFlow::Break(TransactionStrategyExecutionError::from_transaction_error(err, tasks, |err| {
730-
error!("> ERROR: {:?}", err);
731711
MagicBlockRpcClientError::SentTransactionError(err, signature)
732712
}))
733713
}

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

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ impl BaseTask for ArgsTask {
7575
let chain_config =
7676
ChainConfig::local(ComputeBudgetConfig::new(1_000_000));
7777

78-
log::info!(
79-
"Fetch account from the main chain: {}",
80-
value.committed_account.pubkey
81-
);
8278
let rpc_client = RpcClient::new_with_commitment(
8379
chain_config.rpc_uri.to_string(),
8480
CommitmentConfig {
@@ -89,36 +85,9 @@ impl BaseTask for ArgsTask {
8985
let account = match rpc_client
9086
.get_account(&value.committed_account.pubkey)
9187
{
92-
Ok(account) => {
93-
log::debug!(
94-
"Account Found with datalen: {:?}",
95-
account
96-
);
97-
if account.data().len() == 0 {
98-
let args = CommitStateArgs {
99-
nonce: value.commit_id,
100-
lamports: value
101-
.committed_account
102-
.account
103-
.lamports,
104-
data: value
105-
.committed_account
106-
.account
107-
.data
108-
.clone(),
109-
allow_undelegation: value.allow_undelegation,
110-
};
111-
return dlp::instruction_builder::commit_state(
112-
*validator,
113-
value.committed_account.pubkey,
114-
value.committed_account.account.owner,
115-
args,
116-
);
117-
}
118-
account
119-
}
88+
Ok(account) => account,
12089
Err(e) => {
121-
log::error!("error while receiving account: {}", e);
90+
log::warn!("Fallback to commit_state and send full-bytes, as rpc failed to fetch the delegated-account from base chain: {}", e);
12291
let args = CommitStateArgs {
12392
nonce: value.commit_id,
12493
lamports: value.committed_account.account.lamports,
@@ -133,17 +102,16 @@ impl BaseTask for ArgsTask {
133102
);
134103
}
135104
};
105+
136106
let args = CommitDiffArgs {
137107
nonce: value.commit_id,
138108
lamports: value.committed_account.account.lamports,
139-
//diff: value.committed_account.account.data.clone(),
140109
diff: compute_diff(
141110
account.data(),
142111
value.committed_account.account.data(),
143112
),
144113
allow_undelegation: value.allow_undelegation,
145114
};
146-
147115
dlp::instruction_builder::commit_diff(
148116
*validator,
149117
value.committed_account.pubkey,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ pub enum TaskStrategy {
5353
pub trait BaseTask: Send + Sync + DynClone {
5454
/// Gets all pubkeys that involved in Task's instruction
5555
fn involved_accounts(&self, validator: &Pubkey) -> Vec<Pubkey> {
56-
// TODO (snawaz): can be optimized.
57-
// currently it is slow as it discards lots of computations and memory allocations.
56+
// TODO (snawaz): rewrite it.
57+
// currently it is slow as it discards heavy computations and memory allocations.
5858
self.instruction(validator)
5959
.accounts
6060
.iter()

programs/magicblock/src/magic_scheduled_base_intent.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,10 @@ impl CommitType {
446446
}
447447

448448
pub fn is_commit_diff(&self) -> bool {
449-
if let Self::StandaloneDiff(_) = self {
450-
true
451-
} else {
452-
false
453-
}
449+
let Self::StandaloneDiff(_) = self else {
450+
return false;
451+
};
452+
true
454453
}
455454

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

programs/magicblock/src/schedule_transactions/process_accept_scheduled_commits.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::collections::HashSet;
22

3-
use solana_log_collector::{ic_msg, log};
3+
use solana_log_collector::ic_msg;
44
use solana_program_runtime::invoke_context::InvokeContext;
55
use solana_sdk::{
66
account::ReadableAccount, instruction::InstructionError, pubkey::Pubkey,
@@ -108,7 +108,5 @@ pub fn process_accept_scheduled_commits(
108108
InstructionError::GenericError
109109
})?;
110110

111-
log::info!("process_accept_scheduled_commits DONE");
112-
113111
Ok(())
114112
}

programs/magicblock/src/schedule_transactions/process_schedule_commit.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::collections::HashSet;
22

3-
use solana_log_collector::{ic_msg, log};
3+
use solana_log_collector::ic_msg;
44
use solana_program_runtime::invoke_context::InvokeContext;
55
use solana_sdk::{
66
account::{Account, ReadableAccount},
@@ -255,7 +255,5 @@ pub(crate) fn process_schedule_commit(
255255
commit_sent_sig,
256256
);
257257

258-
log::info!("process_schedule_commit DONE");
259-
260258
Ok(())
261259
}

programs/magicblock/src/schedule_transactions/process_scheduled_commit_sent.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{
44
};
55

66
use lazy_static::lazy_static;
7-
use solana_log_collector::{ic_msg, log};
7+
use solana_log_collector::ic_msg;
88
use solana_program_runtime::invoke_context::InvokeContext;
99
use solana_sdk::{
1010
clock::Slot, hash::Hash, instruction::InstructionError, pubkey::Pubkey,
@@ -230,8 +230,6 @@ pub fn process_scheduled_commit_sent(
230230
ic_msg!(invoke_context, "ScheduledCommitSent requested commit_diff",);
231231
}
232232

233-
log::info!("process_scheduled_commit_sent DONE");
234-
235233
Ok(())
236234
}
237235

0 commit comments

Comments
 (0)