From 14e2ea625824f0e8506bd4b1d65eb8932bde6449 Mon Sep 17 00:00:00 2001 From: Babur Makhmudov Date: Sat, 22 Nov 2025 00:49:23 +0400 Subject: [PATCH] fix: don't check for empty account with data --- .../src/executor/processing.rs | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/magicblock-processor/src/executor/processing.rs b/magicblock-processor/src/executor/processing.rs index 98a656452..0bb638c3c 100644 --- a/magicblock-processor/src/executor/processing.rs +++ b/magicblock-processor/src/executor/processing.rs @@ -376,37 +376,6 @@ impl super::TransactionExecutor { return; } } - // SVM ignores rent exemption enforcement for accounts, which have - // 0 lamports, so it's possible to call realloc on account with zero - // balance bypassing the runtime checks. In order to prevent this - // edge case we perform explicit post execution check here. - for (i, (pubkey, acc)) in txn.accounts.iter().enumerate() { - if !acc.is_dirty() { - continue; - } - let Some(rent) = self.environment.rent_collector else { - continue; - }; - if acc.lamports() == 0 && acc.data().is_empty() { - continue; - } - let rent_exemption_balance = - rent.get_rent().minimum_balance(acc.data().len()); - if acc.lamports() >= rent_exemption_balance { - continue; - } - let error = Err(TransactionError::InsufficientFundsForRent { - account_index: i as u8, - }); - executed.execution_details.status = error; - let logs = executed - .execution_details - .log_messages - .get_or_insert_default(); - let msg = format!("Account {pubkey} has violated rent exemption"); - logs.push(msg); - return; - } } }