Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions grovedb-element/src/element_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ pub enum ProofNodeType {

/// Element type discriminants.
///
/// Base types (0..=14, 18, 19) match the bincode serialization order of
/// Base types (0..=14, 18..=20) match the bincode serialization order of
/// the `Element` enum. The `Element` enum has indices 15, 16, and 17
/// reserved for the `NonCounted`, `NotSummed`, and `NotCountedOrSummed`
/// wrapper variants respectively (none has a direct `ElementType`
Expand Down Expand Up @@ -228,7 +228,7 @@ pub enum ProofNodeType {
/// and `from_serialized_value` resolves `[16, inner_byte]` to the matching
/// twin via an explicit `inner_byte → twin` match.
///
/// IMPORTANT: Base values (0..=14, 18, 19) must match the order of
/// IMPORTANT: Base values (0..=14, 18..=20) must match the order of
/// variants in the `Element` enum. The
/// `test_element_serialization_discriminants_match_element_type` test
/// catches drift.
Expand Down Expand Up @@ -1709,7 +1709,7 @@ mod tests {

let grove_version = GroveVersion::latest();

// Build vector of (Element, ElementType, variant_name) for all 10 variants
// Build vector of (Element, ElementType, variant_name) for all base variants.
let test_cases: Vec<(Element, ElementType, &str)> = vec![
// discriminant 0
(
Expand Down Expand Up @@ -1810,16 +1810,22 @@ mod tests {
ElementType::ProvableSumTree,
"ProvableSumTree",
),
// discriminant 20
(
Element::ProvableCountProvableSumTree(None, 0, 0, None),
ElementType::ProvableCountProvableSumTree,
"ProvableCountProvableSumTree",
),
];

// Verify we're testing all 17 base discriminants: 0..=14, 18, 19.
// Verify we're testing all 18 base discriminants: 0..=14, 18..=20.
// (15 = NonCounted wrapper byte, 16 = NotSummed wrapper byte,
// 17 = NotCountedOrSummed wrapper byte — none has a base
// ElementType variant.)
assert_eq!(
test_cases.len(),
17,
"Expected 17 base Element variants in test, got {}",
18,
"Expected 18 base Element variants in test, got {}",
test_cases.len()
);

Expand Down
Loading