Pass `Constants` as a parameter to `Presets.getEnv`
for more flexibility in Generators
for more flexibility in Generators
import Cardano.Ledger.Shelley.Core (EraTallyState (..))
import qualified Data.Map.Strict as Map
import Test.Cardano.Ledger.Shelley.Generator.Constants (defaultConstants)
import Test.Cardano.Ledger.Shelley.Generator.EraGen (EraGen, MinLEDGER_STS)
import Test.Cardano.Ledger.Shelley.Generator.Presets (genEnv)
import Test.Cardano.Ledger.Shelley.Rules.Chain (ChainState (..))
Int ->
IO (ValidateInput era)
genValidateInput n = do
let ge = genEnv (Proxy :: Proxy era)
let ge = genEnv (Proxy :: Proxy era) defaultConstants
chainstate <- genChainState n ge
block <- genBlock ge chainstate
pure (ValidateInput testGlobals (chainNes chainstate) block)
Int ->
IO (UpdateInputs (EraCrypto era))
genUpdateInputs utxoSize = do
let ge = genEnv (Proxy :: Proxy era)
let ge = genEnv (Proxy :: Proxy era) defaultConstants
chainstate <- genChainState utxoSize ge
(Block blockheader _) <- genBlock ge chainstate
let ledgerview = currentLedgerView (chainNes chainstate)
maxMinFeeA,
minGenesisUTxOouts
),
defaultConstants,
)
import Test.Cardano.Ledger.Shelley.Generator.Core (GenEnv (..), ScriptSpace (..))
import Test.Cardano.Ledger.Shelley.Generator.EraGen (EraGen, MinLEDGER_STS)
Int ->
IO (GenEnv era, ChainState era, GenEnv era -> IO (ShelleyTx era))
genTriple proxy n = do
let ge = genEnv proxy
let ge = genEnv proxy defaultConstants
cs <- genChainState n ge
let fun genenv = generate $ genTx genenv ledgerEnv (esLState (nesEs (chainNes cs)))
pure (ge, cs, fun)
import Test.Cardano.Ledger.Shelley.BenchmarkFunctions (B, B_Crypto)
import Test.Cardano.Ledger.Shelley.Generator.Block (genBlockWithTxGen)
import Test.Cardano.Ledger.Shelley.Generator.Constants (
defaultConstants,
maxGenesisUTxOouts,
minGenesisUTxOouts,
)
where
err :: Show a => a -> b
err msg = error $ "Panic! applyBlk failed: " <> (show msg)
ge = genEnv (Proxy @B)
ge = genEnv (Proxy @B) defaultConstants
-- Small UTxO set; we just want enough to stake to pools
cs =
(geConstants ge)
forall era.
(EraGen era) =>
Proxy era ->
Constants ->
GenEnv era
genEnv _ =
genEnv _ constants =
GenEnv
(keySpace defaultConstants)
(keySpace constants)
(scriptSpace @era (genEraTwoPhase3Arg @era) (genEraTwoPhase2Arg @era))
defaultConstants
constants
-- | An Example Script space for use in Trace generators
scriptSpace ::
import Data.Sequence.Strict (StrictSeq)
import Lens.Micro
import Lens.Micro.Extras (view)
import Test.Cardano.Ledger.Shelley.Generator.Constants (defaultConstants)
import Test.Cardano.Ledger.Shelley.Generator.Core (GenEnv)
import Test.Cardano.Ledger.Shelley.Generator.EraGen (EraGen)
import Test.Cardano.Ledger.Shelley.Generator.Presets (genEnv)
let tl = 100
checkCoverage $
forAllBlind
(traceFromInitState @(CHAIN era) testGlobals tl (genEnv p) genesisChainSt)
(traceFromInitState @(CHAIN era) testGlobals tl (genEnv p defaultConstants) genesisChainSt)
relevantCasesAreCoveredForTrace
where
p :: Proxy era
p = Proxy
genesisChainSt = Just $ mkGenesisChainState (genEnv p)
genesisChainSt = Just $ mkGenesisChainState (genEnv p defaultConstants)
relevantCasesAreCoveredForTrace ::
forall era.
where
p :: Proxy era
p = Proxy
ge = genEnv p
ge = genEnv p defaultConstants
genesisLedgerSt = Just $ mkGenesisLedgerState ge
-- | Check that the abstract transaction size function
forAllTraceFromInitState @(ShelleyLEDGER era)
testGlobals
tl
(genEnv p)
(genEnv p defaultConstants)
genesisLedgerSt
$ \tr -> do
let txs :: [Tx era]
where
p :: Proxy era
p = Proxy
genesisLedgerSt = Just $ mkGenesisLedgerState (genEnv p)
genesisLedgerSt = Just $ mkGenesisLedgerState (genEnv p defaultConstants)
-- | Check that the abstract transaction size function
-- is not off by an acceptable order of magnitude.
forAllTraceFromInitState @(ShelleyLEDGER era)
testGlobals
tl
(genEnv p)
(genEnv p defaultConstants)
genesisLedgerSt
$ \tr -> do
let txs :: [Tx era]
where
p :: Proxy era
p = Proxy
genesisLedgerSt = Just $ mkGenesisLedgerState (genEnv p)
genesisLedgerSt = Just $ mkGenesisLedgerState (genEnv p defaultConstants)
onlyValidChainSignalsAreGenerated ::
forall era.
onlyValidSignalsAreGeneratedFromInitState @(CHAIN era)
testGlobals
100
(genEnv p)
(genEnv p defaultConstants)
genesisChainSt
where
p :: Proxy era
p = Proxy
genesisChainSt = Just $ mkGenesisChainState (genEnv p)
genesisChainSt = Just $ mkGenesisChainState (genEnv p defaultConstants)
-- | Counts the epochs spanned by this trace
epochsInTrace :: forall era. Era era => [Block (BHeader (EraCrypto era)) era] -> Int
forAllTraceFromInitState
testGlobals
n
(Preset.genEnv p)
(Just $ mkGenesisChainState (Preset.genEnv p))
(Preset.genEnv p defaultConstants)
(Just $ mkGenesisChainState (Preset.genEnv p defaultConstants))
prop
where
p :: Proxy era
import Data.Proxy (Proxy)
import GHC.Generics (Generic)
import Test.Cardano.Ledger.AllegraEraGen ()
import Test.Cardano.Ledger.Shelley.Generator.Constants (defaultConstants)
import Test.Cardano.Ledger.Shelley.Generator.Core (GenEnv (..))
import Test.Cardano.Ledger.Shelley.Generator.EraGen (EraGen)
import Test.Cardano.Ledger.Shelley.Generator.Presets (genEnv)
Int ->
ApplyTxEnv era
generateApplyTxEnvForEra eraProxy seed =
let ge = genEnv eraProxy
let ge = genEnv eraProxy defaultConstants
qcSeed = mkQCGen seed
traceGen =
traceFromInitState
3815: Cleanup nix setup: remove unused cabal shell r=Unisay a=Unisay ### Overview This pull request cleans up our `flake.nix` configuration by * removing the unused `cabal-shell.nix` * making explicit which shell is created when doing `nix develop` (it's `ā¦.devShells.default`). ### Issue Number ADP-2447 Co-authored-by: Yura Lazarev <[email protected]>
fix CI not running on bors branches
5023: fix CI not running on bors branches r=disassembler a=dermetfan Looks like this was broken in #4930 as `prAndBorsIo` was added but not used. Also removed `nix` from the task name. I do not see what purpose it has and it makes the names unnecessarily long. Also we happen to need the old names in #5018. Co-authored-by: Robin Stumm <[email protected]>
I don't trust it. Compare these two runs: 1. https://github.com/input-output-hk/cardano-haskell-packages/actions/runs/4532746158/jobs/7984714895 2. https://github.com/input-output-hk/cardano-haskell-packages/actions/runs/4516172089/jobs/7954255360 The second is on the parent commit of the first, the commit itself is a no-op, and yet the derivations they build are not the same! Doing the same locally, I get a) a different derivation, but b) the same derivation for both. I conclude that what the CI is doing is questionable, the cache seems like the most likely source of pollution. I suspect whatever is causing this was also responsible for the no-op PR spending a lot of time building tons of stuff.
* Update readme (cli flags, comment dsl, new format) * Document the comment DSL * Document CLI flags * Mention new split rust/wasm output structure * Remove unsupported section (to handle in issues instead as this tends to get very outdated) * respond to comments + add supported.cddl * minor fixes for comment placement in supported.cddl + remove unsupported optional fixed value from example
There's an issue with the `deriving via` clause for OneEraHeader: * `show`ing a `NS Header (CardanoEras StandardCrypto BatchCompatibleCrypto)` works fine * `show`ing a `OneEraHeader (CardanoEras ...)` yields the annoying error message about not being able to handle 2 different cryptos Using forAllBlind in the property removes the QC requirement to be able to `Show` the generated values which makes it work.
Co-authored-by: Sebastien Guillemot <[email protected]>
5018: Use ouroboros-network-0.3.0.2 and ouroboros-network-framework-0.2.0.1 r=dermetfan a=coot Co-authored-by: Marcin Szamotulski <[email protected]> Co-authored-by: Samuel Leathers <[email protected]>