-
Notifications
You must be signed in to change notification settings - Fork 443
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
Implement selector_id!, selector_bytes! and blake2x256! macros #947
Conversation
Codecov Report
@@ Coverage Diff @@
## master #947 +/- ##
==========================================
- Coverage 82.86% 81.73% -1.13%
==========================================
Files 177 190 +13
Lines 8055 8165 +110
==========================================
- Hits 6675 6674 -1
- Misses 1380 1491 +111
Continue to review full report at Codecov.
|
Maybe will be useful to add a method that will return 'u32' from the hash. It is possible to get from the selector by 'into_be_u32' method. But it is not clear for a new developer:) |
From what I understood this is equal to |
Oh, I see, you've already returned a |
Maybe |
Maybe but I thought that |
Added all the UI tests for the new macros. |
What do you think about |
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.
LGTM
Inspired by the METIS library utility macros this PR adds those macros (different implementation and API) to ink! as built-ins.
Link: /~https://github.com/patractlabs/metis/blob/main/crates/lang/macro/src/lib.rs
Adds the following proc. macros to
ink_lang_macro
crate that are exposed fromink_lang
:selector_id!
: Takes a string or byte string literal as input and computes the selector ID of typeu32
.selector_bytes!
: Takes a string or byte string literal as input and computes the selector bytes of type[u8; 4]
.blake2x256!
: Takes a string or byte string literal as input and computes the BLAKE2b 256-bit hash of type[u8; 32]
.ToDo List
selector_id!
selector_bytes!
blake2x256!