Skip to content
Open
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
18 changes: 17 additions & 1 deletion magicblock-api/src/magic_sys_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ use std::{collections::HashMap, sync::Arc, time::Duration};
use magicblock_committor_service::{
committor_processor::CommittorProcessor,
intent_executor::task_info_fetcher::TaskInfoFetcherResult,
tasks::intent_size_validator::IntentSizeValidator,
};
use magicblock_core::{
intent::{types::CommittedAccount, MagicIntentBundle},
traits::MagicSys,
};
use magicblock_core::{intent::CommittedAccount, traits::MagicSys};
use magicblock_metrics::metrics;
use magicblock_program::magic_sys::INTENT_TOO_LARGE_ERR;
use solana_instruction::error::InstructionError;
use solana_pubkey::Pubkey;
use tracing::error;
Expand Down Expand Up @@ -98,4 +103,15 @@ impl MagicSys for MagicSysAdapter {
})
.map_err(|_| InstructionError::Custom(Self::FETCH_ERR))
}

fn validate_intent_size(
&self,
intent: &MagicIntentBundle,
) -> Result<(), InstructionError> {
if IntentSizeValidator::fits(intent) {
Ok(())
} else {
Err(InstructionError::Custom(INTENT_TOO_LARGE_ERR))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ mod complex_blocking_test {

#[cfg(test)]
mod edge_cases_test {
use magicblock_program::magic_scheduled_base_intent::MagicIntentBundle;
use magicblock_core::intent::MagicIntentBundle;

use super::*;
use crate::test_utils;
Expand All @@ -637,7 +637,7 @@ mod edge_cases_test {

#[cfg(test)]
mod complete_error_test {
use magicblock_core::intent::CommittedAccount;
use magicblock_core::intent::types::CommittedAccount;
use solana_account::Account;
use solana_pubkey::pubkey;

Expand Down Expand Up @@ -854,11 +854,11 @@ pub(crate) fn create_test_intent(
pubkeys: &[Pubkey],
is_undelegate: bool,
) -> ScheduledIntentBundle {
use magicblock_core::intent::CommittedAccount;
use magicblock_program::magic_scheduled_base_intent::{
CommitAndUndelegate, CommitType, MagicIntentBundle,
ScheduledIntentBundle, UndelegateType,
use magicblock_core::intent::{
types::CommittedAccount, CommitAndUndelegate, CommitType,
MagicIntentBundle, UndelegateType,
};
use magicblock_program::magic_scheduled_base_intent::ScheduledIntentBundle;
use solana_account::Account;
use solana_hash::Hash;
use solana_transaction::Transaction;
Expand Down Expand Up @@ -904,11 +904,11 @@ pub(crate) fn create_test_intent_bundle(
commit_pubkeys: &[Pubkey],
commit_and_undelegate_pubkeys: &[Pubkey],
) -> ScheduledIntentBundle {
use magicblock_core::intent::CommittedAccount;
use magicblock_program::magic_scheduled_base_intent::{
CommitAndUndelegate, CommitType, MagicIntentBundle,
ScheduledIntentBundle, UndelegateType,
use magicblock_core::intent::{
types::CommittedAccount, CommitAndUndelegate, CommitType,
MagicIntentBundle, UndelegateType,
};
use magicblock_program::magic_scheduled_base_intent::ScheduledIntentBundle;
use solana_account::Account;
use solana_hash::Hash;
use solana_transaction::Transaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,16 @@ where
| TransactionStrategyExecutionError::LoadedAccountsDataSizeExceeded(
_,
_,
)
| TransactionStrategyExecutionError::TransactionTooLargeError(_) => {
) => {
// Can't be handled
error!(error = ?err, "Commit tasks exceeded execution limit");
Ok(ControlFlow::Break(()))
}
TransactionStrategyExecutionError::TransactionTooLargeError(_) => {
// Can't be handled but also shouldn't occur
error!(strategy = ?self.state.commit_strategy, error = ?err, "Commit tasks do not fit in tx");
Ok(ControlFlow::Break(()))
}
TransactionStrategyExecutionError::InternalError(_) => {
// Can't be handled
Ok(ControlFlow::Break(()))
Expand Down Expand Up @@ -496,12 +500,16 @@ where
Ok(ControlFlow::Continue(to_cleanup))
}
TransactionStrategyExecutionError::CpiLimitError(_, _)
| TransactionStrategyExecutionError::LoadedAccountsDataSizeExceeded(_, _)
| TransactionStrategyExecutionError::TransactionTooLargeError(_) => {
| TransactionStrategyExecutionError::LoadedAccountsDataSizeExceeded(_, _) => {
// Can't be handled
warn!(error = ?err, "Finalization tasks exceeded execution limit");
Ok(ControlFlow::Break(()))
}
TransactionStrategyExecutionError::TransactionTooLargeError(_) => {
// Can't be handled but also shouldn't occur
error!(strategy = ?self.state.finalize_strategy, error = ?err, "Finalization tasks do not fit in tx");
Ok(ControlFlow::Break(()))
}
TransactionStrategyExecutionError::InternalError(_) => {
// Can't be handled
Ok(ControlFlow::Break(()))
Expand Down
14 changes: 7 additions & 7 deletions magicblock-committor-service/src/persist/commit_persister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use std::{
sync::{Arc, Mutex},
};

use magicblock_core::intent::CommittedAccount;
use magicblock_program::magic_scheduled_base_intent::{
CommitAndUndelegate, CommitType as IntentCommitType, MagicIntentBundle,
ScheduledIntentBundle, UndelegateType,
use magicblock_core::intent::{
types::CommittedAccount, CommitAndUndelegate,
CommitType as IntentCommitType, MagicIntentBundle, UndelegateType,
};
use magicblock_program::magic_scheduled_base_intent::ScheduledIntentBundle;
use solana_account::Account;
use solana_pubkey::Pubkey;
use solana_transaction::Transaction;
Expand Down Expand Up @@ -603,9 +603,9 @@ fn committed_account_from_row(

#[cfg(test)]
mod tests {
use magicblock_core::intent::CommittedAccount;
use magicblock_program::magic_scheduled_base_intent::{
CommitAndUndelegate, CommitType, MagicIntentBundle, UndelegateType,
use magicblock_core::intent::{
types::CommittedAccount, CommitAndUndelegate, CommitType,
MagicIntentBundle, UndelegateType,
};
use solana_account::Account;
use solana_hash::Hash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dlp_api::{
instruction_builder::{commit_diff_size_budget, commit_size_budget},
AccountSizeClass,
};
use magicblock_core::intent::CommittedAccount;
use magicblock_core::intent::types::CommittedAccount;
use solana_account::{Account, ReadableAccount};
use solana_instruction::Instruction;
use solana_pubkey::Pubkey;
Expand Down
2 changes: 1 addition & 1 deletion magicblock-committor-service/src/tasks/commit_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use dlp_api::{
diff::compute_diff,
AccountSizeClass,
};
use magicblock_core::intent::CommittedAccount;
use magicblock_core::intent::types::CommittedAccount;
use solana_account::{Account, ReadableAccount};
use solana_instruction::Instruction;
use solana_pubkey::Pubkey;
Expand Down
Loading
Loading