-
Notifications
You must be signed in to change notification settings - Fork 112
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
Identifier: Recheck InvalidIdentifier error code in Identifier
#323
Comments
Hello there, I investigated into this issue and found the culprit. Before I make a PR, just wanted to keep you in the loop and wanted your advice on the fix. Here's what I did and found: Here's what I've found: I added a debugging print statement at line 189 to print the length of the Base58 string converted from vector v: Having run the test from my unmerged PR #336 with length 40 for v, The length of the Base58 string is 62, which is longer than the maximum allowed length for an identifier ( The reason the Base58 string is longer is due to the nature of Base58 encoding. Base58 encoding is a type of binary-to-text encoding designed to be human-readable and avoid similar-looking characters. However, this encoding tends to increase the length of the encoded string compared to the original binary data. The InvalidIdentifier error is thrown when the Base58 string is converted into a TLDR, We're having a couple checks for valid length, one with the input vector and one with the encoded Base58 string. Here are the two possible solutions I propose:
Before I make my PR, I wanted to ask what you think would be the better approach? I'll do the PR right away with your advised solution. |
@Harsh1s Good find! Assuming that identifier input is always based on vector, can change in identifier/curi.rs, change to, assuming maximum_threshold_length is found to be 31,
So with this change, the final base_58 identifier would always be within current @amarts what do you say of this change, hopefully it won't break in many places? |
According to my testing the max threshold size came out to be 31. If you give the green signal, I'll make the PR right away. I'm excited to solve more issues! |
@Harsh1s you can proceed with following thoughts, Why threshold comes out to be 31?
|
hey @vatsa287 I would like to work on this . I have gone through the code base can you assign this to me if it is open? |
Hey there, I'm already working on this (as you could see from the chat), I think it would be better if you worked on some good first issue as a start. Thanks! |
Hey there , It is already marked closed by @vatsa287 last week , That is why i just make a request > |
Hey @Harsh1s @rising0raj |
Description
During creation of a
Identifier
in cord-identifier package, recheck error codes being returned even when input data length is within defined range.Goals
Expected Outcome
Acceptance Criteria
NA
Implementation Details
NA
Mockups / Wireframes
NA
Product Name
CORD
Organization Name
Dhiway
Domain
Blockchain
Tech Skills Needed
Rust
Mentor(s)
@smohan-dw @amarts
Complexity
[Medium]
Category
[Bug], [Test]
Sub Category
[Backend], [Research]
The text was updated successfully, but these errors were encountered: