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

PlutusV3 Feature Support #711

Merged
merged 3 commits into from
Sep 26, 2024
Merged

PlutusV3 Feature Support #711

merged 3 commits into from
Sep 26, 2024

Conversation

colll78
Copy link

@colll78 colll78 commented Sep 25, 2024

Added

  • Cryptographic hashing utilities:- pripemd_160, pkeccak_256, and pblake2b_224 to Plutarch.Crypto
  • PlutusV3 BLS primitives to Plutarch.BLS
  • PlutusV3 Bitwise primitives to Plutarch.Bitwise

Changed

  • Bumped plutus-core version to 1.33.0.0
  • Updated getArity mapping to handle the new builtins in Plutarch.Internal
  • Updated printScript in Plutarch.Internal.Other to new PlutusCore version.

@peter-mlabs
@SeungheonOh
Review please.

@colll78 colll78 changed the title Plutus V3 Support PlutusV3 Feature Support Sep 25, 2024
Copy link
Contributor

@kozross kozross left a comment

Choose a reason for hiding this comment

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

Only thing needed is a bunch of @sinces, as well as a major version bump (Plutus dep bump).

@SeungheonOh
Copy link
Collaborator

SeungheonOh commented Sep 26, 2024

New primops are from

List of all primops can found here

Implementations looks good to me, it can use little documentations and some tests, but that can be added later

Copy link
Collaborator

@SeungheonOh SeungheonOh left a comment

Choose a reason for hiding this comment

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

Thank you. Looks good to me. Ideally we push some tests as well. I'll see if I can pull some time somewhere to work on it hopefully.

@SeungheonOh SeungheonOh merged commit 548cb64 into Plutonomicon:staging Sep 26, 2024
@colll78
Copy link
Author

colll78 commented Sep 26, 2024

Thank you. Looks good to me. Ideally we push some tests as well. I'll see if I can pull some time somewhere to work on it hopefully.

Here are a few tests I wrote for the new hashing primitives feel free to add it to the Plutarch test suite.

module Testing.Crypto where

import Test.Tasty
import Test.Tasty.HUnit
import Test.Tasty.QuickCheck as QC
import Testing.Eval (psucceeds, passert, toHexString)
import Plutarch.Prelude
import PlutusCore.Crypto.Hash qualified as Hash

tests :: TestTree
tests = testGroup "PlutarchV3 Builtins"
  [ testCase "keccak_256" $
      passert $
        (pkeccak_256 # (phexByteStr "4dd6d57ca8cb7ac8c3b219366754a392ba9e4e43b6b3ae59d89be3f878ba8fb6")) 
            #== phexByteStr "1994466d51e80d6dc32c8f41f142b47b2d03b4f5fa869aced6157c016b2b331d"
  , testCase "pblake2b_224" $
      passert $
        (pblake2b_224 # (phexByteStr "4dd6d57ca8cb7ac8c3b219366754a392ba9e4e43b6b3ae59d89be3f878ba8fb6")) 
            #== pconstant (Hash.blake2b_224 $ toHexString "4dd6d57ca8cb7ac8c3b219366754a392ba9e4e43b6b3ae59d89be3f878ba8fb6")
  , testCase "pripemd_160" $
      passert $
        (pripemd_160 # (phexByteStr "4dd6d57ca8cb7ac8c3b219366754a392ba9e4e43b6b3ae59d89be3f878ba8fb6")) 
            #== pconstant (Hash.ripemd_160 $ toHexString "4dd6d57ca8cb7ac8c3b219366754a392ba9e4e43b6b3ae59d89be3f878ba8fb6")
  ]

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.

3 participants