Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path Successors [✨ surprises ✨] #22

Merged
merged 2 commits into from
Jul 3, 2024
Merged

Path Successors [✨ surprises ✨] #22

merged 2 commits into from
Jul 3, 2024

Conversation

sgwilym
Copy link
Contributor

@sgwilym sgwilym commented Jul 1, 2024

Last week I naïvely thought: "let's quickly port the willow-utils path successor functions and get that out of the way". Things did not work out that way!

TL;DR: All path successor implementations up to this point are wrong, and we were only able to find out how using fuzz testing. willow-util's implementations need to be fixed, as it may be generating the wrong ranges for areas.

SubspaceId

  • Added successor method.

PathComponent trait

  • Added new_with_tail method
  • Added empty method
  • Added try_append_zero_byte method
  • Added set_byte method
  • Added try_increment_fixed_width method
  • Added prefix_successor method

Path trait

  • The iterator returned by the components method must implement ExactSizeIterator and DoubleEndedIterator
  • Added component_count method
  • Added is_empty method
  • Fixed a bug is_prefix_of
  • Added successor method
  • Added successor_of_prefix method
  • Added explicit implementations of Ord, PartialOrd

Testing

  • Implemented Arbitrary for PathComponentBox
  • Implemented Arbitrary for PathRc
  • Added fuzz tests for Path::successor
  • Added fuzz tests for Path::successor_of_prefix

@sgwilym sgwilym added bug Something isn't working enhancement New feature or request labels Jul 1, 2024
@sgwilym
Copy link
Contributor Author

sgwilym commented Jul 1, 2024

@Frando you may want to check this against your own implementation for path successors.

@sgwilym sgwilym merged commit 3e771d0 into main Jul 3, 2024
1 check passed
@sgwilym sgwilym deleted the successors branch July 3, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

1 participant