Skip to content

Commit

Permalink
SVM: Remove dependency on MatchAccountOwnerError (solana-labs#35144)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgarg66 authored Feb 8, 2024
1 parent 28a320d commit 9b63ac8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
8 changes: 2 additions & 6 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ use {
AccountShrinkThreshold, AccountStorageEntry, AccountsDb, AccountsDbConfig,
CalcAccountsHashDataSource, VerifyAccountsHashAndLamportsConfig,
},
accounts_file::MatchAccountOwnerError,
accounts_hash::{
AccountHash, AccountsHash, CalcAccountsHashConfig, HashStats, IncrementalAccountsHash,
},
Expand Down Expand Up @@ -7488,15 +7487,12 @@ impl Bank {
}

impl TransactionProcessingCallback for Bank {
fn account_matches_owners(
&self,
account: &Pubkey,
owners: &[Pubkey],
) -> std::result::Result<usize, MatchAccountOwnerError> {
fn account_matches_owners(&self, account: &Pubkey, owners: &[Pubkey]) -> Option<usize> {
self.rc
.accounts
.accounts_db
.account_matches_owners(&self.ancestors, account, owners)
.ok()
}

fn get_account_shared_data(&self, pubkey: &Pubkey) -> Option<AccountSharedData> {
Expand Down
13 changes: 3 additions & 10 deletions svm/src/account_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,7 @@ mod tests {
use {
super::*,
nonce::state::Versions as NonceVersions,
solana_accounts_db::{
accounts::Accounts, accounts_db::AccountsDb, accounts_file::MatchAccountOwnerError,
ancestors::Ancestors,
},
solana_accounts_db::{accounts::Accounts, accounts_db::AccountsDb, ancestors::Ancestors},
solana_program_runtime::{
compute_budget_processor,
prioritization_fee::{PrioritizationFeeDetails, PrioritizationFeeType},
Expand Down Expand Up @@ -487,12 +484,8 @@ mod tests {
}

impl TransactionProcessingCallback for TestCallbacks {
fn account_matches_owners(
&self,
_account: &Pubkey,
_owners: &[Pubkey],
) -> std::result::Result<usize, MatchAccountOwnerError> {
Err(MatchAccountOwnerError::UnableToLoad)
fn account_matches_owners(&self, _account: &Pubkey, _owners: &[Pubkey]) -> Option<usize> {
None
}

fn get_account_shared_data(&self, pubkey: &Pubkey) -> Option<AccountSharedData> {
Expand Down
9 changes: 2 additions & 7 deletions svm/src/transaction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use {
percentage::Percentage,
solana_accounts_db::{
accounts::{LoadedTransaction, TransactionLoadResult},
accounts_file::MatchAccountOwnerError,
transaction_results::{
DurableNonceFee, TransactionCheckResult, TransactionExecutionDetails,
TransactionExecutionResult,
Expand Down Expand Up @@ -70,11 +69,7 @@ pub struct LoadAndExecuteSanitizedTransactionsOutput {
}

pub trait TransactionProcessingCallback {
fn account_matches_owners(
&self,
account: &Pubkey,
owners: &[Pubkey],
) -> std::result::Result<usize, MatchAccountOwnerError>;
fn account_matches_owners(&self, account: &Pubkey, owners: &[Pubkey]) -> Option<usize>;

fn get_account_shared_data(&self, pubkey: &Pubkey) -> Option<AccountSharedData>;

Expand Down Expand Up @@ -340,7 +335,7 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
saturating_add_assign!(*count, 1);
}
Entry::Vacant(entry) => {
if let Ok(index) =
if let Some(index) =
callbacks.account_matches_owners(key, program_owners)
{
program_owners
Expand Down

0 comments on commit 9b63ac8

Please sign in to comment.