diff --git a/svm/src/access_permissions.rs b/svm/src/access_permissions.rs index f1e2416..bbb8569 100644 --- a/svm/src/access_permissions.rs +++ b/svm/src/access_permissions.rs @@ -46,30 +46,27 @@ impl ExecutedTransaction { } } - let mut offender = None; let is_mutable = |acc: &AccountSharedData| { acc.delegated() || acc.ephemeral() || acc.confined() || acc.undelegating() }; + + let logs = self.execution_details.log_messages.get_or_insert_default(); + let mut first = true; // For non-privileged payers, validate the rest of the accounts. // Skip the fee payer (index 0), as its writability is validated elsewhere. for (i, (pk, acc)) in accounts.iter().enumerate().skip(1) { // Enforce that any account intended to be writable must be a delegated account. if message.is_writable(i) && !is_mutable(acc) { - offender.replace((i, pk)); - break; + if first { + self.execution_details.status = Err(TransactionError::InvalidWritableAccount); + logs.push("Program Magic11111111111111111111111111111111111111 failed: InvalidWritableAccount" .to_string()); + } + first = false; + logs.push(format!( + "MagicBlock SVM check: Account {i} ({pk}) was illegally used as writable" + )); } } - if let Some((i, offender)) = offender { - self.execution_details.status = Err(TransactionError::InvalidWritableAccount); - let logs = self.execution_details.log_messages.get_or_insert_default(); - logs.push(format!( - "Program log: Account {i}: {offender} was illegally used as writable" - )); - logs.push( - "Program Magic11111111111111111111111111111111111111 failed: InvalidWritableAccount" - .to_string(), - ); - } } } diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 20f7384..2bbe6ac 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -521,6 +521,7 @@ impl TransactionBatchProcessor { ); executed_tx.validate_accounts_access(tx); + // Update loaded accounts cache with account states which might have changed. // Also update local program cache with modifications made by the transaction, // if it executed successfully.