-
Notifications
You must be signed in to change notification settings - Fork 125
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
NativeScript::hash() return changed to ScriptHash #234
NativeScript::hash() return changed to ScriptHash #234
Conversation
both Ed25519KeyHash and ScriptHash are 28-byte wrapper types with the same API (both generated by `impl_hash_type!()`) around a blake2b224 hash and are CBOR-equivalent, but are different semantically.
@@ -1615,11 +1615,11 @@ pub enum ScriptHashNamespace { | |||
|
|||
#[wasm_bindgen] | |||
impl NativeScript { | |||
pub fn hash(&self, namespace: ScriptHashNamespace) -> Ed25519KeyHash { | |||
pub fn hash(&self, namespace: ScriptHashNamespace) -> ScriptHash { |
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 think in #127 when Ashish copied the hashing code from the key hashing method the wrapper type just wasn't changed to KeyHash
. They're binary equivalent anyway both defined like:
impl_hash_type!(Ed25519KeyHash, 28);
impl_hash_type!(ScriptHash, 28);
|
||
let script_hash = ScriptHash::from_bytes( |
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.
Although here we're doing the binary conversion explicitly in a test so it's weird that the type wouldn't have been changed to ScriptHash
when writing that test.
both Ed25519KeyHash and ScriptHash are 28-byte wrapper types with the
same API (both generated by
impl_hash_type!()
) around a blake2b224hash and are CBOR-equivalent, but are different semantically.