Skip to content

Commit

Permalink
fix(db): output activity analytics query (#1029)
Browse files Browse the repository at this point in the history
* First impl

* Experiment

* Separate nft and alias output analytics

* Calculate state changed and governor changed count

* Cleanup

* Fix nft output tests

* Fix PoI tests

* Fix alias analytics test

* Format query
  • Loading branch information
Alex6323 committed Jan 12, 2023
1 parent 399457d commit 5c14d88
Show file tree
Hide file tree
Showing 3 changed files with 508 additions and 384 deletions.
16 changes: 1 addition & 15 deletions src/bin/inx-chronicle/api/stardust/poi/merkle_hasher.rs
Expand Up @@ -46,10 +46,8 @@ impl MerkleHasher {
}

/// Returns the largest power of 2 less than a given number `n`.
///
/// __NOTE__: Panics for `n < 2`.
pub(crate) fn largest_power_of_two(n: usize) -> usize {
debug_assert!(n > 1);
debug_assert!(n > 1, "invalid input");
1 << (bit_length((n - 1) as u32) - 1)
}

Expand All @@ -72,18 +70,6 @@ mod tests {
}
}

#[test]
#[should_panic]
fn test_largest_power_of_two_panics_for_0() {
let _ = largest_power_of_two(0);
}

#[test]
#[should_panic]
fn test_largest_power_of_two_panics_for_1() {
let _ = largest_power_of_two(1);
}

#[test]
fn test_largest_power_of_two_lte_number() {
assert_eq!(2u32.pow(0) as usize, largest_power_of_two(2));
Expand Down

0 comments on commit 5c14d88

Please sign in to comment.