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

Remove simple script distinction #4763

Merged
merged 2 commits into from Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions cardano-api/ChangeLog.md
Expand Up @@ -26,6 +26,8 @@

- **Breaking change** - `queryExpr` to return `IO (Either UnsupportedNtcVersionError a)` instead of `IO a`.
([PR4788](https://github.com/input-output-hk/cardano-node/pull/4788))

- **Breaking change** - Remove distinction between multisig and timelock scripts([PR4763](https://github.com/input-output-hk/cardano-node/pull/4763))

### Bugs

Expand Down
21 changes: 8 additions & 13 deletions cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Expand Up @@ -125,7 +125,6 @@ import qualified Data.ByteString.Short as SBS
import Data.Coerce
import Data.Int (Int64)
import Data.Map.Strict (Map)
import Data.Maybe (maybeToList)
import Data.Ratio (Ratio, (%))
import Data.String
import Data.Word (Word64)
Expand Down Expand Up @@ -185,27 +184,23 @@ genLovelace = Lovelace <$> Gen.integral (Range.linear 0 5000)
--

genScript :: ScriptLanguage lang -> Gen (Script lang)
genScript (SimpleScriptLanguage lang) =
SimpleScript lang <$> genSimpleScript lang
genScript SimpleScriptLanguage =
SimpleScript <$> genSimpleScript
genScript (PlutusScriptLanguage lang) =
PlutusScript lang <$> genPlutusScript lang

genSimpleScript :: SimpleScriptVersion lang -> Gen (SimpleScript lang)
genSimpleScript lang =
genSimpleScript :: Gen SimpleScript
genSimpleScript =
genTerm
where
genTerm = Gen.recursive Gen.choice nonRecursive recursive

-- Non-recursive generators
nonRecursive =
(RequireSignature . verificationKeyHash <$>
genVerificationKey AsPaymentKey)

: [ RequireTimeBefore supported <$> genSlotNo
| supported <- maybeToList (timeLocksSupported lang) ]

++ [ RequireTimeAfter supported <$> genSlotNo
| supported <- maybeToList (timeLocksSupported lang) ]
[ RequireSignature . verificationKeyHash <$> genVerificationKey AsPaymentKey
, RequireTimeBefore <$> genSlotNo
, RequireTimeAfter <$> genSlotNo
]

-- Recursive generators
recursive =
Expand Down
8 changes: 1 addition & 7 deletions cardano-api/src/Cardano/Api.hs
Expand Up @@ -337,18 +337,15 @@ module Cardano.Api (
-- | Both 'PaymentCredential's and 'StakeCredential's can use scripts.

-- ** Script languages
SimpleScriptV1,
SimpleScriptV2,
SimpleScript',
PlutusScriptV1,
PlutusScriptV2,
ScriptLanguage(..),
SimpleScriptVersion(..),
PlutusScriptVersion(..),
AnyScriptLanguage(..),
AnyPlutusScriptVersion(..),
IsPlutusScriptLanguage(..),
IsScriptLanguage(..),
IsSimpleScriptLanguage(..),

-- ** Scripts in a specific language
Script(..),
Expand Down Expand Up @@ -389,9 +386,6 @@ module Cardano.Api (
-- ** Simple scripts
-- | Making multi-signature and time-lock scripts.
SimpleScript(..),
TimeLocksSupported(..),
timeLocksSupported,
adjustSimpleScriptVersion,

-- ** Plutus scripts
PlutusScript,
Expand Down