-
Notifications
You must be signed in to change notification settings - Fork 42
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
NamespacedMerkleTree.foundInRange should not narrow uint64 to int #70
Comments
CC @odeke-em |
The choice of the index data type (the type of the return values of the If we opt for
On the other hand, if we choose
Considering the above, I am inclined toward |
|
If you do settle on a signed type, I suggest being specific about the type ( |
## Overview Part of #70. ## Checklist - [x] New and updated code has appropriate documentation - [x] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [x] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords
I have created a tracking issue for the latest comment within this thread to prevent it from being lost and overlooked. You can find it here: #239. Considering this, we can mark this issue as resolved with reference to issue #198. Any additional actions can be coordinated through the tracking issue. |
In
nmt/nmt.go
Lines 238 to 245 in 6274243
the XXX'ed comment correctly identifies the narrowing cast from
uint64
toint
as problematic. I suggest either (1) removing the casts and changing the return types to uint64, or (2) add a range check and panic on overflow. Given #15, and the fact that return types tend to spread to callers, I recommend (1) even if it's a bit more work.The text was updated successfully, but these errors were encountered: