Skip to content

Commit

Permalink
handle accounts:unlock_accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Dec 8, 2021
1 parent c026f06 commit 435b1c6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
11 changes: 6 additions & 5 deletions runtime/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,11 +1032,12 @@ impl Accounts {
let keys: Vec<_> = txs
.zip(results)
.filter_map(|(tx, res)| match res {
Err(TransactionError::AccountInUse) => None,
Err(TransactionError::SanitizeFailure) => None,
Err(TransactionError::AccountLoadedTwice) => None,
Err(TransactionError::WouldExceedMaxBlockCostLimit) => None,
Err(TransactionError::WouldExceedMaxAccountCostLimit) => None,
Err(TransactionError::AccountInUse)
| Err(TransactionError::SanitizeFailure)
| Err(TransactionError::AccountLoadedTwice)
| Err(TransactionError::WouldExceedMaxBlockCostLimit)
| Err(TransactionError::WouldExceedMaxAccountCostLimit)
| Err(TransactionError::WouldExceedMaxAccountDataCostLimit) => None,
_ => Some(tx.get_account_locks(demote_program_write_locks)),
})
.collect();
Expand Down
37 changes: 24 additions & 13 deletions runtime/src/cost_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use {
execute_cost_table::ExecuteCostTable,
},
log::*,
solana_sdk::{pubkey::Pubkey, transaction::SanitizedTransaction},
solana_sdk::{
instruction::CompiledInstruction, program_utils::limited_deserialize, pubkey::Pubkey,
system_instruction::SystemInstruction, system_program, transaction::SanitizedTransaction,
},
std::collections::HashMap,
};

Expand Down Expand Up @@ -208,18 +211,26 @@ impl CostModel {
instruction: SystemInstruction,
) -> u64 {
match instruction {
SystemInstruction::CreateAccount { space, .. }
| SystemInstruction::CreateAccountWithSeed { space, .. }
| SystemInstruction::Allocate { space }
| SystemInstruction::AllocateWithSeed { space, .. } => space,
SystemInstruction::Assign { .. }
| SystemInstruction::InitializeNonceAccount(_)
| SystemInstruction::WithdrawNonceAccount(_)
| SystemInstruction::AuthorizeNonceAccount(_)
| SystemInstruction::AssignWithSeed { .. }
| SystemInstruction::TransferWithSeed { .. }
| SystemInstruction::Transfer { .. }
| SystemInstruction::AdvanceNonceAccount => 0,
SystemInstruction::CreateAccount {
lamports: _lamports,
space,
owner: _owner,
} => space,
SystemInstruction::CreateAccountWithSeed {
base: _base,
seed: _seed,
lamports: _lamports,
space,
owner: _owner,
} => space,
SystemInstruction::Allocate { space } => space,
SystemInstruction::AllocateWithSeed {
base: _base,
seed: _seed,
space,
owner: _owner,
} => space,
_ => 0,
}
}

Expand Down

0 comments on commit 435b1c6

Please sign in to comment.