{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeApplications #-}

module Test.Cardano.Ledger.Shelley.Constants (
  Constants (..),
  defaultConstants,
)
where

import Cardano.Ledger.Coin (Coin (..))
import Data.Word (Word64)

data Constants = Constants
  { Constants -> Int
minNumGenInputs :: Int
  -- ^ minimal number of transaction inputs to select
  , Constants -> Int
maxNumGenInputs :: Int
  -- ^ maximal number of transaction inputs to select
  , Constants -> Int
frequencyRegCert :: Int
  -- ^ Relative frequency of generated credential registration certificates
  , Constants -> Int
frequencyRegPoolCert :: Int
  -- ^ Relative frequency of generated pool registration certificates
  , Constants -> Int
frequencyDelegCert :: Int
  -- ^ Relative frequency of generated delegation certificates
  , Constants -> Int
frequencyGenesisDelegationCert :: Int
  -- ^ Relative frequency of generated genesis delegation certificates
  , Constants -> Int
frequencyDeRegKeyCert :: Int
  -- ^ Relative frequency of generated credential de-registration certificates
  , Constants -> Int
frequencyRetirePoolCert :: Int
  -- ^ Relative frequency of generated pool retirement certificates
  , Constants -> Int
frequencyMIRCert :: Int
  -- ^ Relative frequency of generated MIR certificates
  , Constants -> Int
frequencyScriptCredReg :: Int
  -- ^ Relative frequency of script credentials in credential registration
  -- certificates
  , Constants -> Int
frequencyKeyCredReg :: Int
  -- ^ Relative frequency of key credentials in credential registration
  -- certificates
  , Constants -> Int
frequencyScriptCredDeReg :: Int
  -- ^ Relative frequency of script credentials in credential de-registration
  -- certificates
  , Constants -> Int
frequencyKeyCredDeReg :: Int
  -- ^ Relative frequency of key credentials in credential de-registration
  -- certificates
  , Constants -> Int
frequencyScriptCredDelegation :: Int
  -- ^ Relative frequency of script credentials in credential delegation
  -- certificates
  , Constants -> Int
frequencyKeyCredDelegation :: Int
  -- ^ Relative frequency of key credentials in credential delegation
  -- certificates
  , Constants -> Int
frequencyTxUpdates :: Int
  -- ^ Relative frequency of Prototol/Application Updates in a transaction
  , Constants -> Int
frequencyTxWithMetadata :: Int
  -- ^ Relative frequency of Metadata in a transaction
  , Constants -> Int
minGenesisUTxOouts :: Int
  -- ^ minimal number of genesis UTxO outputs
  , Constants -> Int
maxGenesisUTxOouts :: Int
  -- ^ maximal number of genesis UTxO outputs
  , Constants -> Integer
minGenesisOutputVal :: Integer
  -- ^ minimal coin value for generated genesis outputs
  , Constants -> Integer
maxGenesisOutputVal :: Integer
  -- ^ maximal coin value for generated genesis outputs
  , Constants -> Word64
maxCertsPerTx :: Word64
  -- ^ maximal number of certificates per transaction
  , Constants -> Word64
maxTxsPerBlock :: Word64
  -- ^ maximal number of Txs per block
  , Constants -> Word64
numKeyPairs :: Word64
  -- ^ Number of generated keypairs
  , Constants -> Int
numBaseScripts :: Int
  -- ^ Number of base scripts from which multi sig scripts are built.
  , Constants -> Int
numSimpleScripts :: Int
  -- ^ Number of simple scripts which appear in the choices, the remainder are compound (MofN, All, Any, etc.) scripts
  , Constants -> Int
frequencyNoWithdrawals :: Int
  -- ^ Relative frequency that a transaction does not include any reward withdrawals
  , Constants -> Int
frequencyAFewWithdrawals :: Int
  -- ^ Relative frequency that a transaction includes a small number of
  -- reward withdrawals, bounded by 'maxAFewWithdrawals'.
  , Constants -> Int
maxAFewWithdrawals :: Int
  -- ^ Maximum number of reward withdrawals that counts as a small number.
  , Constants -> Int
frequencyPotentiallyManyWithdrawals :: Int
  -- ^ Relative frequency that a transaction includes any positive number of
  -- reward withdrawals
  , Constants -> Int
minSlotTrace :: Int
  -- ^ Minimal slot for CHAIN trace generation.
  , Constants -> Int
maxSlotTrace :: Int
  -- ^ Maximal slot for CHAIN trace generation.
  , Constants -> Word64
frequencyLowMaxEpoch :: Word64
  -- ^ Lower bound of the MaxEpoch protocol parameter
  , Constants -> Coin
maxMinFeeA :: Coin
  , Constants -> Coin
maxMinFeeB :: Coin
  , Constants -> Word64
numCoreNodes :: Word64
  , Constants -> Integer
minTreasury :: Integer
  , Constants -> Integer
maxTreasury :: Integer
  , Constants -> Integer
minReserves :: Integer
  , Constants -> Integer
maxReserves :: Integer
  , Constants -> Int
genTxStableUtxoSize :: Int
  -- ^ When generating Tx, we want the UTxO size to fluctuate around this point. If
  --   it gets too small, we can't balance the fee, too large it gets too complicated.
  , Constants -> Int
genTxUtxoIncrement :: Int
  -- ^ If we need to grow the Utxo when generating a Tx, how much should it grow by.
  }
  deriving (Int -> Constants -> ShowS
[Constants] -> ShowS
Constants -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Constants] -> ShowS
$cshowList :: [Constants] -> ShowS
show :: Constants -> String
$cshow :: Constants -> String
showsPrec :: Int -> Constants -> ShowS
$cshowsPrec :: Int -> Constants -> ShowS
Show)

defaultConstants :: Constants
defaultConstants :: Constants
defaultConstants =
  Constants
    { minNumGenInputs :: Int
minNumGenInputs = Int
1
    , maxNumGenInputs :: Int
maxNumGenInputs = Int
5
    , frequencyRegCert :: Int
frequencyRegCert = Int
2
    , frequencyRegPoolCert :: Int
frequencyRegPoolCert = Int
2
    , frequencyDelegCert :: Int
frequencyDelegCert = Int
3
    , frequencyGenesisDelegationCert :: Int
frequencyGenesisDelegationCert = Int
1
    , frequencyDeRegKeyCert :: Int
frequencyDeRegKeyCert = Int
1
    , frequencyRetirePoolCert :: Int
frequencyRetirePoolCert = Int
1
    , frequencyMIRCert :: Int
frequencyMIRCert = Int
1
    , frequencyScriptCredReg :: Int
frequencyScriptCredReg = Int
1
    , frequencyKeyCredReg :: Int
frequencyKeyCredReg = Int
2
    , frequencyScriptCredDeReg :: Int
frequencyScriptCredDeReg = Int
1
    , frequencyKeyCredDeReg :: Int
frequencyKeyCredDeReg = Int
2
    , frequencyScriptCredDelegation :: Int
frequencyScriptCredDelegation = Int
1
    , frequencyKeyCredDelegation :: Int
frequencyKeyCredDelegation = Int
2
    , frequencyTxUpdates :: Int
frequencyTxUpdates = Int
10
    , frequencyTxWithMetadata :: Int
frequencyTxWithMetadata = Int
10
    , minGenesisUTxOouts :: Int
minGenesisUTxOouts = Int
100
    , maxGenesisUTxOouts :: Int
maxGenesisUTxOouts = Int
150
    , minGenesisOutputVal :: Integer
minGenesisOutputVal = Integer
1000000
    , maxGenesisOutputVal :: Integer
maxGenesisOutputVal = Integer
100000000
    , maxCertsPerTx :: Word64
maxCertsPerTx = Word64
3
    , maxTxsPerBlock :: Word64
maxTxsPerBlock = Word64
10
    , numKeyPairs :: Word64
numKeyPairs = Word64
200 -- Must be >= maxGenesisUTxOouts
    , numBaseScripts :: Int
numBaseScripts = Int
3
    , numSimpleScripts :: Int
numSimpleScripts = Int
20
    , frequencyNoWithdrawals :: Int
frequencyNoWithdrawals = Int
75
    , frequencyAFewWithdrawals :: Int
frequencyAFewWithdrawals = Int
20
    , maxAFewWithdrawals :: Int
maxAFewWithdrawals = Int
10
    , frequencyPotentiallyManyWithdrawals :: Int
frequencyPotentiallyManyWithdrawals = Int
5
    , minSlotTrace :: Int
minSlotTrace = Int
1000
    , maxSlotTrace :: Int
maxSlotTrace = Int
5000
    , frequencyLowMaxEpoch :: Word64
frequencyLowMaxEpoch = Word64
200
    , maxMinFeeA :: Coin
maxMinFeeA = Integer -> Coin
Coin Integer
100
    , maxMinFeeB :: Coin
maxMinFeeB = Integer -> Coin
Coin Integer
2
    , numCoreNodes :: Word64
numCoreNodes = Word64
7
    , minTreasury :: Integer
minTreasury = Integer
1000000
    , maxTreasury :: Integer
maxTreasury = Integer
10000000
    , minReserves :: Integer
minReserves = Integer
1000000
    , maxReserves :: Integer
maxReserves = Integer
10000000
    , genTxStableUtxoSize :: Int
genTxStableUtxoSize = Int
125 -- Needs to be between minGenesisUTxOouts and maxGenesisUTxOouts
    , genTxUtxoIncrement :: Int
genTxUtxoIncrement = Int
3
    }