Skip to content
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

Change the script hash algorithm to address hash #1746

Merged
merged 4 commits into from
Aug 6, 2020

Conversation

dcoutts
Copy link
Contributor

@dcoutts dcoutts commented Aug 1, 2020

Use the address hash algorithm rather than the normal hash algorithm,
to match the hash algorithm used in addresses for keys.

Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you for the helpful commit messages!

@nc6
Copy link
Contributor

nc6 commented Aug 3, 2020

Restarted the hydra build, failing on probabilistic checks

dcoutts and others added 4 commits August 5, 2020 11:34
This is preparation for changing the script hash type to use ADDRHASH
rather than HASH. We change a few things that depend on it being
specifically HASH.

Redefine ScriptHash directly in terms of HASH, rather than indirectly
in terms of the Hash type (which does also use HASH).

We have to drop the HashAnnotated instance since it only supports HASH
but we're about to switch to using ADDRHASH. We only use the instane in
one place, so we just inline it there.
This compile-time test asserts that the script hash and key hash use
the same hash size and indeed hash function. We do this by checking we
can type-check the following code that converts between them by using
the hash casting function which changes what the hash is of, without
changing the hashing algorithm.

This test fails at this stage with a type error, as it should, but will
compile as of the next patch.
It ought to use the same hash function as keys, since we use them both
in addresses and it's annoying if they're not the same, and the spec
does call for them to be the same.

This makes the compile-time test in the previous patch pass.
@JaredCorduan JaredCorduan merged commit 0772792 into master Aug 6, 2020
@iohk-bors iohk-bors bot deleted the dcoutts/script-hash branch August 6, 2020 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants