Skip to content

Commit

Permalink
chore: remove CODEOWNERS from master (solana-labs#1024)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihau authored and jeffwashington committed Apr 25, 2024
1 parent 878869b commit d0e5561
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions accounts-db/src/tiered_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ pub mod readable;
mod test_utils;

use {
crate::{accounts_file::StoredAccountsInfo, storable_accounts::StorableAccounts},
crate::{
account_storage::meta::StoredAccountMeta, accounts_file::StoredAccountsInfo,
storable_accounts::StorableAccounts,
},
error::TieredStorageError,
footer::{AccountBlockFormat, AccountMetaFormat},
hot::{HotStorageWriter, HOT_FORMAT},
Expand Down Expand Up @@ -377,31 +380,47 @@ mod tests {

const MIN_PUBKEY: Pubkey = Pubkey::new_from_array([0x00u8; 32]);
const MAX_PUBKEY: Pubkey = Pubkey::new_from_array([0xFFu8; 32]);
let mut min_pubkey_ref = &MAX_PUBKEY;
let mut max_pubkey_ref = &MIN_PUBKEY;
let mut min_pubkey_ref = MAX_PUBKEY;
let mut max_pubkey_ref = MIN_PUBKEY;

while let Some((stored_account_meta, next)) =
reader.get_stored_account_meta(index_offset).unwrap()
{
let mut test = |stored_account_meta: StoredAccountMeta<'_>| {
if let Some(account) = expected_accounts_map.get(stored_account_meta.pubkey()) {
verify_test_account_with_footer(
&stored_account_meta,
account,
stored_account_meta.pubkey(),
footer,
);
verified_accounts.insert(stored_account_meta.pubkey());
if *min_pubkey_ref > *stored_account_meta.pubkey() {
verified_accounts.insert(*stored_account_meta.pubkey());
if min_pubkey_ref > *stored_account_meta.pubkey() {
min_pubkey_ref = stored_account_meta.pubkey();
}
if *max_pubkey_ref < *stored_account_meta.pubkey() {
max_pubkey_ref = stored_account_meta.pubkey();
if max_pubkey_ref < *stored_account_meta.pubkey() {
max_pubkey_ref = *stored_account_meta.pubkey();
}
}
};
reader.scan_accounts(|stored_account_meta| {
test(stored_account_meta);
});

assert_eq!(footer.min_account_address, min_pubkey_ref);
assert_eq!(footer.max_account_address, max_pubkey_ref);
assert!(!verified_accounts.is_empty());
assert_eq!(verified_accounts.len(), expected_accounts_map.len());

// try again with get_stored_account_meta
verified_accounts = HashSet::new();
min_pubkey_ref = MAX_PUBKEY;
max_pubkey_ref = MIN_PUBKEY;
while let Some((stored_account_meta, next)) =
reader.get_stored_account_meta(index_offset).unwrap()
{
test(stored_account_meta);
index_offset = next;
}
assert_eq!(footer.min_account_address, *min_pubkey_ref);
assert_eq!(footer.max_account_address, *max_pubkey_ref);
assert_eq!(footer.min_account_address, min_pubkey_ref);
assert_eq!(footer.max_account_address, max_pubkey_ref);
assert!(!verified_accounts.is_empty());
assert_eq!(verified_accounts.len(), expected_accounts_map.len())
}
Expand Down

0 comments on commit d0e5561

Please sign in to comment.