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

RIPEMD-160 builtin #6155

Open
6 of 8 tasks
kwxm opened this issue May 30, 2024 · 2 comments
Open
6 of 8 tasks

RIPEMD-160 builtin #6155

kwxm opened this issue May 30, 2024 · 2 comments

Comments

@kwxm
Copy link
Contributor

kwxm commented May 30, 2024

It's been proposed that the RIPEMD-160 hash function should be added to Plutus Core, and a CIP is currently being prepared.

To do this we'll need to

  • Identify a library function that provides the required functionality. This should be audited for safety and a Haskell interface should be provided in cardano-base.
  • Add a new builtin to Plutus Core based on the library function.
  • Cost the new function.
  • Add a corresponding function to PlutusTx
  • Add some tests, including some standard test vectors. We'll want some tests in plutus-conformance, and perhaps they should all go there.
  • Add e2e tests
  • Add the new function to plutus-metatheory
  • Add the new function to the Plutus Core specification.

We already have a number of hash functions in Plutus Core and this will be very similar, so it shouldn't be too difficult to add it

@paluh
Copy link
Contributor

paluh commented Jun 4, 2024

Thanks a lot for putting this together @kwxm! Let me add some context to your points:

  • Identify a library function that provides the required functionality. This should be audited for safety and a Haskell interface should be provided in cardano-base.

The binding which was just added to cardano-base is based on cryptonite implementation and I believe that library was already approved as source of cryptographic primitives. Am I right @perturbing?
This new minor release was also published on CHaP so I was able to just bump the CHaP version in cabal.project and flake.lock to use it.

  • Add a new builtin to Plutus Core based on the library function.

This addition was done in few places: primitive binding, builtin definition, fake cost model params, test case

  • Cost the new function.

This is still missing :-(

  • Add a corresponding function to PlutusTx

Implemented here

  • Add some tests, including some standard test vectors. We'll want some tests in plutus-conformance, and perhaps they should all go there.

Implemented in #d7470ca8cc4e664c7e21ec79de1c0a961ad1c6b7

  • Add e2e tests

Could you please point me to some examples which I can follow. I'm testing this new builtin in the context of Bitcoin pubkeyhash<->pubkey hash verification so I'm happy to turn this into a test case.

  • Add the new function to plutus-metatheory

I think this is done here: https://github.com/IntersectMBO/plutus/pull/6147/files#diff-0edb07d418229734a515c575977b4866dccdfee4aadeeee116b4dda09999639dR225

  • Add the new function to the Plutus Core specification.

Happy to do this by following keccak_256 and blake2b entries. Could you please point me to a repo/file(s) where it should be added?

@paluh
Copy link
Contributor

paluh commented Jun 28, 2024

Please note that I rebased and reopened the PR from my fork (due to permission problems). The links from the previous post should still work and are relevant but some of them don't point to my latest rebased version of the PR: #6252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants