Skip to content
Merged
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
20 changes: 12 additions & 8 deletions magicblock-aperture/src/requests/http/simulate_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,24 @@ impl HttpDispatcher {
}
.into()
};
let result = RpcSimulateTransactionResult {
err: result.result.err(),
logs: result.logs,
accounts: None,
units_consumed: Some(result.units_consumed),
return_data: result.return_data.map(Into::into),
inner_instructions: result

let inner_instructions = config.inner_instructions.then(|| {
result
.inner_instructions
.into_iter()
.flatten()
.enumerate()
.map(converter)
.collect::<Vec<_>>()
.into(),
});

let result = RpcSimulateTransactionResult {
err: result.result.err(),
logs: result.logs,
accounts: None,
units_consumed: Some(result.units_consumed),
return_data: result.return_data.map(Into::into),
inner_instructions,
replacement_blockhash,
};

Expand Down
5 changes: 5 additions & 0 deletions magicblock-api/src/magic_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ impl MagicValidator {
account_update_tx: validator_channels.account_update,
environment: build_svm_env(&accountsdb, latest_block.blockhash, 0),
tasks_tx: validator_channels.tasks_service,
is_auto_airdrop_lamports_enabled: config
.accounts
.clone
.auto_airdrop_lamports
> 0,
};
txn_scheduler_state
.load_upgradeable_programs(&programs_to_load(&config.programs))
Expand Down
4 changes: 4 additions & 0 deletions magicblock-processor/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub(super) struct TransactionExecutor {
/// A read lock held during a slot's processing to synchronize with critical global
/// operations like `AccountsDb` snapshots.
sync: StWLock,
/// True when auto airdrop for fee payers is enabled (auto_airdrop_lamports > 0).
pub is_auto_airdrop_lamports_enabled: bool,
}

impl TransactionExecutor {
Expand Down Expand Up @@ -103,6 +105,8 @@ impl TransactionExecutor {
accounts_tx: state.account_update_tx.clone(),
transaction_tx: state.transaction_status_tx.clone(),
tasks_tx: state.tasks_tx.clone(),
is_auto_airdrop_lamports_enabled: state
.is_auto_airdrop_lamports_enabled,
};

this.processor.fill_missing_sysvar_cache_entries(&this);
Expand Down
11 changes: 9 additions & 2 deletions magicblock-processor/src/executor/processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,15 @@ impl super::TransactionExecutor {
})
.unwrap_or(false);

if undelegated_feepayer_was_modified {
result = Err(TransactionError::InvalidAccountForFee);
if undelegated_feepayer_was_modified
&& !self.is_auto_airdrop_lamports_enabled
{
if let Ok(ProcessedTransaction::Executed(ref mut executed)) =
&mut result
{
executed.execution_details.status =
Err(TransactionError::InvalidAccountForFee)
}
}
}
(result, output.balances)
Expand Down
2 changes: 2 additions & 0 deletions magicblock-processor/src/scheduler/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub struct TransactionSchedulerState {
pub transaction_status_tx: TransactionStatusTx,
/// A channel to send scheduled (crank) tasks created by transactions.
pub tasks_tx: ScheduledTasksTx,
/// True when auto airdrop for fee payers is enabled.
pub is_auto_airdrop_lamports_enabled: bool,
}

impl TransactionSchedulerState {
Expand Down
1 change: 1 addition & 0 deletions test-kit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ impl ExecutionTestEnv {
txn_to_process_rx: validator_channels.transaction_to_process,
tasks_tx: validator_channels.tasks_service,
environment,
is_auto_airdrop_lamports_enabled: false,
};

// Load test program
Expand Down