Security changes (#9923)

* Move test-only functions to test modules

* Remove sigverify disable

* Remove chacha CTR code
This commit is contained in:
sakridge
2020-05-08 10:00:23 -07:00
committed by GitHub
parent 01ab1d1369
commit f98bfda6f9
9 changed files with 36 additions and 132 deletions

View File

@ -5,7 +5,10 @@ mod tests {
use log::*;
use solana_core::{
commitment::BlockCommitmentCache,
storage_stage::{test_cluster_info, StorageStage, StorageState, SLOTS_PER_TURN_TEST},
storage_stage::{
get_identity_index_from_signature, test_cluster_info, StorageStage, StorageState,
SLOTS_PER_TURN_TEST,
},
};
use solana_ledger::{
bank_forks::BankForks,
@ -19,7 +22,7 @@ mod tests {
hash::Hash,
message::Message,
pubkey::Pubkey,
signature::{Keypair, Signer},
signature::{Keypair, Signature, Signer},
transaction::Transaction,
};
use solana_storage_program::storage_instruction::{self, StorageAccountType};
@ -34,6 +37,11 @@ mod tests {
time::Duration,
};
fn get_mining_result(storage_state: &StorageState, key: &Signature) -> Hash {
let idx = get_identity_index_from_signature(key);
storage_state.state.read().unwrap().storage_results[idx]
}
#[test]
fn test_storage_stage_process_account_proofs() {
solana_logger::setup();
@ -205,7 +213,7 @@ mod tests {
let hash = Hash::default();
let signature = keypair.sign_message(&hash.as_ref());
let mut result = storage_state.get_mining_result(&signature);
let mut result = get_mining_result(&storage_state, &signature);
assert_eq!(result, Hash::default());
@ -228,7 +236,7 @@ mod tests {
if solana_perf::perf_libs::api().is_some() {
for _ in 0..5 {
result = storage_state.get_mining_result(&signature);
result = get_mining_result(&storage_state, &signature);
if result != Hash::default() {
info!("found result = {:?} sleeping..", result);
break;