Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tx-generator: Core.hs: simplifications + better non-Byron support #6085

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Changes from 1 commit
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
14 changes: 5 additions & 9 deletions bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new helper function caseByronOrShelleyBasedEra is wonderful, thanks for propagating its use onward!

Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ queryRemoteProtocolParameters :: ActionM ProtocolParameters
queryRemoteProtocolParameters = do
localNodeConnectInfo <- getLocalConnectInfo
chainTip <- liftIO $ getLocalChainTip localNodeConnectInfo
era <- queryEra
AnyCardanoEra era <- queryEra
let
callQuery :: forall era.
QueryInEra era (Ledger.PParams (ShelleyLedgerEra era))
Expand All @@ -187,14 +187,10 @@ queryRemoteProtocolParameters = do
liftIO $ BSL.writeFile pparamsFile $ prettyPrintOrdered pp'
traceDebug $ "queryRemoteProtocolParameters : query result saved in: " ++ pparamsFile
return pp'
case era of
AnyCardanoEra ByronEra -> liftTxGenError $ TxGenError "queryRemoteProtocolParameters Byron not supported"
AnyCardanoEra ShelleyEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraShelley QueryProtocolParameters
AnyCardanoEra AllegraEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraAllegra QueryProtocolParameters
AnyCardanoEra MaryEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraMary QueryProtocolParameters
AnyCardanoEra AlonzoEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraAlonzo QueryProtocolParameters
AnyCardanoEra BabbageEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraBabbage QueryProtocolParameters
AnyCardanoEra ConwayEra -> callQuery $ QueryInShelleyBasedEra ShelleyBasedEraConway QueryProtocolParameters
caseByronOrShelleyBasedEra
(liftTxGenError $ TxGenError "queryRemoteProtocolParameters Byron not supported")
(\sbe -> callQuery $ QueryInShelleyBasedEra sbe QueryProtocolParameters)
era

getProtocolParameters :: ActionM ProtocolParameters
getProtocolParameters = do
Expand Down