-
Notifications
You must be signed in to change notification settings - Fork 203
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
feat: expose secp hashing to lua environment #314
base: trunk
Are you sure you want to change the base?
Conversation
Signed-off-by: Michael Maurer <[email protected]>
Signed-off-by: nicol-ii <[email protected]>
Signed-off-by: nicol-ii <[email protected]>
This is great! @nicol-ii if you can fix up the linter errors then we should be able to push this forward some |
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.
A simple and clear exposure of internal hashing to the Lua runner. There are just a couple instances of small tidying that occur to me. Well done!
|
||
hash = make_hash("Hello World!") | ||
print(hash) | ||
|
||
if sequence < from_seq then |
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.
Presumably, this is meant to test that the newly-exposed function works; can this be verified using a real test instead of adding IO to the bytecode generation?
On that note, when testing the exposure of a hash-function (or any data-transformation) specifically, it's probably a good idea to verify that it works against known values (i.e., I'd suggest assert
ing that the hash from "Hello World!"
is what you expect).
auto unsigned_str = std::vector<unsigned char>(sz); | ||
std::memcpy(unsigned_str.data(), str, sz); | ||
sha.Write(unsigned_str.data(), sz); | ||
cbdc::hash_t computed_hash{}; | ||
sha.Finalize(computed_hash.data()); |
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.
cbdc::hash_data()
is effectively this snippet refactored into a method; I might suggest using it here directly.
feat: expose secp hashing to lua environment
Exposes a hash function to the Lua smart contract execution environment.
Additionally adds a handful of library version bumps and other cleanup.