Skip to content

Commit

Permalink
CAD-2335 updates for PR-reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcFontaine committed Jan 21, 2021
1 parent d0eaa3d commit 46060d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cardano-tx-generator/cardano-tx-generator.cabal
Expand Up @@ -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
Expand Down
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -97,4 +95,4 @@ mkCallback ptcl@(Consensus.ProtocolCardano
then Mainnet
else Testnet $ getNetworkMagic $ configBlock pInfoConfig

mkCallback _ _ _ _ _ _ _ = error "mkCallbacks"
mangleLocalProtocolDefinition _ _ _ _ _ _ = error "mkCallbacks"
4 changes: 2 additions & 2 deletions cardano-tx-generator/src/Cardano/Benchmarking/Run.hs
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 46060d2

Please sign in to comment.