-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
ContractId round-trip fails for some values #209
Comments
Ok, I have finally figured out what's going on. It is the only zero string which has significantly shorter Base58 encoding (32 chars instead of 43/44), so it doesn't has a valid chunking and fails to parse. The issue is not trivial to solve: we need to refactor all the way the chunking works. For v0.11 I think the better way is to leave the things as they are: contract ids containing all-0 (or starting with at least 16 initial zeros to make length short enough to fail chunking) are all invalid anyway and can't be generated in a real-world scenarious. |
I agree there's no urgency in fixing this. |
After many attempts to fix it I was able to find an ultimate solution: switch from Base58 to Base64. Base64 has constant size for a given source binary data - unlike Base58. The only disadvantage is the use of "/" and "-" symbols in standard encoding; but I did a modification to use "@" and "$" instead, and it seems to be working great. I played with it in Switching to it in all |
Hi @dr-orlovsky, May I try this? It is not an urgent issue, I can take this chance to learn more, go through the Contract stuff, and make more test cases. |
Fixed by moving in beta-6 to baid64 encoding instead of baid58 |
Some values come up different after a
ContractId
round-trip.By round-trip I mean:
copy_from_slice
to_string
from_str
Here's an example:
This outputs:
The same error is returned by version
0.10.9
(usingfrom_slice
instead ofcopy_from_slice
).The text was updated successfully, but these errors were encountered: