sdiehl / bulletproofs

Bulletproofs are short non-interactive zero-knowledge proofs that require no trusted setup
BSD 3-Clause "New" or "Revised" License
534 stars 44 forks source link

bulletproofs test suite fails to build on GHC 8.6.1 #11

Closed jkachmar closed 6 years ago

jkachmar commented 6 years ago

bulletproofs' test suite currently fails to build on GHC 8.6.1 with the following error:

Bulletproofs/MultiRangeProof/Prover.hs:89:3: error:
    • Could not deduce (Control.Monad.Fail.MonadFail m)
        arising from a do statement
        with the failable pattern ‘[t1Blinding, t2Blinding]’
      from the context: (AsInteger f, Eq f, Field f, Show f,
                         MonadRandom m)
        bound by the type signature for:
                   generateProofUnsafe :: forall f (m :: * -> *).
                                          (AsInteger f, Eq f, Field f, Show f, MonadRandom m) =>
                                          Integer -> [(Integer, Integer)] -> m (RangeProof f)
        at Bulletproofs/MultiRangeProof/Prover.hs:(54,1)-(60,21)
      Possible fix:
        add (Control.Monad.Fail.MonadFail m) to the context of
          the type signature for:
            generateProofUnsafe :: forall f (m :: * -> *).
                                   (AsInteger f, Eq f, Field f, Show f, MonadRandom m) =>
                                   Integer -> [(Integer, Integer)] -> m (RangeProof f)
    • In a stmt of a 'do' block:
        [t1Blinding, t2Blinding] <- replicateM
                                      2 ((fromInteger :: Integer -> f) <$> generateMax q)
      In the expression:
        do let n = logBase2 upperBound
               m = fromIntegral $ length vsAndvBlindings
               ....
           let aL = reversedEncodeBitMulti n vsF
               aR = complementaryVector aL
           (sL, sR) <- chooseBlindingVectors nm
           [aBlinding, sBlinding] <- replicateM
                                       2 ((fromInteger :: Integer -> f) <$> generateMax q)
           ....
      In an equation for ‘generateProofUnsafe’:
          generateProofUnsafe upperBound vsAndvBlindings
            = do let n = ...
                     ....
                 let aL = ...
                     ....
                 (sL, sR) <- chooseBlindingVectors nm
                 ....
   |
89 |   [t1Blinding, t2Blinding]
   |   ^^^^^^^^^^^^^^^^^^^^^^^^...

cf. commercialhaskell/stackage#4119

sdiehl commented 6 years ago

Fixed in #12 .

jkachmar commented 6 years ago

Would it be possible to push a new version to Hackage? That would let me re-add this to Stackage's nightly.

sdiehl commented 6 years ago

Ok. I'll do this.

sdiehl commented 6 years ago

@jkachmar Uploaded the new version of the Hackage. Should build fine under GHC 8.6.1.