From b19c29204c5238adedd1ef7715c3aeeabfe9cc58 Mon Sep 17 00:00:00 2001 From: russoul Date: Tue, 9 Sep 2025 22:52:52 +0200 Subject: [PATCH 1/4] Basic Dijkstra era prep in cardano-profile --- bench/cardano-profile/cardano-profile.cabal | 1 + .../src/Cardano/Benchmarking/Profile/Types.hs | 37 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/bench/cardano-profile/cardano-profile.cabal b/bench/cardano-profile/cardano-profile.cabal index a9550d9a2af..fa5692ca1ea 100644 --- a/bench/cardano-profile/cardano-profile.cabal +++ b/bench/cardano-profile/cardano-profile.cabal @@ -42,6 +42,7 @@ common project-config -Wpartial-fields -Wredundant-constraints -Wwarn=deprecations + -fdefer-typed-holes -Wno-typed-holes library import: project-config diff --git a/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs b/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs index 18397b1712f..4cc19e2bd50 100644 --- a/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs +++ b/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs @@ -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 >= _ = Dijkstra -- TODO: (@russoul) | pv >= 9 = Conway | pv >= 7 = Babbage | pv >= 5 = Alonzo @@ -296,6 +299,7 @@ cf. https://github.com/cardano-foundation/CIPs/blob/master/CIP-0059/feature-tabl | 2024/09 | Voltaire | Conway | 133660855 | 507 | 9,0 | Praos | Ouroboros Genesis/Praos | Chang HF | | 2025/01 | Voltaire | Conway | 146620809 | 537 | 10,0 | Praos | Ouroboros Genesis/Praos | Plomin HF | -} +-- TODO: Update the table (@russoul) -------------------------------------------------------------------------------- @@ -311,6 +315,7 @@ data Genesis = Genesis , shelley :: KM.KeyMap Aeson.Value , alonzo :: KM.KeyMap Aeson.Value , conway :: Maybe (KM.KeyMap Aeson.Value) -- TODO: Remove the null. + -- TODO: Should anything be added for Dijkstra (@russoul)? -- Absolute durations: , slot_duration :: Time.NominalDiffTime @@ -367,7 +372,7 @@ instance Aeson.FromJSON ChainDB where (Aeson.defaultOptions {Aeson.rejectUnknownFields = True}) data Chunks = Chunks - { + { chaindb_server :: Integer , explorer_chunk :: Integer } @@ -390,7 +395,7 @@ instance Aeson.FromJSON Chunks where -------------------------------------------------------------------------------- data Node = Node - { + { utxo_lmdb :: Bool , ssd_directory :: Maybe String From ff1f6237ce3fb16518222c2b8e7becf601a5295c Mon Sep 17 00:00:00 2001 From: russoul Date: Wed, 10 Sep 2025 11:07:08 +0200 Subject: [PATCH 2/4] Apply suggestions --- .../src/Cardano/Benchmarking/Profile/Primitives.hs | 1 + .../src/Cardano/Benchmarking/Profile/Types.hs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Primitives.hs b/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Primitives.hs index dcbc2535f6f..3fa878f2cb0 100644 --- a/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Primitives.hs +++ b/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Primitives.hs @@ -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 diff --git a/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs b/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs index 4cc19e2bd50..e5d6cf5cfa0 100644 --- a/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs +++ b/bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs @@ -273,7 +273,7 @@ instance Aeson.FromJSON Era where -- | Minimal major protocol version per era firstEraForMajorVersion :: Int -> Era firstEraForMajorVersion pv - | pv >= _ = Dijkstra -- TODO: (@russoul) + | pv >= 11 = Dijkstra -- TODO: Once Dijkstra era is out, re-check the value | pv >= 9 = Conway | pv >= 7 = Babbage | pv >= 5 = Alonzo @@ -299,7 +299,6 @@ cf. https://github.com/cardano-foundation/CIPs/blob/master/CIP-0059/feature-tabl | 2024/09 | Voltaire | Conway | 133660855 | 507 | 9,0 | Praos | Ouroboros Genesis/Praos | Chang HF | | 2025/01 | Voltaire | Conway | 146620809 | 537 | 10,0 | Praos | Ouroboros Genesis/Praos | Plomin HF | -} --- TODO: Update the table (@russoul) -------------------------------------------------------------------------------- @@ -315,7 +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. - -- TODO: Should anything be added for Dijkstra (@russoul)? + , dijkstra :: Maybe (KM.KeyMap Aeson.Value) -- Absolute durations: , slot_duration :: Time.NominalDiffTime From 03582a76ee091c09af8ac1a34fbee374efa9aa5b Mon Sep 17 00:00:00 2001 From: russoul Date: Thu, 11 Sep 2025 15:15:14 +0200 Subject: [PATCH 3/4] Basic nix changes to be able to execute `ERA=dira make ci-bench` --- .../src/Cardano/Benchmarking/Profile.hs | 17 +++++++++-------- nix/nixos/tx-generator-service.nix | 1 + nix/workbench/service/nodes.nix | 16 +++++++++------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs b/bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs index 59f2c7b2ceb..c15796e0722 100644 --- a/bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs +++ b/bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs @@ -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 @@ -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 ] @@ -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" ] ) diff --git a/nix/nixos/tx-generator-service.nix b/nix/nixos/tx-generator-service.nix index e276e43a7b4..cda86edaad4 100644 --- a/nix/nixos/tx-generator-service.nix +++ b/nix/nixos/tx-generator-service.nix @@ -123,6 +123,7 @@ in pkgs.commonLib.defServiceModule "alonzo" "babbage" "conway" + "dijkstra" ]) "mary" "Cardano era to generate transactions for."; diff --git a/nix/workbench/service/nodes.nix b/nix/workbench/service/nodes.nix index 82e1fd6e994..a2d6af197e0 100644 --- a/nix/workbench/service/nodes.nix +++ b/nix/workbench/service/nodes.nix @@ -32,6 +32,7 @@ let "alonzo" "babbage" "conway" + "dijkstra" ]; configHardforksIntoEra = era: @@ -41,13 +42,14 @@ 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) From e38a3dcc3a0774c643bcc13b56e62765e05ca985 Mon Sep 17 00:00:00 2001 From: russoul Date: Fri, 12 Sep 2025 11:50:03 +0200 Subject: [PATCH 4/4] Temporary tx-generator & genesis hacks to be able to start a cluster in dijkstra --- nix/nixos/tx-generator-service.nix | 9 ++++++++- nix/workbench/genesis/genesis.sh | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/nix/nixos/tx-generator-service.nix b/nix/nixos/tx-generator-service.nix index cda86edaad4..a53aa7d3b12 100644 --- a/nix/nixos/tx-generator-service.nix +++ b/nix/nixos/tx-generator-service.nix @@ -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 diff --git a/nix/workbench/genesis/genesis.sh b/nix/workbench/genesis/genesis.sh index 15f4e09a165..848806c0b63 100644 --- a/nix/workbench/genesis/genesis.sh +++ b/nix/workbench/genesis/genesis.sh @@ -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 @@ -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[@]}"