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

Update keyPath to ceil(maxLvl/8), add checks that len(key)<=maxKeyLen #21

Merged
merged 3 commits into from
Oct 5, 2021

Conversation

arnaucube
Copy link
Collaborator

@arnaucube arnaucube commented Sep 30, 2021

  • Update keyPath to be ceil(maxLevels/8)
  • Add checks that the key is not bigger than maximum key length for the tree
    maxLevels size, where maximum key len = ceil(maxLevels/8).
    • This is because if the key bits length is bigger than the maxLevels of the
      tree, two different keys that their difference is at the end, will collision in
      the same leaf of the tree (at the max depth).

@arnaucube arnaucube requested a review from ed255 September 30, 2021 15:55
@arnaucube arnaucube force-pushed the feature/keyPath-key-len-check branch from d4db1a7 to 97a223b Compare September 30, 2021 16:14
@arnaucube arnaucube marked this pull request as draft September 30, 2021 16:17
@arnaucube arnaucube force-pushed the feature/keyPath-key-len-check branch from 97a223b to 0921cac Compare October 1, 2021 08:58
@arnaucube arnaucube marked this pull request as ready for review October 1, 2021 08:59
@arnaucube arnaucube changed the title Update keyPath to ceil(maxLvl/8),add chck len(key) Update keyPath to ceil(maxLvl/8) Oct 4, 2021
@arnaucube arnaucube changed the title Update keyPath to ceil(maxLvl/8) Update keyPath to ceil(maxLvl/8), add checks that len(key)<=maxKeyLen Oct 4, 2021
@arnaucube arnaucube force-pushed the feature/keyPath-key-len-check branch from 92b6299 to d5b332f Compare October 4, 2021 09:34
tree.go Outdated Show resolved Hide resolved
tree.go Show resolved Hide resolved
Add checks that the key is not bigger than maximum key length for the tree
maxLevels size, where maximum key len = ceil(maxLevels/8).

This is because if the key bits length is bigger than the maxLevels of the
tree, two different keys that their difference is at the end, will collision in
the same leaf of the tree (at the max depth).
@arnaucube arnaucube force-pushed the feature/keyPath-key-len-check branch from aeb99e9 to 30a018e Compare October 5, 2021 16:01
@arnaucube arnaucube force-pushed the feature/keyPath-key-len-check branch from 30a018e to e8404e1 Compare October 5, 2021 16:06
@arnaucube arnaucube merged commit 63f7e88 into master Oct 5, 2021
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.

2 participants