diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.golden.uplc b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.golden.uplc index 58b3d278a35..3f6b53f7e8a 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.golden.uplc +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/sorted.golden.uplc @@ -741,22 +741,22 @@ program (constr 3 [ (constr 1 [ cse - , cse ]) ])) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ])) (constr 3 [ (constr 1 [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ])) + , cse ]) ])) (constr 1 [ (constr 3 [ (constr 1 @@ -795,8 +795,7 @@ program [ (constr 1 [ ]) , (constr 1 - [ (cse - 10) + [ cse , cse ]) ])) (constr 1 [ (constr 0 @@ -822,17 +821,18 @@ program , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + [ (cse + 1) , (constr 0 [ ]) ])) (constr 1 @@ -844,31 +844,30 @@ program , (constr 0 [ ]) ])) (cse - 5)) - (cse - 10)) - (constr 0 - [ (constr 1 - [ ]) - , cse ])) - (cse 100)) - (cse 2)) - (cse 1)) - (cse 4)) - (constr 0 - [ (constr 1 []) - , (constr 1 - [ 1 - , (constr 0 - []) ]) ])) - (cse 1)) - (unsafeRatio 51)) - (unsafeRatio 4)) - (unsafeRatio 0)) - (unsafeRatio 3)) + 100)) + (constr 0 + [ (constr 1 + [ ]) + , cse ])) + (cse 10)) + (cse 4)) + (cse 10)) + (cse 5)) + (constr 0 + [ (constr 1 []) + , (constr 1 + [ 1 + , (constr 0 + [ ]) ]) ])) + (cse 1)) + (cse 2)) + (unsafeRatio 4)) + (unsafeRatio 1)) + (unsafeRatio 51)) + (constr 1 [0, (constr 0 [])])) (unsafeRatio 9)) - (constr 1 [0, (constr 0 [])])) - (unsafeRatio 1)) + (unsafeRatio 0)) + (unsafeRatio 3)) ((\s -> s s) (\s arg -> delay diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.cbor.size b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.cbor.size index 0a5d03c1fdf..94589f6139c 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.cbor.size +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.cbor.size @@ -1 +1 @@ -2039 \ No newline at end of file +2041 \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.large.budget b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.large.budget index 3a5269ae797..1db796d20b0 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.large.budget +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.large.budget @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 568879992, exBudgetMemory = ExMemory 2944191} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 568927992, exBudgetMemory = ExMemory 2944491} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.small.budget b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.small.budget index 0bc40d401ae..f11870c8f0a 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.small.budget +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.small.budget @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 58635921, exBudgetMemory = ExMemory 267419} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 58683921, exBudgetMemory = ExMemory 267719} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.uplc b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.uplc index 9649ee80988..ec24c4b80a6 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.uplc +++ b/cardano-constitution/test/Cardano/Constitution/Validator/Data/GoldenTests/unsorted.golden.uplc @@ -37,744 +37,760 @@ program (\cse -> (\cse -> (\cse -> - (\cfg -> - (\fun - ds -> - case - ((\cse -> - case - (equalsInteger - 0 - (case - cse - [ (\l - r -> - l) ])) - [ (case - (equalsInteger - 2 - (case - cse - [ (\l - r -> - l) ])) - [ error - , ((\l -> - constr 1 - [ ]) - (case - cse - [ (\l - r -> - r) ])) ]) - , (constr 0 - [ (force - matchData_go - (unMapData - (force - headList + (\cse -> + (\cfg -> + (\fun + ds -> + case + ((\cse -> + case + (equalsInteger + 0 + (case + cse + [ (\l + r -> + l) ])) + [ (case + (equalsInteger + 2 + (case + cse + [ (\l + r -> + l) ])) + [ error + , ((\l -> + constr 1 + [ ]) + (case + cse + [ (\l + r -> + r) ])) ]) + , (constr 0 + [ (force + matchData_go + (unMapData (force - tailList - (case - cse - [ (\l - r -> - r) ]))))) ]) ]) - (unConstrData - (force - headList + headList + (force + tailList + (case + cse + [ (\l + r -> + r) ]))))) ]) ]) + (unConstrData (force - tailList + headList (force tailList - (case - (unConstrData - ((\tup -> - case - (equalsInteger - 5 - (case - tup - [ (\l - r -> - l) ])) - [ error - , (force - headList - (force - tailList - (case - tup - [ (\l - r -> - r) ]))) ]) - (unConstrData - (force - headList + (force + tailList + (case + (unConstrData + ((\tup -> + case + (equalsInteger + 5 + (case + tup + [ (\l + r -> + l) ])) + [ error + , (force + headList + (force + tailList + (case + tup + [ (\l + r -> + r) ]))) ]) + (unConstrData (force - tailList + headList (force tailList - (case - (unConstrData - ds) - [ (\l - r -> - r) ]))))))) - [ (\l - r -> - r) ])))))) - [ (\cparams -> - case - (fun - cparams) - [ error - , () ]) - , () ]) - ((\go - eta -> - go - eta) - ((\s -> - s - s) - (\s - ds -> - case - ds - [ True - , (\x - xs -> - case - (case - x - [ (\ds - actualValueData -> - validateParamValue - ((\k -> - (\s -> - s - s) - (\s - ds -> - case - ds - [ error - , (\ds - xs' -> - case - ds - [ (\k' - i -> - case - (equalsInteger - k - k') - [ (s - s - xs') - , i ]) ]) ])) - (unIData - ds) - cfg) - actualValueData) ]) - [ False - , (s - s - xs) ]) ])))) - (constr 1 - [ (constr 0 - [ 0 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 30 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 1000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 1 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) + (force + tailList + (case + (unConstrData + ds) + [ (\l + r -> + r) ]))))))) + [ (\l + r -> + r) ])))))) + [ (\cparams -> + case + (fun + cparams) + [ error + , () ]) + , () ]) + ((\go + eta -> + go + eta) + ((\s -> + s + s) + (\s + ds -> + case + ds + [ True + , (\x + xs -> + case + (case + x + [ (\ds + actualValueData -> + validateParamValue + ((\k -> + (\s -> + s + s) + (\s + ds -> + case + ds + [ error + , (\ds + xs' -> + case + ds + [ (\k' + i -> + case + (equalsInteger + k + k') + [ (s + s + xs') + , i ]) ]) ])) + (unIData + ds) + cfg) + actualValueData) ]) + [ False + , (s + s + xs) ]) ])))) + (constr 1 + [ (constr 0 + [ 0 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 30 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 1000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 1 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 2 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 24576 + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 122880 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 3 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 32768 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 4 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 5 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 1000000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 6 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250000000 + , cse ]) ]) + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 7 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 8 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 2000 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 9 + , (constr 3 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 10 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 1000) + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 200) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 11 + , (constr 3 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 10) + , cse ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 16 + , (constr 1 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 17 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 3000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 6500 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 18 + , (constr 0 + [ ]) ]) + , (constr 1 + [ (constr 0 + [ 19 + , (constr 2 + [ (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 25) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 20000) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5000) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 20 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 21 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 120000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 22 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 12288 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 23 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 200 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 24 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 25 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , cse ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 26 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ (unsafeRatio + 13 + 20) + , (constr 0 + [ ]) ]) ]) ]) + , cse ]) ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , cse ]) ]) + , cse ]) ]) + , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 27 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 3 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 28 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 18 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 293 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 29 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 30 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 31 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 100000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 32 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 13 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 37 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 33 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , cse ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (unsafeRatio + 1000 + 1) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) + (constr 3 + [ (constr 1 + [ cse , (constr 1 [ (constr 0 - [ 2 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 24576 - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 122880 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 [ (constr 0 - [ 3 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 32768 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) + [ ]) , (constr 1 - [ (constr 0 - [ 4 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) + [ cse , (constr 1 - [ (constr 0 - [ 5 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 1000000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 6 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250000000 - , cse ]) ]) - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 7 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 8 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 2000 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 9 - , (constr 3 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 10 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 1000) - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 200) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 11 - , (constr 3 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 10) - , cse ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 16 - , (constr 1 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 17 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 3000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 6500 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 18 - , (constr 0 - [ ]) ]) - , (constr 1 - [ (constr 0 - [ 19 - , (constr 2 - [ (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 25) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 20000) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5000) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 20 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 21 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 120000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 22 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 12288 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 23 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 200 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 24 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 25 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , cse ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 26 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ (unsafeRatio - 13 - 20) - , (constr 0 - [ ]) ]) ]) ]) - , cse ]) ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , cse ]) ]) - , cse ]) ]) - , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 27 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 3 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 28 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 18 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 293 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 29 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 30 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 31 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 100000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 32 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 13 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 37 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 33 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , cse ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (unsafeRatio - 1000 - 1) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ])) (constr 3 [ (constr 1 [ cse @@ -784,100 +800,88 @@ program [ ]) , (constr 1 [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) + , cse ]) ]) , (constr 0 [ ]) ]) ]) ])) (constr 3 [ (constr 1 [ cse , cse ]) ])) - (constr 3 - [ (constr 1 - [ cse - , (constr 1 + (constr 1 + [ (constr 3 + [ (constr 1 [ (constr 0 - [ (constr 0 + [ (constr 1 [ ]) , (constr 1 [ cse - , cse ]) ]) - , (constr 0 - [ ]) ]) ]) ])) + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) + , (constr 0 + [ ]) ])) (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) , (constr 0 [ ]) ])) - (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ (cse - 10) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , cse ]) ])) (constr 0 [ (constr 1 [ ]) , (constr 1 [ cse - , cse ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ])) - (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , cse ]) - , (constr 0 - [ ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 1000000 - , (constr 0 - [ ]) ]) ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ])) + (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , cse ]) + , (constr 0 + [ ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 1000000 + , (constr 0 + [ ]) ]) ]) ])) + (constr 1 + [ (constr 0 + [ (constr 2 + [ ]) + , cse ]) + , (constr 0 + [ ]) ])) (constr 1 [ (constr 0 - [ (constr 2 + [ (constr 0 [ ]) - , cse ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + [ cse , (constr 0 [ ]) ])) (constr 1 @@ -888,33 +892,31 @@ program [ cse , (constr 0 [ ]) ])) - (constr 1 - [ cse - , (constr 0 - [ ]) ])) - (cse 2)) - (cse 1)) - (cse 10)) - (cse 1)) - (constr 0 - [ (constr 1 []) - , cse ])) + (cse + 1)) + (cse 4)) + (cse 2)) + (cse 1)) + (cse 10)) + (cse 10)) (constr 0 [ (constr 1 []) - , (constr 1 - [ 1 - , (constr 0 - []) ]) ])) - (cse 100)) - (cse 4)) + , cse ])) + (constr 0 + [ (constr 1 []) + , (constr 1 + [ 1 + , (constr 0 + []) ]) ])) + (cse 100)) (cse 5)) - (unsafeRatio 9)) - (unsafeRatio 4)) + (unsafeRatio 0)) + (unsafeRatio 1)) (unsafeRatio 51)) - (unsafeRatio 3)) + (unsafeRatio 4)) (constr 1 [0, (constr 0 [])])) - (unsafeRatio 0)) - (unsafeRatio 1)) + (unsafeRatio 3)) + (unsafeRatio 9)) ((\s -> s s) (\s arg -> delay diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.golden.uplc b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.golden.uplc index ab51e86e38b..fde1c0aefa3 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.golden.uplc +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/sorted.golden.uplc @@ -733,23 +733,22 @@ program (constr 3 [ (constr 1 [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ (cse - 5) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ])) + , cse ]) ])) (constr 3 [ (constr 1 [ cse - , cse ]) ])) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 3 [ (constr 1 @@ -770,7 +769,8 @@ program , (constr 1 [ cse , (constr 1 - [ cse + [ (cse + 10) , (constr 0 [ ]) ]) ]) ]) , (constr 0 @@ -780,16 +780,16 @@ program [ ]) , (constr 1 [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ])) + , cse ]) ])) (constr 0 [ (constr 1 [ ]) , (constr 1 [ cse - , cse ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 0 [ (constr 0 @@ -814,17 +814,17 @@ program , (constr 0 [ ]) ])) (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + [ cse , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) (constr 1 @@ -836,27 +836,28 @@ program 1) , (constr 0 [ ]) ])) - (cse 1)) - (cse 4)) - (cse 2)) - (cse 10)) + (cse 10)) + (cse 1)) + (constr 0 + [ (constr 1 + []) + , cse ])) + (cse 4)) (constr 0 [ (constr 1 []) - , cse ])) + , (constr 1 + [ 1 + , (constr 0 + [ ]) ]) ])) (cse 100)) - (constr 0 - [ (constr 1 []) - , (constr 1 - [ 1 - , (constr 0 - []) ]) ])) - (unsafeRatio 9 10)) - (unsafeRatio 4)) - (unsafeRatio 1)) - (unsafeRatio 51)) + (cse 2)) + (unsafeRatio 4 5)) + (unsafeRatio 51)) + (unsafeRatio 3)) + (unsafeRatio 0)) (constr 1 [0, (constr 0 [])])) - (unsafeRatio 0)) - (unsafeRatio 3)) + (unsafeRatio 1)) + (unsafeRatio 9)) ((\s -> s s) (\s arg -> delay diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.cbor.size b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.cbor.size index 3f3e22d7e91..f969929f318 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.cbor.size +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.cbor.size @@ -1 +1 @@ -2035 \ No newline at end of file +2032 \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.large.budget b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.large.budget index 5a7a13c92b0..1db796d20b0 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.large.budget +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.large.budget @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 568975992, exBudgetMemory = ExMemory 2944791} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 568927992, exBudgetMemory = ExMemory 2944491} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.small.budget b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.small.budget index b5cd918c72f..f11870c8f0a 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.small.budget +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.small.budget @@ -1 +1 @@ -ExBudget {exBudgetCPU = ExCPU 58731921, exBudgetMemory = ExMemory 268019} \ No newline at end of file +ExBudget {exBudgetCPU = ExCPU 58683921, exBudgetMemory = ExMemory 267719} \ No newline at end of file diff --git a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.uplc b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.uplc index 063fe281208..11c2e116502 100644 --- a/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.uplc +++ b/cardano-constitution/test/Cardano/Constitution/Validator/GoldenTests/unsorted.golden.uplc @@ -36,743 +36,738 @@ program (\cse -> (\cse -> (\cse -> - (\cse -> - (\cfg -> - (\fun - ds -> - case - ((\ds -> - (\x -> - case - (equalsInteger - 0 - x) - [ (case - (equalsInteger - 2 - x) - [ error - , (constr 1 - [ ]) ]) - , (constr 0 - [ ((\d -> - force - matchData_go - (unMapData - d)) + (\cfg -> + (\fun + ds -> + case + ((\ds -> + (\x -> + case + (equalsInteger + 0 + x) + [ (case + (equalsInteger + 2 + x) + [ error + , (constr 1 + [ ]) ]) + , (constr 0 + [ ((\d -> + force + matchData_go + (unMapData + d)) + (force + headList (force - headList - (force - tailList - (case - ds - [ (\l - r -> - r) ])))) ]) ]) - (case - ds - [ (\l - r -> - l) ])) - (unConstrData + tailList + (case + ds + [ (\l + r -> + r) ])))) ]) ]) + (case + ds + [ (\l + r -> + l) ])) + (unConstrData + (force + headList (force - headList + tailList (force tailList - (force - tailList - (case - (unConstrData - ((\si -> - case - (equalsInteger - 5 - (case - si - [ (\l - r -> - l) ])) - [ error - , (force - headList - (force - tailList - (case - si - [ (\l - r -> - r) ]))) ]) - (unConstrData + (case + (unConstrData + ((\si -> + case + (equalsInteger + 5 + (case + si + [ (\l + r -> + l) ])) + [ error + , (force + headList + (force + tailList + (case + si + [ (\l + r -> + r) ]))) ]) + (unConstrData + (force + headList (force - headList + tailList (force tailList - (force - tailList - (case - (unConstrData - ds) - [ (\l - r -> - r) ]))))))) - [ (\l - r -> - r) ])))))) - [ (\cparams -> - case - (fun - cparams) - [ error - , () ]) - , () ]) - ((\go - eta -> - go - eta) - ((\s -> - s - s) - (\s - ds -> - case - ds - [ True - , (\x - xs -> - case - (case - x - [ (\ds - actualValueData -> - validateParamValue - ((\k -> - (\s -> - s - s) - (\s - ds -> - case - ds - [ error - , (\ds - xs' -> - case - ds - [ (\k' - i -> - case - (equalsInteger - k - k') - [ (s - s - xs') - , i ]) ]) ])) - (unIData - ds) - cfg) - actualValueData) ]) - [ False - , (s - s - xs) ]) ])))) - (constr 1 - [ (constr 0 - [ 0 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 30 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 1000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 1 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 2 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 24576 - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 122880 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 3 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 32768 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 4 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 5 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 1000000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 5000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 6 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250000000 - , cse ]) ]) - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 7 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 8 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 250 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 2000 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 9 - , (constr 3 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 10 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 1000) - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 200) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 11 - , (constr 3 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 10) - , cse ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 16 - , (constr 1 - [ (constr 1 - [ cse - , cse ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 17 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 3000 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 6500 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 18 - , (constr 0 - [ ]) ]) - , (constr 1 - [ (constr 0 - [ 19 - , (constr 2 - [ (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 25) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ (cse - 20000) - , (constr 0 - [ ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (cse - 5000) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 20 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 21 - , (constr 2 - [ (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 120000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 40000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 22 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 12288 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 23 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 100 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 200 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 24 - , (constr 1 - [ (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 25 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , cse ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 26 - , (constr 2 - [ (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ (unsafeRatio - 13 - 20) - , (constr 0 - [ ]) ]) ]) ]) - , cse ]) ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , cse ]) ]) - , cse ]) ]) - , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 27 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 3 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 28 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 18 - , (constr 0 - [ ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 293 - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 29 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 15 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 30 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 10000000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 31 - , (constr 1 - [ (constr 1 - [ cse - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 100000000000 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 32 - , (constr 1 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 13 - , cse ]) ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ 37 - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 1 - [ (constr 0 - [ 33 - , (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , cse ]) - , (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ (unsafeRatio - 1000 - 1) - , (constr 0 - [ ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) - , (constr 0 - [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) - (constr 3 - [ (constr 1 - [ cse - , cse ]) ])) + (case + (unConstrData + ds) + [ (\l + r -> + r) ]))))))) + [ (\l + r -> + r) ])))))) + [ (\cparams -> + case + (fun + cparams) + [ error + , () ]) + , () ]) + ((\go + eta -> + go + eta) + ((\s -> + s + s) + (\s + ds -> + case + ds + [ True + , (\x + xs -> + case + (case + x + [ (\ds + actualValueData -> + validateParamValue + ((\k -> + (\s -> + s + s) + (\s + ds -> + case + ds + [ error + , (\ds + xs' -> + case + ds + [ (\k' + i -> + case + (equalsInteger + k + k') + [ (s + s + xs') + , i ]) ]) ])) + (unIData + ds) + cfg) + actualValueData) ]) + [ False + , (s + s + xs) ]) ])))) + (constr 1 + [ (constr 0 + [ 0 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 30 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 1000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 1 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 2 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 24576 + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 122880 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 3 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 32768 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 4 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 5 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 1000000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 5000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 6 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250000000 + , cse ]) ]) + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 7 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 8 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 250 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 2000 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 9 + , (constr 3 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 10 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 1000) + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 200) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 11 + , (constr 3 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 10) + , cse ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 16 + , (constr 1 + [ (constr 1 + [ cse + , cse ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 17 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 3000 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 6500 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 18 + , (constr 0 + [ ]) ]) + , (constr 1 + [ (constr 0 + [ 19 + , (constr 2 + [ (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 25) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ (cse + 20000) + , (constr 0 + [ ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (cse + 5000) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 20 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 21 + , (constr 2 + [ (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 120000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 40000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 22 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 12288 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 23 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 100 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 200 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 24 + , (constr 1 + [ (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 25 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , cse ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 26 + , (constr 2 + [ (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 1 + [ (unsafeRatio + 13 + 20) + , (constr 0 + [ ]) ]) ]) ]) + , cse ]) ]) + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ cse + , (constr 1 + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , cse ]) ]) + , cse ]) ]) + , cse ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 27 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 3 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 28 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 18 + , (constr 0 + [ ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 293 + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 29 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 15 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 30 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 10000000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 31 + , (constr 1 + [ (constr 1 + [ cse + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 100000000000 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 32 + , (constr 1 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 13 + , cse ]) ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 37 + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 1 + [ (constr 0 + [ 33 + , (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , cse ]) + , (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ (unsafeRatio + 1000 + 1) + , (constr 0 + [ ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) + , (constr 0 + [ ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])) (constr 3 [ (constr 1 [ cse @@ -782,7 +777,11 @@ program [ ]) , (constr 1 [ cse - , cse ]) ]) + , (constr 1 + [ (cse + 5) + , (constr 0 + [ ]) ]) ]) ]) , (constr 0 [ ]) ]) ]) ])) (constr 3 @@ -794,88 +793,84 @@ program [ ]) , (constr 1 [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) + , cse ]) ]) , (constr 0 [ ]) ]) ]) ])) - (constr 1 - [ (constr 3 - [ (constr 1 - [ (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) - , cse ]) ]) - , (constr 0 - [ ]) ])) + (constr 3 + [ (constr 1 + [ cse + , cse ]) ])) (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , (constr 1 - [ cse - , (constr 1 - [ cse - , (constr 0 - [ ]) ]) ]) ]) + [ (constr 3 + [ (constr 1 + [ (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) + , cse ]) ]) , (constr 0 [ ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ cse + (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) , (constr 1 [ cse - , (constr 0 - [ ]) ]) ]) ])) + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ]) + , (constr 0 + [ ]) ])) (constr 0 [ (constr 1 [ ]) , (constr 1 - [ (cse - 10) - , cse ]) ])) - (constr 1 - [ (constr 0 - [ (constr 0 - [ ]) - , cse ]) - , (constr 0 - [ ]) ])) - (constr 0 - [ (constr 1 - [ ]) - , (constr 1 - [ 0 - , (constr 1 - [ 1000000 - , (constr 0 - [ ]) ]) ]) ])) - (constr 1 - [ (constr 0 - [ (constr 2 - [ ]) - , cse ]) - , (constr 0 - [ ]) ])) + [ cse + , (constr 1 + [ cse + , (constr 0 + [ ]) ]) ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ cse + , cse ]) ])) + (constr 1 + [ (constr 0 + [ (constr 0 + [ ]) + , cse ]) + , (constr 0 + [ ]) ])) + (constr 0 + [ (constr 1 + [ ]) + , (constr 1 + [ 0 + , (constr 1 + [ 1000000 + , (constr 0 + [ ]) ]) ]) ])) (constr 1 [ (constr 0 - [ (constr 0 + [ (constr 2 [ ]) - , (constr 1 - [ 500000000 - , (constr 0 - [ ]) ]) ]) + , cse ]) , (constr 0 [ ]) ])) (constr 1 - [ cse + [ (constr 0 + [ (constr 0 + [ ]) + , (constr 1 + [ 500000000 + , (constr 0 + [ ]) ]) ]) , (constr 0 [ ]) ])) (constr 1 @@ -886,30 +881,34 @@ program [ cse , (constr 0 [ ]) ])) - (cse 1)) - (cse 4)) + (constr 1 + [ (cse + 4) + , (constr 0 + [ ]) ])) + (cse 100)) (constr 0 [ (constr 1 []) , cse ])) - (cse 100)) - (constr 0 - [ (constr 1 []) - , (constr 1 - [ 1 - , (constr 0 - [ ]) ]) ])) - (cse 2)) - (cse 5)) - (cse 10)) + (cse 10)) + (cse 1)) + (constr 0 + [ (constr 1 []) + , (constr 1 + [ 1 + , (constr 0 + []) ]) ])) + (cse 10)) + (cse 2)) (cse 1)) - (unsafeRatio 3)) - (unsafeRatio 9)) + (unsafeRatio 0)) + (unsafeRatio 1)) (constr 1 [0, (constr 0 [])])) - (unsafeRatio 4)) - (unsafeRatio 1)) - (unsafeRatio 51)) - (unsafeRatio 0)) + (unsafeRatio 51)) + (unsafeRatio 9)) + (unsafeRatio 3)) + (unsafeRatio 4)) ((\s -> s s) (\s arg -> delay diff --git a/plutus-benchmark/bitwise/test/9.6/Ed25519.golden.uplc b/plutus-benchmark/bitwise/test/9.6/Ed25519.golden.uplc index 5eec9f81102..efbd7097358 100644 --- a/plutus-benchmark/bitwise/test/9.6/Ed25519.golden.uplc +++ b/plutus-benchmark/bitwise/test/9.6/Ed25519.golden.uplc @@ -973,12 +973,12 @@ (case ds [ (\w - cont -> + rest -> w) ])) (case ds [ (\w - rest -> + cont -> w) ])) ]) (next ipv)) ]) diff --git a/plutus-benchmark/cardano-loans/test/9.6/main.golden.eval b/plutus-benchmark/cardano-loans/test/9.6/main.golden.eval index c48eb4b1482..2a8306c4a43 100644 --- a/plutus-benchmark/cardano-loans/test/9.6/main.golden.eval +++ b/plutus-benchmark/cardano-loans/test/9.6/main.golden.eval @@ -1,6 +1,6 @@ CPU: 110_908_889 Memory: 621_150 -AST Size: 7_446 -Flat Size: 8_702 +AST Size: 7_443 +Flat Size: 8_699 (con unit ()) \ No newline at end of file diff --git a/plutus-benchmark/cardano-loans/test/9.6/main.golden.uplc b/plutus-benchmark/cardano-loans/test/9.6/main.golden.uplc index 23d5c90e2e5..d4fe5f1ec98 100644 --- a/plutus-benchmark/cardano-loans/test/9.6/main.golden.uplc +++ b/plutus-benchmark/cardano-loans/test/9.6/main.golden.uplc @@ -1668,39 +1668,37 @@ (\cse -> (\cse -> (\cse -> - (\cse -> - case - (case - (equalsInteger - (cse - cse) + case + (case + (equalsInteger + (cse + cse) + (cse (cse - (cse - cse))) - [ (force - trace - "Offer beacons not burned" - False) - , True ]) - [ False - , (case - (equalsInteger - (cse - cse) + cse))) + [ (force + trace + "Offer beacons not burned" + False) + , True ]) + [ False + , (case + (equalsInteger + (cse + cse) + (cse (cse - (cse - cse))) - [ (force - trace - "Lender IDs not burned" - False) - , True ]) ]) - (uncurry - cse)) + cse))) + [ (force + trace + "Lender IDs not burned" + False) + , True ]) ]) (uncurry cse)) - (valueOf - nt)) + (uncurry + (valueOf + nt))) (valueOf nt)) (negate diff --git a/plutus-conformance/agda/Spec.hs b/plutus-conformance/agda/Spec.hs index a7cbf9c8793..deca5d83254 100644 --- a/plutus-conformance/agda/Spec.hs +++ b/plutus-conformance/agda/Spec.hs @@ -190,6 +190,9 @@ failingEvaluationTests = , "test-cases/uplc/evaluation/builtin/semantics/valueContains/pos-neg" , "test-cases/uplc/evaluation/builtin/semantics/valueContains/reflexive" , "test-cases/uplc/evaluation/builtin/semantics/valueContains/token-missing" + , "test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero" + , "test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos" + , "test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg" ] {-| A list of budget tests which are currently expected to fail. Once a fix for @@ -285,6 +288,9 @@ failingBudgetTests = , "test-cases/uplc/evaluation/builtin/semantics/valueContains/pos-neg" , "test-cases/uplc/evaluation/builtin/semantics/valueContains/reflexive" , "test-cases/uplc/evaluation/builtin/semantics/valueContains/token-missing" + , "test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero" + , "test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos" + , "test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg" ] -- Run the tests: see Note [Evaluation with and without costing] above. diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc new file mode 100644 index 00000000000..8527443c2fe --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc @@ -0,0 +1,6 @@ +(program 1.0.0 + [ (builtin scaleValue) + (con integer -2) + (con value [(#aa, [(#aa, 5), (#bb, -15), (#cc, 20)])]) + ] +) diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc.budget.expected b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc.budget.expected new file mode 100644 index 00000000000..183870dca0d --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc.budget.expected @@ -0,0 +1,2 @@ +({cpu: 100000080100 +| mem: 100000000600}) \ No newline at end of file diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc.expected b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc.expected new file mode 100644 index 00000000000..72b90c1d0dd --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-neg/by-neg.uplc.expected @@ -0,0 +1 @@ +(program 1.0.0 (con value [(#aa, [(#aa, -10), (#bb, 30), (#cc, -40)])])) \ No newline at end of file diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc new file mode 100644 index 00000000000..3715afc8cf7 --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc @@ -0,0 +1,6 @@ +(program 1.0.0 + [ (builtin scaleValue) + (con integer 2) + (con value [(#aa, [(#aa, 5), (#bb, -15), (#cc, 20)])]) + ] +) diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc.budget.expected b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc.budget.expected new file mode 100644 index 00000000000..183870dca0d --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc.budget.expected @@ -0,0 +1,2 @@ +({cpu: 100000080100 +| mem: 100000000600}) \ No newline at end of file diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc.expected b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc.expected new file mode 100644 index 00000000000..d3e61b29f20 --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-pos/by-pos.uplc.expected @@ -0,0 +1 @@ +(program 1.0.0 (con value [(#aa, [(#aa, 10), (#bb, -30), (#cc, 40)])])) \ No newline at end of file diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc new file mode 100644 index 00000000000..273a32e2adb --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc @@ -0,0 +1,6 @@ +(program 1.0.0 + [ (builtin scaleValue) + (con integer 0) + (con value [(#aa, [(#aa, 5), (#bb, -15), (#cc, 20)])]) + ] +) diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc.budget.expected b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc.budget.expected new file mode 100644 index 00000000000..183870dca0d --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc.budget.expected @@ -0,0 +1,2 @@ +({cpu: 100000080100 +| mem: 100000000600}) \ No newline at end of file diff --git a/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc.expected b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc.expected new file mode 100644 index 00000000000..f3491084cfa --- /dev/null +++ b/plutus-conformance/test-cases/uplc/evaluation/builtin/semantics/scaleValue/by-zero/by-zero.uplc.expected @@ -0,0 +1 @@ +(program 1.0.0 (con value [])) \ No newline at end of file diff --git a/plutus-core/changelog.d/20251103_142248_seungheon_scaleValue.md b/plutus-core/changelog.d/20251103_142248_seungheon_scaleValue.md new file mode 100644 index 00000000000..c95e7e521a9 --- /dev/null +++ b/plutus-core/changelog.d/20251103_142248_seungheon_scaleValue.md @@ -0,0 +1,3 @@ +### Added + +- Implementations of `ScaleValue` primitives. diff --git a/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs b/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs index b159f2011bb..04165c16ef4 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs @@ -196,6 +196,7 @@ data DefaultFun | ValueContains | ValueData | UnValueData + | ScaleValue deriving stock (Show, Eq, Ord, Enum, Bounded, Generic, Ix) deriving anyclass (NFData, Hashable, PrettyBy PrettyConfigPlc) @@ -2094,6 +2095,14 @@ instance uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun where unValueDataDenotation (runCostingFunOneArgument . unimplementedCostingFun) + toBuiltinMeaning _semvar ScaleValue = + let unValueDataDenotation :: Integer -> Value -> BuiltinResult Value + unValueDataDenotation = Value.scaleValue + {-# INLINE unValueDataDenotation #-} + in makeBuiltinMeaning + unValueDataDenotation + (runCostingFunTwoArguments . unimplementedCostingFun) + -- See Note [Inlining meanings of builtins]. {-# INLINE toBuiltinMeaning #-} @@ -2251,109 +2260,111 @@ instance Flat DefaultFun where ValueContains -> 97 ValueData -> 98 UnValueData -> 99 + ScaleValue -> 100 decode = go =<< decodeBuiltin - where go 0 = pure AddInteger - go 1 = pure SubtractInteger - go 2 = pure MultiplyInteger - go 3 = pure DivideInteger - go 4 = pure QuotientInteger - go 5 = pure RemainderInteger - go 6 = pure ModInteger - go 7 = pure EqualsInteger - go 8 = pure LessThanInteger - go 9 = pure LessThanEqualsInteger - go 10 = pure AppendByteString - go 11 = pure ConsByteString - go 12 = pure SliceByteString - go 13 = pure LengthOfByteString - go 14 = pure IndexByteString - go 15 = pure EqualsByteString - go 16 = pure LessThanByteString - go 17 = pure LessThanEqualsByteString - go 18 = pure Sha2_256 - go 19 = pure Sha3_256 - go 20 = pure Blake2b_256 - go 21 = pure VerifyEd25519Signature - go 22 = pure AppendString - go 23 = pure EqualsString - go 24 = pure EncodeUtf8 - go 25 = pure DecodeUtf8 - go 26 = pure IfThenElse - go 27 = pure ChooseUnit - go 28 = pure Trace - go 29 = pure FstPair - go 30 = pure SndPair - go 31 = pure ChooseList - go 32 = pure MkCons - go 33 = pure HeadList - go 34 = pure TailList - go 35 = pure NullList - go 36 = pure ChooseData - go 37 = pure ConstrData - go 38 = pure MapData - go 39 = pure ListData - go 40 = pure IData - go 41 = pure BData - go 42 = pure UnConstrData - go 43 = pure UnMapData - go 44 = pure UnListData - go 45 = pure UnIData - go 46 = pure UnBData - go 47 = pure EqualsData - go 48 = pure MkPairData - go 49 = pure MkNilData - go 50 = pure MkNilPairData - go 51 = pure SerialiseData - go 52 = pure VerifyEcdsaSecp256k1Signature - go 53 = pure VerifySchnorrSecp256k1Signature - go 54 = pure Bls12_381_G1_add - go 55 = pure Bls12_381_G1_neg - go 56 = pure Bls12_381_G1_scalarMul - go 57 = pure Bls12_381_G1_equal - go 58 = pure Bls12_381_G1_compress - go 59 = pure Bls12_381_G1_uncompress - go 60 = pure Bls12_381_G1_hashToGroup - go 61 = pure Bls12_381_G2_add - go 62 = pure Bls12_381_G2_neg - go 63 = pure Bls12_381_G2_scalarMul - go 64 = pure Bls12_381_G2_equal - go 65 = pure Bls12_381_G2_compress - go 66 = pure Bls12_381_G2_uncompress - go 67 = pure Bls12_381_G2_hashToGroup - go 68 = pure Bls12_381_millerLoop - go 69 = pure Bls12_381_mulMlResult - go 70 = pure Bls12_381_finalVerify - go 71 = pure Keccak_256 - go 72 = pure Blake2b_224 - go 73 = pure IntegerToByteString - go 74 = pure ByteStringToInteger - go 75 = pure AndByteString - go 76 = pure OrByteString - go 77 = pure XorByteString - go 78 = pure ComplementByteString - go 79 = pure ReadBit - go 80 = pure WriteBits - go 81 = pure ReplicateByte - go 82 = pure ShiftByteString - go 83 = pure RotateByteString - go 84 = pure CountSetBits - go 85 = pure FindFirstSetBit - go 86 = pure Ripemd_160 - go 87 = pure ExpModInteger - go 88 = pure DropList - go 89 = pure LengthOfArray - go 90 = pure ListToArray - go 91 = pure IndexArray - go 92 = pure Bls12_381_G1_multiScalarMul - go 93 = pure Bls12_381_G2_multiScalarMul - go 94 = pure InsertCoin - go 95 = pure LookupCoin - go 96 = pure UnionValue - go 97 = pure ValueContains - go 98 = pure ValueData - go 99 = pure UnValueData - go t = fail $ "Failed to decode builtin tag, got: " ++ show t + where go 0 = pure AddInteger + go 1 = pure SubtractInteger + go 2 = pure MultiplyInteger + go 3 = pure DivideInteger + go 4 = pure QuotientInteger + go 5 = pure RemainderInteger + go 6 = pure ModInteger + go 7 = pure EqualsInteger + go 8 = pure LessThanInteger + go 9 = pure LessThanEqualsInteger + go 10 = pure AppendByteString + go 11 = pure ConsByteString + go 12 = pure SliceByteString + go 13 = pure LengthOfByteString + go 14 = pure IndexByteString + go 15 = pure EqualsByteString + go 16 = pure LessThanByteString + go 17 = pure LessThanEqualsByteString + go 18 = pure Sha2_256 + go 19 = pure Sha3_256 + go 20 = pure Blake2b_256 + go 21 = pure VerifyEd25519Signature + go 22 = pure AppendString + go 23 = pure EqualsString + go 24 = pure EncodeUtf8 + go 25 = pure DecodeUtf8 + go 26 = pure IfThenElse + go 27 = pure ChooseUnit + go 28 = pure Trace + go 29 = pure FstPair + go 30 = pure SndPair + go 31 = pure ChooseList + go 32 = pure MkCons + go 33 = pure HeadList + go 34 = pure TailList + go 35 = pure NullList + go 36 = pure ChooseData + go 37 = pure ConstrData + go 38 = pure MapData + go 39 = pure ListData + go 40 = pure IData + go 41 = pure BData + go 42 = pure UnConstrData + go 43 = pure UnMapData + go 44 = pure UnListData + go 45 = pure UnIData + go 46 = pure UnBData + go 47 = pure EqualsData + go 48 = pure MkPairData + go 49 = pure MkNilData + go 50 = pure MkNilPairData + go 51 = pure SerialiseData + go 52 = pure VerifyEcdsaSecp256k1Signature + go 53 = pure VerifySchnorrSecp256k1Signature + go 54 = pure Bls12_381_G1_add + go 55 = pure Bls12_381_G1_neg + go 56 = pure Bls12_381_G1_scalarMul + go 57 = pure Bls12_381_G1_equal + go 58 = pure Bls12_381_G1_compress + go 59 = pure Bls12_381_G1_uncompress + go 60 = pure Bls12_381_G1_hashToGroup + go 61 = pure Bls12_381_G2_add + go 62 = pure Bls12_381_G2_neg + go 63 = pure Bls12_381_G2_scalarMul + go 64 = pure Bls12_381_G2_equal + go 65 = pure Bls12_381_G2_compress + go 66 = pure Bls12_381_G2_uncompress + go 67 = pure Bls12_381_G2_hashToGroup + go 68 = pure Bls12_381_millerLoop + go 69 = pure Bls12_381_mulMlResult + go 70 = pure Bls12_381_finalVerify + go 71 = pure Keccak_256 + go 72 = pure Blake2b_224 + go 73 = pure IntegerToByteString + go 74 = pure ByteStringToInteger + go 75 = pure AndByteString + go 76 = pure OrByteString + go 77 = pure XorByteString + go 78 = pure ComplementByteString + go 79 = pure ReadBit + go 80 = pure WriteBits + go 81 = pure ReplicateByte + go 82 = pure ShiftByteString + go 83 = pure RotateByteString + go 84 = pure CountSetBits + go 85 = pure FindFirstSetBit + go 86 = pure Ripemd_160 + go 87 = pure ExpModInteger + go 88 = pure DropList + go 89 = pure LengthOfArray + go 90 = pure ListToArray + go 91 = pure IndexArray + go 92 = pure Bls12_381_G1_multiScalarMul + go 93 = pure Bls12_381_G2_multiScalarMul + go 94 = pure InsertCoin + go 95 = pure LookupCoin + go 96 = pure UnionValue + go 97 = pure ValueContains + go 98 = pure ValueData + go 99 = pure UnValueData + go 100 = pure ScaleValue + go t = fail $ "Failed to decode builtin tag, got: " ++ show t size _ n = n + builtinTagWidth diff --git a/plutus-core/plutus-core/src/PlutusCore/Value.hs b/plutus-core/plutus-core/src/PlutusCore/Value.hs index 005942549af..99e1b4cb82c 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Value.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Value.hs @@ -28,6 +28,7 @@ module PlutusCore.Value ( maxInnerSize, insertCoin, deleteCoin, + scaleValue, lookupCoin, valueContains, unionValue, @@ -148,6 +149,11 @@ addQuantity :: Quantity -> Quantity -> Maybe Quantity addQuantity (UnsafeQuantity x) (UnsafeQuantity y) = quantity (x + y) {-# INLINEABLE addQuantity #-} +-- | Safely scale a quantity with given integer, checking for overflow. +scaleQuantity :: Integer -> Quantity -> Maybe Quantity +scaleQuantity x (UnsafeQuantity y) = quantity (x * y) +{-# INLINEABLE scaleQuantity #-} + ---------------------------------------------------------------------------------------------------- -- Builtin Value definition ------------------------------------------------------------------------ @@ -470,3 +476,28 @@ updateSizes old new = dec . inc then id else IntMap.update (\n -> if n <= 1 then Nothing else Just (n - 1)) old {-# INLINEABLE updateSizes #-} + +-- | \(O(n)\). Scale each token by the given constant factor. +scaleValue :: Integer -> Value -> BuiltinResult Value +scaleValue c (Value outer sizes size neg) + -- When scaling by positive factor, no need to change sizes and number of negative amounts. + | c > 0 = do + outer' <- go outer + BuiltinSuccess $ Value outer' sizes size neg + -- When scaling by negative factor, only need to "flip" negative amounts. + | c < 0 = do + outer' <- go outer + BuiltinSuccess $ Value outer' sizes size (size - neg) + -- Scaling by 0 is always empty value + | otherwise = BuiltinSuccess empty + where + go :: NestedMap -> BuiltinResult NestedMap + go x = traverse (traverse goScale) x + goScale :: Quantity -> BuiltinResult Quantity + goScale x = + case scaleQuantity c x of + Nothing -> + fail $ + "scaleValue: quantity out of bounds: " + <> show c <> " * " <> show (unQuantity x) + Just q -> pure q diff --git a/plutus-core/plutus-core/test/TypeSynthesis/Golden/DefaultFun/ScaleValue.golden.plc b/plutus-core/plutus-core/test/TypeSynthesis/Golden/DefaultFun/ScaleValue.golden.plc new file mode 100644 index 00000000000..3075c8c9c1c --- /dev/null +++ b/plutus-core/plutus-core/test/TypeSynthesis/Golden/DefaultFun/ScaleValue.golden.plc @@ -0,0 +1 @@ +integer -> value -> value \ No newline at end of file diff --git a/plutus-core/plutus-core/test/TypeSynthesis/Golden/Signatures/DefaultFun/ScaleValue.golden.sig b/plutus-core/plutus-core/test/TypeSynthesis/Golden/Signatures/DefaultFun/ScaleValue.golden.sig new file mode 100644 index 00000000000..246d00320eb --- /dev/null +++ b/plutus-core/plutus-core/test/TypeSynthesis/Golden/Signatures/DefaultFun/ScaleValue.golden.sig @@ -0,0 +1 @@ +Integer -> Value -> BuiltinResult Value \ No newline at end of file diff --git a/plutus-core/plutus-core/test/Value/Spec.hs b/plutus-core/plutus-core/test/Value/Spec.hs index 81e0a447e52..e25db53f2d9 100644 --- a/plutus-core/plutus-core/test/Value/Spec.hs +++ b/plutus-core/plutus-core/test/Value/Spec.hs @@ -188,6 +188,57 @@ prop_containsEnforcesPositivity v (BuiltinFailure{}, BuiltinFailure{}) -> property True _ -> property False +scaleIncorrectlyBound :: Integer -> Value -> Bool +scaleIncorrectlyBound factor val = + any + (\(_, _, V.unQuantity -> q) -> isNothing $ V.quantity $ q * factor) + $ V.toFlatList val + +prop_scaleBookKeeping :: Integer -> Value -> Property +prop_scaleBookKeeping factor v = + case V.scaleValue factor v of + BuiltinSuccess r -> checkBookkeeping r + _ -> property $ scaleIncorrectlyBound factor v + +prop_scaleByOneIsId :: Value -> Property +prop_scaleByOneIsId v = + property $ case V.scaleValue 1 v of + BuiltinSuccess r -> r == v + _ -> scaleIncorrectlyBound 1 v + +prop_negateInvolutive :: Value -> Property +prop_negateInvolutive v = + property $ case V.scaleValue (-1) v >>= V.scaleValue (-1) of + BuiltinSuccess r -> r == v + _ -> scaleIncorrectlyBound (-1) v + +prop_scaleZeroIsZero :: Value -> Property +prop_scaleZeroIsZero v = + property $ case V.scaleValue 0 v of + BuiltinSuccess r -> r == V.empty + _ -> scaleIncorrectlyBound 0 v + +prop_negateIsInverse :: Value -> Property +prop_negateIsInverse v = + let + inverseUnion = do + vInv <- V.scaleValue (-1) v + V.unionValue v vInv + in property $ case inverseUnion of + BuiltinSuccess r -> r == V.empty + _ -> scaleIncorrectlyBound (-1) v + +prop_oppositeScaleIsInverse :: Integer -> Value -> Property +prop_oppositeScaleIsInverse c v = + let + scaledValue = do + vInv <- V.scaleValue (negate c) v + v' <- V.scaleValue c v + V.unionValue v' vInv + in property $ case scaledValue of + BuiltinSuccess r -> r == V.empty + _ -> scaleIncorrectlyBound c v + prop_flatRoundtrip :: Value -> Property prop_flatRoundtrip v = Flat.unflat (Flat.flat v) === Right v @@ -422,6 +473,24 @@ tests = , testProperty "unionValueDetectsOverflow" prop_unionValueDetectsOverflow + , testProperty + "scaleBookKeeping" + prop_scaleBookKeeping + , testProperty + "scaleByOneIsId" + prop_scaleByOneIsId + , testProperty + "scaleZeroIsZero" + prop_scaleZeroIsZero + , testProperty + "negateInvolutive" + prop_negateInvolutive + , testProperty + "negateIsInverse" + prop_negateIsInverse + , testProperty + "oppositeScaleIsInverse" + prop_oppositeScaleIsInverse , testProperty "flatRoundtrip" prop_flatRoundtrip diff --git a/plutus-core/plutus-ir/src/PlutusIR/Transform/RewriteRules/CommuteFnWithConst.hs b/plutus-core/plutus-ir/src/PlutusIR/Transform/RewriteRules/CommuteFnWithConst.hs index c0da5dd0a30..ffd06e9bc2b 100644 --- a/plutus-core/plutus-ir/src/PlutusIR/Transform/RewriteRules/CommuteFnWithConst.hs +++ b/plutus-core/plutus-ir/src/PlutusIR/Transform/RewriteRules/CommuteFnWithConst.hs @@ -156,3 +156,4 @@ isCommutative = \case ValueContains -> False ValueData -> False UnValueData -> False + ScaleValue -> False diff --git a/plutus-core/testlib/PlutusCore/Generators/QuickCheck/Builtin.hs b/plutus-core/testlib/PlutusCore/Generators/QuickCheck/Builtin.hs index 7a6034e6015..421c6d90528 100644 --- a/plutus-core/testlib/PlutusCore/Generators/QuickCheck/Builtin.hs +++ b/plutus-core/testlib/PlutusCore/Generators/QuickCheck/Builtin.hs @@ -300,7 +300,7 @@ instance ArbitraryBuiltin Value.Quantity where instance Arbitrary Value.Quantity where arbitrary = arbitraryBuiltin - shrink = shrinkBuiltin + shrink = const [] -- shrinkBuiltin {-| A wrapper for satisfying an @Arbitrary a@ constraint without implementing an 'Arbitrary' instance for @a@. diff --git a/plutus-tx-plugin/src/PlutusTx/Compiler/Builtins.hs b/plutus-tx-plugin/src/PlutusTx/Compiler/Builtins.hs index 74cdeefd497..77e3b8b590a 100644 --- a/plutus-tx-plugin/src/PlutusTx/Compiler/Builtins.hs +++ b/plutus-tx-plugin/src/PlutusTx/Compiler/Builtins.hs @@ -299,6 +299,7 @@ builtinNames = , 'Builtins.valueContains , 'Builtins.mkValue , 'Builtins.unsafeDataAsValue + , 'Builtins.scaleValue ] defineBuiltinTerm :: (CompilingDefault uni fun m ann) => Ann -> TH.Name -> PIRTerm uni fun -> m () @@ -733,6 +734,7 @@ defineBuiltinTerms = do PLC.ValueContains -> defineBuiltinInl 'Builtins.valueContains PLC.ValueData -> defineBuiltinInl 'Builtins.mkValue PLC.UnValueData -> defineBuiltinInl 'Builtins.unsafeDataAsValue + PLC.ScaleValue -> defineBuiltinInl 'Builtins.scaleValue defineBuiltinTypes :: (CompilingDefault uni fun m ann) => m () defineBuiltinTypes = do diff --git a/plutus-tx/src/PlutusTx/Builtins.hs b/plutus-tx/src/PlutusTx/Builtins.hs index aec583a0c57..e20ca01c993 100644 --- a/plutus-tx/src/PlutusTx/Builtins.hs +++ b/plutus-tx/src/PlutusTx/Builtins.hs @@ -165,6 +165,7 @@ module PlutusTx.Builtins ( BI.valueContains, BI.mkValue, BI.unsafeDataAsValue, + BI.scaleValue, ) where import Data.Maybe diff --git a/plutus-tx/src/PlutusTx/Builtins/Internal.hs b/plutus-tx/src/PlutusTx/Builtins/Internal.hs index 6cb42b9923b..1d3861f3467 100644 --- a/plutus-tx/src/PlutusTx/Builtins/Internal.hs +++ b/plutus-tx/src/PlutusTx/Builtins/Internal.hs @@ -1135,6 +1135,16 @@ unsafeDataAsValue (BuiltinData d) = Haskell.error "Data to Value conversion errored." {-# OPAQUE unsafeDataAsValue #-} +scaleValue :: Integer -> BuiltinValue -> BuiltinValue +scaleValue c (BuiltinValue val) = + case Value.scaleValue c val of + BuiltinSuccess v -> BuiltinValue v + BuiltinSuccessWithLogs logs v -> traceAll logs (BuiltinValue v) + BuiltinFailure logs err -> + traceAll (logs <> pure (display err)) $ + Haskell.error "scaleValue errored." +{-# OPAQUE scaleValue #-} + caseInteger :: Integer -> [a] -> a caseInteger i b = b !! fromIntegral i {-# OPAQUE caseInteger #-}