Skip to content

Commit edebc27

Browse files
committed
tx-generator: push Byron incompatibility upwards
1 parent b5f315d commit edebc27

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,23 @@ cancelBenchmark = do
162162
getLocalConnectInfo :: ActionM LocalNodeConnectInfo
163163
getLocalConnectInfo = makeLocalConnectInfo <$> getEnvNetworkId <*> getEnvSocketPath
164164

165-
queryEra :: ActionM AnyCardanoEra
165+
queryEra :: ActionM AnyShelleyBasedEra
166166
queryEra = do
167167
localNodeConnectInfo <- getLocalConnectInfo
168168
chainTip <- getLocalChainTip localNodeConnectInfo
169-
mapExceptT liftIO .
169+
AnyCardanoEra era <- mapExceptT liftIO .
170170
modifyError (Env.TxGenError . TxGenError . show) $
171171
queryNodeLocalState localNodeConnectInfo (SpecificPoint $ chainTipToChainPoint chainTip) QueryCurrentEra
172+
caseByronOrShelleyBasedEra
173+
(liftTxGenError $ TxGenError "queryEra Byron not supported")
174+
(return . AnyShelleyBasedEra)
175+
era
172176

173177
queryRemoteProtocolParameters :: ActionM ProtocolParameters
174178
queryRemoteProtocolParameters = do
175179
localNodeConnectInfo <- getLocalConnectInfo
176180
chainTip <- liftIO $ getLocalChainTip localNodeConnectInfo
177-
AnyCardanoEra era <- queryEra
181+
AnyShelleyBasedEra sbe <- queryEra
178182
let
179183
callQuery :: forall era.
180184
QueryInEra era (Ledger.PParams (ShelleyLedgerEra era))
@@ -187,18 +191,15 @@ queryRemoteProtocolParameters = do
187191
liftIO $ BSL.writeFile pparamsFile $ prettyPrintOrdered pp'
188192
traceDebug $ "queryRemoteProtocolParameters : query result saved in: " ++ pparamsFile
189193
return pp'
190-
caseByronOrShelleyBasedEra
191-
(liftTxGenError $ TxGenError "queryRemoteProtocolParameters Byron not supported")
192-
(\sbe -> callQuery $ QueryInShelleyBasedEra sbe QueryProtocolParameters)
193-
era
194+
callQuery $ QueryInShelleyBasedEra sbe QueryProtocolParameters
194195

195196
getProtocolParameters :: ActionM ProtocolParameters
196197
getProtocolParameters = do
197198
getProtoParamMode >>= \case
198199
ProtocolParameterQuery -> queryRemoteProtocolParameters
199200
ProtocolParameterLocal parameters -> return parameters
200201

201-
waitForEra :: AnyCardanoEra -> ActionM ()
202+
waitForEra :: AnyShelleyBasedEra -> ActionM ()
202203
waitForEra era = do
203204
currentEra <- queryEra
204205
if currentEra == era

bench/tx-generator/src/Cardano/Benchmarking/Script/Types.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ data Action where
117117
-- with testing and quick fixes.
118118
Reserved :: [String] -> Action
119119
-- 'WaitForEra' loops doing delays/sleeps until the current era matches.
120-
WaitForEra :: !AnyCardanoEra -> Action
120+
WaitForEra :: !AnyShelleyBasedEra -> Action
121121
-- | 'SetProtocolParameters' has one option to read from a file and
122122
-- another to pass directly and just sets a state variable for
123123
-- the @protoParams@ field of 'Cardano.Benchmarking.Script.Env.Env'.

0 commit comments

Comments
 (0)