-
Notifications
You must be signed in to change notification settings - Fork 154
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
fix: sha256()
for Slices and rework its description
#1936
Conversation
Also made the passed Slices use the same function, otherwise they'd still have all the same problems we've fixed before for Strings — the benchmarks didn't show those issues.
Looks like this should have a different linked issue. This is a fix of a fix. Can you please add an example that fails into a separate issue? |
Opened and linked: #1937 |
Is it still possible to recover the previous behavior? I.e. if the user want to hash just the slice data, without any traversals? |
sha256()
as gas-expensive and rework its descriptionsha256()
as gas-expensive, fix it for Slices and rework its description
If the Slice would not contain any references the results are the same as before. If the user still wants to hash just the data even if the slice contains some refs, in the "Before Tact 1.6" note I've said that TVM instructions that perform SHA-256 hashing all operate on data only. With that they can simply introduce their own helper Or do we want to add a new function to the stdlib? |
sha256()
as gas-expensive, fix it for Slices and rework its descriptionsha256()
for Slices and rework its description
I think we should. |
Sure thing, I've opened a separate issue for this — #1950. Will be resolved in a separate PR soon, let's finish this one first |
merge conflicts |
Resolved, please take a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Also made the passed Slices use the same function instead of the
string_hash()
from FunC's stdlib, otherwise they'd still have all the same problems we've fixed before for Strings in #1626. Added positive and negative tests, showing that previous implementation for Slices was incorrect on Slices larger than 127 bytes.Issue
Closes #1879.
Closes #1937.
Checklist