diff --git a/cardano-tx-generator/cardano-tx-generator.cabal b/cardano-tx-generator/cardano-tx-generator.cabal index e416a5d7..f0ba65a0 100644 --- a/cardano-tx-generator/cardano-tx-generator.cabal +++ b/cardano-tx-generator/cardano-tx-generator.cabal @@ -26,7 +26,7 @@ library Cardano.Benchmarking.GeneratorTx.Benchmark Cardano.Benchmarking.GeneratorTx.Error Cardano.Benchmarking.GeneratorTx.Era - Cardano.Benchmarking.GeneratorTx.Callback + Cardano.Benchmarking.GeneratorTx.LocalProtocolDefinition Cardano.Benchmarking.GeneratorTx.Genesis Cardano.Benchmarking.GeneratorTx.NodeToNode Cardano.Benchmarking.GeneratorTx.Tx diff --git a/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/Callback.hs b/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/LocalProtocolDefinition.hs similarity index 87% rename from cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/Callback.hs rename to cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/LocalProtocolDefinition.hs index 512e07f3..a76ce152 100644 --- a/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/Callback.hs +++ b/cardano-tx-generator/src/Cardano/Benchmarking/GeneratorTx/LocalProtocolDefinition.hs @@ -2,9 +2,9 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} -module Cardano.Benchmarking.GeneratorTx.Callback +module Cardano.Benchmarking.GeneratorTx.LocalProtocolDefinition ( - mkCallback + mangleLocalProtocolDefinition ) where import Prelude (error) @@ -42,9 +42,9 @@ type Funding era = Benchmark -> GeneratorFunds -> ExceptT TxGenError IO (Signing type BenchmarkAction era = Benchmark -> (SigningKey PaymentKey, [(TxIn, TxOut era)]) -> ExceptT TxGenError IO () -type Action era = Benchmark -> GeneratorFunds -> ExceptT TxGenError IO () +type Action era = Proxy era -> Benchmark -> GeneratorFunds -> ExceptT TxGenError IO () -mkCallback +mangleLocalProtocolDefinition :: forall blok ptcl era. ( IsShelleyBasedEra era @@ -56,17 +56,15 @@ mkCallback -> IOManager -> SocketPath -> BenchTracers IO CardanoBlock - -> Proxy era -> Action era - -mkCallback ptcl@(Consensus.ProtocolCardano +mangleLocalProtocolDefinition ptcl@(Consensus.ProtocolCardano _ Consensus.ProtocolParamsShelleyBased{Consensus.shelleyBasedGenesis} _ _ _ _ _ _) - nmagic_opt is_addr_mn iom (SocketPath sock) tracers _proxy + nmagic_opt is_addr_mn iom (SocketPath sock) tracers = action where - action benchmark fundOptions + action _proxy benchmark fundOptions = funding benchmark fundOptions >>= benchmarkAction benchmark ProtocolInfo{pInfoConfig} = Consensus.protocolInfo ptcl @@ -97,4 +95,4 @@ mkCallback ptcl@(Consensus.ProtocolCardano then Mainnet else Testnet $ getNetworkMagic $ configBlock pInfoConfig -mkCallback _ _ _ _ _ _ _ = error "mkCallbacks" +mangleLocalProtocolDefinition _ _ _ _ _ _ = error "mkCallbacks" diff --git a/cardano-tx-generator/src/Cardano/Benchmarking/Run.hs b/cardano-tx-generator/src/Cardano/Benchmarking/Run.hs index ae581840..84b5d38e 100644 --- a/cardano-tx-generator/src/Cardano/Benchmarking/Run.hs +++ b/cardano-tx-generator/src/Cardano/Benchmarking/Run.hs @@ -45,7 +45,7 @@ import Cardano.Benchmarking.GeneratorTx.Benchmark import Cardano.Benchmarking.GeneratorTx.Genesis import Cardano.Benchmarking.GeneratorTx.CLI.Parsers import Cardano.Benchmarking.GeneratorTx.Era -import Cardano.Benchmarking.GeneratorTx.Callback +import Cardano.Benchmarking.GeneratorTx.LocalProtocolDefinition data ProtocolError = IncorrectProtocolSpecified !Api.Protocol @@ -157,7 +157,7 @@ runCommand (GenerateTxs logConfigFp myTracer msg = traceWith (btTxSubmit_ tracers) $ TraceBenchTxSubDebug msg runAll :: forall era. IsShelleyBasedEra era => Proxy era -> Benchmark -> GeneratorFunds -> ExceptT TxGenError IO () - runAll = mkCallback ptcl nmagic_opt is_addr_mn iocp socketFp tracers + runAll = mangleLocalProtocolDefinition ptcl nmagic_opt is_addr_mn iocp socketFp tracers firstExceptT GenesisBenchmarkRunnerError $ case benchmarkEra of AnyCardanoEra ByronEra -> error "ByronEra not supported" AnyCardanoEra ShelleyEra -> do