Skip to content

Commit 1293264

Browse files
committed
wb | profile delegators property is never null
1 parent 6586202 commit 1293264

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ finalize profile =
213213
else Types.per_pool_balance genesis
214214
-- TODO: Remove or move to derive ?
215215
, Types.delegator_coin =
216-
if Types.delegators genesis == Just 0
216+
if Types.delegators genesis == 0
217217
then 0
218218
else Types.per_pool_balance genesis
219219
}
@@ -372,9 +372,8 @@ derive p@(Types.Profile _ _ _ comp _era gsis _ n gtor _ _ _ ana _ _ _ _) =
372372
-- UTxO:
373373
--------
374374
(effective_delegators, delegators_effective) =
375-
case Types.delegators gsis of
376-
(Just d) -> (d, max d (Types.n_pools comp))
377-
Nothing -> (Types.n_pools comp, Types.n_pools comp)
375+
let d = Types.delegators gsis
376+
in (d, max d (Types.n_pools comp))
378377
utxo_generated = generator_tx_count * Types.inputs_per_tx gtor
379378
utxo_stuffed = max 0 (Types.utxo gsis)
380379

@@ -383,9 +382,7 @@ derive p@(Types.Profile _ _ _ comp _era gsis _ n gtor _ _ _ ana _ _ _ _) =
383382
dataset_measure =
384383
if Types.utxo gsis == 0
385384
then 0
386-
else case Types.delegators gsis of
387-
(Just d) -> Types.utxo gsis + d
388-
Nothing -> Types.utxo gsis
385+
else Types.utxo gsis + Types.delegators gsis
389386
-- NominalDiffTime.
390387
dataset_induced_startup_delay_optimistic =
391388
if dataset_measure < 10000

bench/cardano-profile/src/Cardano/Benchmarking/Profile/Primitives.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ empty = Types.Profile {
153153
, Types.active_slots_coeff = 0
154154
, Types.parameter_k = 0
155155
, Types.utxo = 0
156-
, Types.delegators = Nothing
156+
, Types.delegators = 0
157157
, Types.dreps = 0
158158
, Types.extra_future_offset = 0
159159
, Types.per_pool_balance = 0
@@ -512,9 +512,9 @@ utxo i = genesis
512512
delegators :: HasCallStack => Integer -> Types.Profile -> Types.Profile
513513
delegators i = genesis
514514
(\g ->
515-
if isJust (Types.delegators g)
516-
then error "delegators: `delegators` already set (not Nothing)."
517-
else g {Types.delegators = Just i}
515+
if Types.delegators g /= 0
516+
then error "delegators: `delegators` already set (not zero)."
517+
else g {Types.delegators = i}
518518
)
519519

520520
dreps :: HasCallStack => Integer -> Types.Profile -> Types.Profile

bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ data Genesis = Genesis
294294

295295
-- Size:
296296
, utxo :: Integer
297-
, delegators :: Maybe Integer
297+
, delegators :: Integer
298298
, dreps :: Integer
299299
, extra_future_offset :: Time.NominalDiffTime -- Size dependent!
300300

bench/cardano-profile/test/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ ciTestBage = Types.Profile {
314314
, Types.active_slots_coeff = 0.05
315315
, Types.parameter_k = 3
316316
, Types.utxo = 0
317-
, Types.delegators = Just 0
317+
, Types.delegators = 0
318318
, Types.dreps = 0
319319
, Types.extra_future_offset = 0
320320
, Types.per_pool_balance = 1000000000000000

0 commit comments

Comments
 (0)