Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bench/cardano-profile/cardano-profile.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ common project-config
-Wpartial-fields
-Wredundant-constraints
-Wwarn=deprecations
-fdefer-typed-holes -Wno-typed-holes

library
import: project-config
Expand Down
17 changes: 9 additions & 8 deletions bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ overlay profile =
-- "derive" needs above "shelley", "alonzo" and "conway" properties.
derive :: Types.Profile -> Types.Profile
derive p@(Types.Profile _ _ _ comp _era gsis _ n gtor _ _ _ ana _ _ _ _) =
let
let
-- Absolute/epoch durations:
----------------------------
slot_duration = Types.slot_duration gsis -- NominalDiffTime
Expand Down Expand Up @@ -403,7 +403,7 @@ cliArgs p@(Types.Profile _ _ _ comp __ gsis _ _ _ _ _ _ _ dved _ _ _) =
++
if Types.dense_pool_density comp /= 1
then
[
[
Aeson.String "--bulk-pool-cred-files", Aeson.Number $ fromInteger $ Types.n_dense_hosts comp
, Aeson.String "--bulk-pools-per-file", Aeson.Number $ fromInteger $ Types.dense_pool_density comp
]
Expand Down Expand Up @@ -480,12 +480,13 @@ addEras :: Map.Map String Types.Profile -> Map.Map String Types.Profile
addEras = foldMap
(\profile -> Map.fromList $
catMaybes
[ addEra profile Types.Shelley "shey"
, addEra profile Types.Allegra "alra"
, addEra profile Types.Mary "mary"
, addEra profile Types.Alonzo "alzo"
, addEra profile Types.Babbage "bage"
, addEra profile Types.Conway "coay"
[ addEra profile Types.Shelley "shey"
, addEra profile Types.Allegra "alra"
, addEra profile Types.Mary "mary"
, addEra profile Types.Alonzo "alzo"
, addEra profile Types.Babbage "bage"
, addEra profile Types.Conway "coay"
, addEra profile Types.Dijkstra "dira"
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ empty = Types.Profile {
, Types.shelley = mempty
, Types.alonzo = mempty
, Types.conway = Nothing
, Types.dijkstra = Nothing
, Types.slot_duration = 0
, Types.epoch_length = 0
, Types.active_slots_coeff = 0
Expand Down
36 changes: 20 additions & 16 deletions bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -247,30 +247,33 @@ instance Aeson.FromJSON Topology where

--------------------------------------------------------------------------------

data Era = Shelley | Allegra | Mary | Alonzo | Babbage | Conway
data Era = Shelley | Allegra | Mary | Alonzo | Babbage | Conway | Dijkstra
deriving (Show, Eq, Ord, Generic)

instance Aeson.ToJSON Era where
toJSON Allegra = Aeson.toJSON ("allegra" :: Text.Text)
toJSON Shelley = Aeson.toJSON ("shelley" :: Text.Text)
toJSON Mary = Aeson.toJSON ("mary" :: Text.Text)
toJSON Alonzo = Aeson.toJSON ("alonzo" :: Text.Text)
toJSON Babbage = Aeson.toJSON ("babbage" :: Text.Text)
toJSON Conway = Aeson.toJSON ("conway" :: Text.Text)
toJSON Allegra = Aeson.toJSON ("allegra" :: Text.Text)
toJSON Shelley = Aeson.toJSON ("shelley" :: Text.Text)
toJSON Mary = Aeson.toJSON ("mary" :: Text.Text)
toJSON Alonzo = Aeson.toJSON ("alonzo" :: Text.Text)
toJSON Babbage = Aeson.toJSON ("babbage" :: Text.Text)
toJSON Conway = Aeson.toJSON ("conway" :: Text.Text)
toJSON Dijkstra = Aeson.toJSON ("dijkstra" :: Text.Text)

instance Aeson.FromJSON Era where
parseJSON = Aeson.withText "Era" $ \t -> case t of
"allegra" -> return Allegra
"shelley" -> return Shelley
"mary" -> return Mary
"alonzo" -> return Alonzo
"babbage" -> return Babbage
"conway" -> return Conway
_ -> fail $ "Unknown Era: \"" ++ Text.unpack t ++ "\""
"allegra" -> return Allegra
"shelley" -> return Shelley
"mary" -> return Mary
"alonzo" -> return Alonzo
"babbage" -> return Babbage
"conway" -> return Conway
"dijkstra" -> return Dijkstra
_ -> fail $ "Unknown Era: \"" ++ Text.unpack t ++ "\""

-- | Minimal major protocol version per era
firstEraForMajorVersion :: Int -> Era
firstEraForMajorVersion pv
| pv >= 11 = Dijkstra -- TODO: Once Dijkstra era is out, re-check the value
| pv >= 9 = Conway
| pv >= 7 = Babbage
| pv >= 5 = Alonzo
Expand Down Expand Up @@ -311,6 +314,7 @@ data Genesis = Genesis
, shelley :: KM.KeyMap Aeson.Value
, alonzo :: KM.KeyMap Aeson.Value
, conway :: Maybe (KM.KeyMap Aeson.Value) -- TODO: Remove the null.
, dijkstra :: Maybe (KM.KeyMap Aeson.Value)

-- Absolute durations:
, slot_duration :: Time.NominalDiffTime
Expand Down Expand Up @@ -367,7 +371,7 @@ instance Aeson.FromJSON ChainDB where
(Aeson.defaultOptions {Aeson.rejectUnknownFields = True})

data Chunks = Chunks
{
{
chaindb_server :: Integer
, explorer_chunk :: Integer
}
Expand All @@ -390,7 +394,7 @@ instance Aeson.FromJSON Chunks where
--------------------------------------------------------------------------------

data Node = Node
{
{
utxo_lmdb :: Bool
, ssd_directory :: Maybe String

Expand Down
10 changes: 9 additions & 1 deletion nix/nixos/tx-generator-service.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ let
inherit (cfg.plutus) limitExecutionMem limitExecutionSteps;
};
targetNodes = targetNodesList cfg.targetNodes;
era = capitalise cfg.era;
era = capitalise
(
if cfg.era == "dijkstra"
then # TODO: (@russoul) Get rid of this once tx-generator supports dijkstra
builtins.trace "Falling back to conway era in place of dijkstra for now..." "conway"
else
cfg.era
);
inherit
add_tx_size
debugMode
Expand Down Expand Up @@ -123,6 +130,7 @@ in pkgs.commonLib.defServiceModule
"alonzo"
"babbage"
"conway"
"dijkstra"
])
"mary"
"Cardano era to generate transactions for.";
Expand Down
7 changes: 6 additions & 1 deletion nix/workbench/genesis/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ case "$op" in
if genesis cache-test "$cache_path"; then
cache_hit=t
cache_hit_desc='hit'
else
else
cache_hit=
cache_hit_desc='miss'
fi
Expand Down Expand Up @@ -691,6 +691,11 @@ genesis-create-testnet-data() {
--out-dir "$dir"
"${args[@]}"
)
if [ "$era" = "dijkstra" ]; then
era="conway" # TODO: (@russoul) Get rid of this once cardano-cli supports dijkstra
warn genesis "Falling back to conway in place of dijkstra for the time being..."
fi
# TODO Just fallback to conway + print a message to not forget to implement dira
progress genesis "$(colorise cardano-cli "$era" create-testnet-data "${create_testnet_data_args[@]}")"
cardano-cli "$era" genesis create-testnet-data "${create_testnet_data_args[@]}"

Expand Down
18 changes: 10 additions & 8 deletions nix/workbench/service/nodes.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let
"alonzo"
"babbage"
"conway"
"dijkstra"
];

configHardforksIntoEra = era:
Expand All @@ -41,19 +42,20 @@ let
then ret
else go ret (__head rest) (__tail rest);
eraSetupHardforks = {
byron = {};
shelley = { TestShelleyHardForkAtEpoch = 0; };
allegra = { TestAllegraHardForkAtEpoch = 0; };
mary = { TestMaryHardForkAtEpoch = 0; };
alonzo = { TestAlonzoHardForkAtEpoch = 0; };
babbage = { TestBabbageHardForkAtEpoch = 0; };
conway = { TestConwayHardForkAtEpoch = 0; };
byron = {};
shelley = { TestShelleyHardForkAtEpoch = 0; };
allegra = { TestAllegraHardForkAtEpoch = 0; };
mary = { TestMaryHardForkAtEpoch = 0; };
alonzo = { TestAlonzoHardForkAtEpoch = 0; };
babbage = { TestBabbageHardForkAtEpoch = 0; };
conway = { TestConwayHardForkAtEpoch = 0; };
dijkstra = { TestDijktraHardForkAtEpoch = 0; };
};
in if __hasAttr era eraSetupHardforks
then go {} (__head eras) (__tail eras)
else throw "configHardforksIntoEra: unknown era '${era}'";

liveTablesPath = i:
liveTablesPath = i:
if (profile.node ? "ssd_directory" && profile.node.ssd_directory != null)
then "${profile.node.ssd_directory}/lmdb-node-${toString i}"
else null;
Expand Down
Loading