Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ math: true
- Leios: `leiosAnnouncementPeriodLength`, `leiosVotePeriodLength`, `leiosDiffusionPeriodLength`, `leiosCommitteeSize`, `leiosQuorumStakeThreshold`, `maxEndorserBlockReferencesSize`, `maxEndorserBlockTransactionsSize`, `maxExecutionUnitsPerEndorserBlock` and `maxReferenceScriptsSizePerEndorserBlock`.
- Peras: `perasMinCandidateBlockAge` (in slots), `perasHealingFactor`, `perasCertificateBoost`, `perasTargetCommitteeSize`, `perasBootstrapRound` (`null` when not set) and `perasQuorumThresholdSafetyMargin`.

- Ogmios now reads the node configuration format of cardano-node 11.2.0 and later (its mainnet configuration and the files cardano-testnet writes), where the settings sit in sections under `Configuration` (such as `Configuration.Protocol.ShelleyGenesisFile`). Before, it exited at start-up because it found no genesis files. Configurations with all settings at the top level still work.

### [6.14.0] - 2025-10-16

#### Added
Expand Down
6 changes: 4 additions & 2 deletions perSystem/project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@
# Test.Path.Util.getProjectRoot uses TH `makeRelativeToProject ""`
# which bakes the compile-time absolute path
# /build/ogmios-src-test-unit-root/server into the binary. Recreate
# that path at runtime with the golden fixtures and the
# cardano-configurations submodule content.
# that path at runtime with the golden fixtures, the node
# configuration fixtures and the cardano-configurations submodule
# content.
mkdir -p /build/ogmios-src-test-unit-root/server/test
cp -r ${self}/server/test/golden /build/ogmios-src-test-unit-root/server/test/golden
cp -r ${self}/server/test/node-config /build/ogmios-src-test-unit-root/server/test/node-config
cp -r ${self}/server/config /build/ogmios-src-test-unit-root/server/config
'';
}
Expand Down
5 changes: 1 addition & 4 deletions scripts/dijkstra-devnet-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,7 @@ wait_for 300 cli query tip || fail "the node does not answer"
echo "Waiting for the Dijkstra era."
wait_for 600 in_dijkstra || fail "the chain did not reach the Dijkstra era"

# Ogmios wants one flat node configuration. cardano-testnet writes it in sections.
jq '.Configuration | reduce to_entries[] as $e ({}; if ($e.value | type) == "object" then . + $e.value else . + {($e.key): $e.value} end)' \
"$WORK/env/configuration.yaml" > "$WORK/env/node-config.json"
"$OGMIOS_BIN" --node-socket "$SOCKET" --node-config "$WORK/env/node-config.json" \
"$OGMIOS_BIN" --node-socket "$SOCKET" --node-config "$WORK/env/configuration.yaml" \
--host 127.0.0.1 --port 1337 > "$WORK/ogmios.log" 2>&1 &
PIDS+=($!)
wait_for 120 ogmios_connected || fail "Ogmios did not connect to the node"
Expand Down
23 changes: 19 additions & 4 deletions server/src/Ogmios/App/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Ogmios.App.Configuration
, Severity (..)

-- * Genesis Configurations
, lookupNodeConfig
, readByronGenesis
, readShelleyGenesis
, readAlonzoGenesis
Expand Down Expand Up @@ -47,6 +48,9 @@ import Data.Aeson
( ToJSON
, genericToEncoding
)
import Data.Aeson.Key
( Key
)
import Data.Aeson.Lens
( _JSON'
, _String
Expand Down Expand Up @@ -114,10 +118,21 @@ mkSystemStart =
where
toPicoResolution = (*1000000000000)

-- | Look up a genesis file setting of the node configuration. Since
-- cardano-node 11.2.0, the setting sits in the @Protocol@ section under
-- @Configuration@. The node also accepts it loose under @Configuration@, or at
-- the top level as before.
lookupNodeConfig :: Key -> Json.Value -> Maybe Text
lookupNodeConfig k nodeConfig = asum
[ nodeConfig ^? key "Configuration" . key "Protocol" . key k . _String
, nodeConfig ^? key "Configuration" . key k . _String
, nodeConfig ^? key k . _String
]

readByronGenesis :: MonadIO m => FilePath -> m (GenesisConfig ByronEra)
readByronGenesis configFile = do
nodeConfig <- Yaml.decodeFileThrow @_ @Json.Value configFile
case nodeConfig ^? key "ByronGenesisFile" . _String of
case lookupNodeConfig "ByronGenesisFile" nodeConfig of
Nothing ->
liftIO $ fail "Missing 'ByronGenesisFile' from node's configuration."
Just (toString -> genesisFile) -> do
Expand All @@ -131,7 +146,7 @@ readByronGenesis configFile = do
readShelleyGenesis :: MonadIO m => FilePath -> m (GenesisConfig ShelleyEra)
readShelleyGenesis configFile = do
nodeConfig <- Yaml.decodeFileThrow @_ @Json.Value configFile
case nodeConfig ^? key "ShelleyGenesisFile" . _String of
case lookupNodeConfig "ShelleyGenesisFile" nodeConfig of
Nothing ->
liftIO $ fail "Missing 'ShelleyGenesisFile' from node's configuration."
Just (toString -> genesisFile) -> do
Expand All @@ -140,7 +155,7 @@ readShelleyGenesis configFile = do
readAlonzoGenesis :: MonadIO m => FilePath -> m (GenesisConfig AlonzoEra)
readAlonzoGenesis configFile = do
nodeConfig <- Yaml.decodeFileThrow @_ @Json.Value configFile
case nodeConfig ^? key "AlonzoGenesisFile" . _String of
case lookupNodeConfig "AlonzoGenesisFile" nodeConfig of
Nothing ->
liftIO $ fail "Missing 'AlonzoGenesisFile' from node's configuration."
Just (toString -> genesisFile) -> do
Expand Down Expand Up @@ -218,7 +233,7 @@ readConwayGenesis configFile = do
pure $ Left $
"Invalid (non-JSON or non-YAML) or missing node's configuration file: " <> formatParseException e
Right nodeConfig ->
case nodeConfig ^? key "ConwayGenesisFile" . _String of
case lookupNodeConfig "ConwayGenesisFile" nodeConfig of
Nothing ->
pure $ Left "Missing 'ConwayGenesisFile' from node's configuration."
Just (toString -> genesisFile) -> do
Expand Down
5 changes: 3 additions & 2 deletions server/src/Ogmios/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import Ogmios.App.Configuration
, SystemStart (..)
, TraceConfiguration (..)
, includeAllCbor
, lookupNodeConfig
, omitOptionalCbor
)
import Options.Applicative.Help.Pretty
Expand Down Expand Up @@ -383,8 +384,8 @@ parseNetworkParameters :: FilePath -> IO NetworkParameters
parseNetworkParameters configFile = runOrDie $ do
config <- decodeYaml configFile
let genesisFiles = (,)
<$> config ^? key "ByronGenesisFile" . _String
<*> config ^? key "ShelleyGenesisFile" . _String
<$> lookupNodeConfig "ByronGenesisFile" config
<*> lookupNodeConfig "ShelleyGenesisFile" config
case genesisFiles of
Nothing ->
throwE "Missing 'ByronGenesisFile' and/or 'ShelleyGenesisFile' from Cardano's configuration?"
Expand Down
Loading
Loading