-
Notifications
You must be signed in to change notification settings - Fork 35
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: add native-script verify function #332
feat: add native-script verify function #332
Conversation
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
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.
Two things:
-
We put these kinds of things in
utils.rs
files instead ofmod.rs
. Themod.rs
we try and keep as auto-generated as possible (outside of module declarations and some imports). That way it doesn't get overwritten when we need to regenerate something when they update the cddl definitions. -
This should be in the
chain/rust
crate and then a simple binding over it for thechian/wasm
code so that way it's exposed for rust projects too.
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.
The rust part looks good. Do we want to put the wasm bindings for that now in chain/wasm/utils.rs
?
Yes |
@@ -68,6 +69,61 @@ impl NativeScript { | |||
pub fn hash(&self) -> ScriptHash { | |||
self.0.hash().into() | |||
} | |||
|
|||
pub fn verify( |
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.
I meant just a wrapper around the rust code to avoid duplicating logic e.g.:
self.0.verify(lower_bound, upper_bound, key_hashes.as_ref())
^ untested but it's something like that
We have AsRef
and Into
/From
to convert to/from the rust and WASM structs.
The checks fail with a clippy warning. Once that is fixed and the check passes I'll LGTM and merge it. Thanks. |
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. Thanks for the contribution!
How long does it take for the new release? |
* feat: add native-script verify function
No description provided.