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

add explicit type application on bls operations for G1/G2 #6666

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

perturbing
Copy link

@perturbing perturbing commented Nov 14, 2024

Hi team,

This simple PR makes the type applications for functions involving G1 and G2 explicit. The change is necessary due to a recent update in cardano-base (PR #509), where internal constructors were exposed. Without this adjustment, plutus-core encounters issues when interacting with these updated types. More explicitly, it will throw for example

plutus-core/src/PlutusCore/Crypto/BLS12_381/G1.hs:162:42: error: [GHC-39999]
    • Ambiguous type variable ‘curve4’ arising from a use of ‘BlstBindings.Internal.blsGenerator’
      prevents the constraint ‘(BlstBindings.Internal.BLS
                                  curve4)’ from being solved.
      Probable fix: use a type annotation to specify what ‘curve4’ should be.
      Potentially matching instances:
        instance BlstBindings.Internal.BLS BlstBindings.Internal.Curve1
          -- Defined in ‘Cardano.Crypto.EllipticCurve.BLS12_381.Internal’
        instance BlstBindings.Internal.BLS BlstBindings.Internal.Curve2
          -- Defined in ‘Cardano.Crypto.EllipticCurve.BLS12_381.Internal’
    • In the first argument of ‘coerce’, namely
        ‘BlstBindings.Internal.blsGenerator’
      In the second argument of ‘($)’, namely
        ‘coerce BlstBindings.Internal.blsGenerator’
      In the expression:
        compress $ coerce BlstBindings.Internal.blsGenerator
    |
162 | compressed_generator = compress $ coerce BlstBindings.Internal.blsGenerator
    |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if you add the srp

source-repository-package
  type: git
  location: https://github.com/intersectmbo/cardano-base
  tag: 97a3b8b76c8f6cc0021e1cef2806962f44d7a685
  --sha256: sha256-ZoFBF+Q/cqkwP2PcFqYgBhT6hoLlrDBzwMMDKVjDSf8=
  subdir:
    cardano-crypto-class
    cardano-mempool

This modification is particularly important for the haskell-accumulator package (defined here). This package relies on plutus while also utilizing the lower-level bls12-381 types, and the explicit type applications ensure compatibility across dependencies.

Thank you for reviewing!

@kwxm kwxm added Builtins Crypto No Changelog Required Add this to skip the Changelog Check labels Nov 14, 2024
@kwxm kwxm self-requested a review November 14, 2024 18:43
Copy link
Contributor

@kwxm kwxm left a comment

Choose a reason for hiding this comment

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

This looks entirely harmless. Thanks for bringing the issue to our attention. There's some CI problem at the moment, but we'll merge the PR when that's resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builtins Crypto No Changelog Required Add this to skip the Changelog Check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants