From 5903f1ff91adfeb1ffe57e5de20f9aa1ffa7c5cc Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Fri, 29 Nov 2024 14:52:10 +0100 Subject: [PATCH] fixup! chore(deps): bump actions/github-script from 6 to 7 (#5633) --- .../src/PlutusCore/Builtin/Result.hs | 2 ++ .../PlutusCore/Crypto/BLS12_381/Pairing.hs | 2 +- .../src/PlutusCore/Default/Builtins.hs | 27 +++++++++---------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/plutus-core/plutus-core/src/PlutusCore/Builtin/Result.hs b/plutus-core/plutus-core/src/PlutusCore/Builtin/Result.hs index 213c60b1683..8146a233ee7 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Builtin/Result.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Builtin/Result.hs @@ -188,10 +188,12 @@ _UnliftingErrorVia :: Pretty err => err -> Prism' err UnliftingError _UnliftingErrorVia err = iso (MkUnliftingError . display) (const err) {-# INLINE _UnliftingErrorVia #-} +-- | See Note [Structural vs operational errors within builtins] _StructuralUnliftingError :: AsBuiltinError err => Prism' err UnliftingError _StructuralUnliftingError = _BuiltinUnliftingEvaluationError . _StructuralEvaluationError {-# INLINE _StructuralUnliftingError #-} +-- | See Note [Structural vs operational errors within builtins] _OperationalUnliftingError :: AsBuiltinError err => Prism' err UnliftingError _OperationalUnliftingError = _BuiltinUnliftingEvaluationError . _OperationalEvaluationError {-# INLINE _OperationalUnliftingError #-} diff --git a/plutus-core/plutus-core/src/PlutusCore/Crypto/BLS12_381/Pairing.hs b/plutus-core/plutus-core/src/PlutusCore/Crypto/BLS12_381/Pairing.hs index 8e902a7cedc..e9e54aa6389 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Crypto/BLS12_381/Pairing.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Crypto/BLS12_381/Pairing.hs @@ -51,7 +51,7 @@ instance NFData MlResult where rnf _ = () instance Hashable MlResult where - hashWithSalt salt = const salt + hashWithSalt salt _MlResult = salt millerLoop :: G1.Element -> G2.Element -> MlResult millerLoop = coerce BlstBindings.millerLoop diff --git a/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs b/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs index 8f4e9fca087..f780ec98ebb 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs @@ -1439,7 +1439,7 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where -- Pairs toBuiltinMeaning _semvar FstPair = let fstPairDenotation :: SomeConstant uni (a, b) -> BuiltinResult (Opaque val a) - fstPairDenotation (SomeConstant (Some (ValueOf uniPairAB xy))) = do + fstPairDenotation (SomeConstant (Some (ValueOf uniPairAB xy))) = case uniPairAB of DefaultUniPair uniA _ -> pure . fromValueOf uniA $ fst xy _ -> @@ -1452,7 +1452,7 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where toBuiltinMeaning _semvar SndPair = let sndPairDenotation :: SomeConstant uni (a, b) -> BuiltinResult (Opaque val b) - sndPairDenotation (SomeConstant (Some (ValueOf uniPairAB xy))) = do + sndPairDenotation (SomeConstant (Some (ValueOf uniPairAB xy))) = case uniPairAB of DefaultUniPair _ uniB -> pure . fromValueOf uniB $ snd xy _ -> @@ -1466,7 +1466,7 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where -- Lists toBuiltinMeaning _semvar ChooseList = let chooseListDenotation :: SomeConstant uni [a] -> b -> b -> BuiltinResult b - chooseListDenotation (SomeConstant (Some (ValueOf uniListA xs))) a b = do + chooseListDenotation (SomeConstant (Some (ValueOf uniListA xs))) a b = case uniListA of DefaultUniList _ -> pure $ case xs of [] -> a @@ -1485,7 +1485,7 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where -> Opaque val (a -> [a] -> b) -> SomeConstant uni [a] -> BuiltinResult (Opaque (HeadSpine val) b) - caseListDenotation z f (SomeConstant (Some (ValueOf uniListA xs0))) = do + caseListDenotation z f (SomeConstant (Some (ValueOf uniListA xs0))) = case uniListA of DefaultUniList uniA -> pure $ case xs0 of [] -> headSpine z [] @@ -1503,7 +1503,7 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where :: SomeConstant uni a -> SomeConstant uni [a] -> BuiltinResult (Opaque val [a]) mkConsDenotation (SomeConstant (Some (ValueOf uniA x))) - (SomeConstant (Some (ValueOf uniListA xs))) = do + (SomeConstant (Some (ValueOf uniListA xs))) = -- See Note [Structural vs operational errors within builtins]. case uniListA of DefaultUniList uniA' -> case uniA `geq` uniA' of @@ -1518,8 +1518,7 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where toBuiltinMeaning _semvar HeadList = let headListDenotation :: SomeConstant uni [a] -> BuiltinResult (Opaque val a) - headListDenotation (SomeConstant (Some (ValueOf uniListA xs))) = do - -- See Note [Structural vs operational errors within builtins]. + headListDenotation (SomeConstant (Some (ValueOf uniListA xs))) = case uniListA of DefaultUniList uniA -> case xs of [] -> fail "Expected a non-empty list but got an empty one" @@ -1532,10 +1531,10 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where toBuiltinMeaning _semvar TailList = let tailListDenotation :: SomeConstant uni [a] -> BuiltinResult (Opaque val [a]) - tailListDenotation (SomeConstant (Some (ValueOf uniListA xs))) = do - -- See Note [Structural vs operational errors within builtins]. + tailListDenotation (SomeConstant (Some (ValueOf uniListA xs))) = case uniListA of - DefaultUniList _ -> case xs of + DefaultUniList _argUni -> + case xs of [] -> fail "Expected a non-empty list but got an empty one" _ : xs' -> pure $ fromValueOf uniListA xs' _ -> throwing _StructuralUnliftingError "Expected a list but got something else" @@ -1546,12 +1545,10 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where toBuiltinMeaning _semvar NullList = let nullListDenotation :: SomeConstant uni [a] -> BuiltinResult Bool - nullListDenotation (SomeConstant (Some (ValueOf uniListA xs))) = do + nullListDenotation (SomeConstant (Some (ValueOf uniListA xs))) = case uniListA of - DefaultUniList _ -> pure $ null xs - _ -> - -- See Note [Structural vs operational errors within builtins]. - throwing _StructuralUnliftingError "Expected a list but got something else" + DefaultUniList _argUni -> pure $ null xs + _ -> throwing _StructuralUnliftingError "Expected a list but got something else" {-# INLINE nullListDenotation #-} in makeBuiltinMeaning nullListDenotation