This commit is contained in:
Michael Vines
2020-12-13 17:26:34 -08:00
parent 0d139d7ef3
commit 7143aaa89b
102 changed files with 543 additions and 499 deletions

View File

@ -22,6 +22,7 @@ impl HardForks {
} else {
self.hard_forks.push((new_slot, 1));
}
#[allow(clippy::stable_sort_primitive)]
self.hard_forks.sort();
}

View File

@ -178,10 +178,9 @@ mod test {
nonce::{self, State},
nonce_account::verify_nonce_account,
system_instruction::NonceError,
sysvar::recent_blockhashes::{create_test_recent_blockhashes, RecentBlockhashes},
sysvar::recent_blockhashes::create_test_recent_blockhashes,
};
use solana_program::hash::Hash;
use std::iter::FromIterator;
#[test]
fn default_is_uninitialized() {
@ -322,7 +321,7 @@ mod test {
keyed_account
.initialize_nonce_account(&authorized, &recent_blockhashes, &rent)
.unwrap();
let recent_blockhashes = RecentBlockhashes::from_iter(vec![].into_iter());
let recent_blockhashes = vec![].into_iter().collect();
let result = keyed_account.advance_nonce_account(&recent_blockhashes, &signers);
assert_eq!(result, Err(NonceError::NoRecentBlockhashes.into()));
})
@ -764,7 +763,7 @@ mod test {
with_test_keyed_account(min_lamports + 42, true, |keyed_account| {
let mut signers = HashSet::new();
signers.insert(*keyed_account.signer_key().unwrap());
let recent_blockhashes = RecentBlockhashes::from_iter(vec![].into_iter());
let recent_blockhashes = vec![].into_iter().collect();
let authorized = *keyed_account.unsigned_key();
let result =
keyed_account.initialize_nonce_account(&authorized, &recent_blockhashes, &rent);

View File

@ -85,7 +85,7 @@ impl PartialEq for Packet {
fn eq(&self, other: &Packet) -> bool {
let self_data: &[u8] = self.data.as_ref();
let other_data: &[u8] = other.data.as_ref();
self.meta == other.meta && self_data[..self.meta.size] == other_data[..other.meta.size]
self.meta == other.meta && self_data[..self.meta.size] == other_data[..self.meta.size]
}
}

View File

@ -282,7 +282,7 @@ pub struct MockInvokeContext {
pub bpf_compute_budget: BpfComputeBudget,
pub compute_meter: MockComputeMeter,
pub programs: Vec<(Pubkey, ProcessInstructionWithContext)>,
invoke_depth: usize,
pub invoke_depth: usize,
}
impl Default for MockInvokeContext {
fn default() -> Self {

View File

@ -11,7 +11,7 @@ where
let sorted = BinaryHeap::from_iter(recent_blockhash_iter);
let sorted_iter = IntoIterSorted::new(sorted);
let recent_blockhash_iter = sorted_iter.take(MAX_ENTRIES);
let recent_blockhashes = RecentBlockhashes::from_iter(recent_blockhash_iter);
let recent_blockhashes: RecentBlockhashes = recent_blockhash_iter.collect();
to_account(&recent_blockhashes, account)
}