Skip to content

Commit cf0af8a

Browse files
committed
Add haddock explaining why we have the hasEmptyAnys argument
1 parent 9759adb commit cf0af8a

File tree

1 file changed

+9
-0
lines changed
  • cardano-api/gen/Test/Gen/Cardano/Api

1 file changed

+9
-0
lines changed

cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ genSimpleScriptWithoutEmptyAnys = genRandomSimpleScript False
240240
genSimpleScript :: Gen SimpleScript
241241
genSimpleScript = genRandomSimpleScript True
242242

243+
-- | We include a @hasEmptyAnys@ parameter to control whether we allow empty
244+
-- 'RequireAnyOf' constructors. This is because an empty 'RequireAnyOf',
245+
-- same as a 'RequireMOf' with less than M elements, is not satisfiable.
246+
-- In the function @satisfyScript@ in the "Test.Cardano.Api.TxBody" module,
247+
-- we look for a set of witnesses that satisfy a script, and we can't do it
248+
-- if the script consists of an empty 'RequireAnyOf' constructor.
249+
-- Note that this is not the only way to make an unsatisfiable script,
250+
-- but this is the one that affects the @satisfyScript@ function, because
251+
-- it is only concerned with the witnesses, and not with the times.
243252
genRandomSimpleScript :: Bool -> Gen SimpleScript
244253
genRandomSimpleScript hasEmptyAnys =
245254
genTerm

0 commit comments

Comments
 (0)