Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Improve assert! and test with custom message.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhchiang-sol committed Dec 18, 2023
1 parent 8e13863 commit 4bb2a21
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions accounts-db/src/tiered_storage/hot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ impl HotStorageReader {

assert!(
offset.saturating_add(std::mem::size_of::<HotAccountMeta>())
<= self.footer.index_block_offset as usize
<= self.footer.index_block_offset as usize,
"HotAccountOffset ({}) exceeds accounts blocks offset boundary ({}).",
offset.saturating_add(std::mem::size_of::<HotAccountMeta>()),
self.footer.index_block_offset,
);
let (meta, _) = get_pod::<HotAccountMeta>(&self.mmap, offset)?;
Ok(meta)
Expand Down Expand Up @@ -576,7 +579,7 @@ pub mod tests {
}

#[test]
#[should_panic(expected = "self.footer.index_block_offset")]
#[should_panic(expected = "exceeds accounts blocks offset boundary")]
fn test_get_acount_meta_from_offset_out_of_bounds() {
// Generate a new temp path that is guaranteed to NOT already have a file.
let temp_dir = TempDir::new().unwrap();
Expand Down

0 comments on commit 4bb2a21

Please sign in to comment.