Skip to content

Conversation

DeVikingMark
Copy link

Summary

Adds type-safe Position and Location wrappers to distinguish between MMR node positions and leaf locations, preventing common usage errors.

Changes

  • New types: Position (node index in MMR) and Location (leaf index in leaf list)
  • Conversion functions: position_to_location() and location_to_position()
  • Ergonomic features: From/Into conversions, arithmetic ops, Display trait
  • Backward compatibility: Existing leaf_num_to_pos/leaf_pos_to_num functions unchanged

Testing

  • 6 new comprehensive tests for types module
  • All 69 existing MMR tests pass
  • Verified position/location mapping correctness

Fixes #1673

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[storage] Add position and location types

1 participant