hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Ledger.CardanoSpec

Synopsis

Documentation

spec :: Spec Source #

shouldParseJSONAs :: forall a. (HasCallStack, FromJSON a) => LByteString -> Expectation Source #

roundtripPParams :: PParams LedgerEra -> Property Source #

Test that the PParams To/FromJSON instances to roundtrip.

rejectsReusedOutputName :: Property Source #

On layer 1 an output's name derives from the transaction producing it, so it can never be in the set already. In a head it can: a deposit names its outputs in its datum, and a depositor can pick the name an upcoming transaction will produce. cardano-ledger accepts such a transaction, and the TxIn-keyed bookkeeping would then keep one of the two outputs and drop the other. The ledger must reject it instead.

rejectsUnwitnessedTransaction :: Property Source #

A transaction submitted to a head without its signature is rejected by the ledger, and the reason names the missing witness. The node passes that reason through verbatim in the TxInvalid output, so clients match on this string.

propRealisticValue :: Value -> Property Source #

A transaction or transaction output can usually only contain a realistic number of native asset entries. This property checks a realistic order of magnitude (100).

propHasEnoughLovelace :: TxOut CtxUTxO -> Property Source #

Check that an output has enough lovelace to cover asset deposits.

propGeneratesGoodTxOut :: TxOut CtxUTxO -> Property Source #

Check that the given TxOut fulfills several requirements and does not use unsupported features. See genTxOut for rationale.

utxoIsThunkFree :: UTxO -> Property Source #

multiEraHistory :: EraHistory Source #

A realistic multi-era EraHistory mimicking mainnet/testnet where: - Byron era: 21600 slotsepoch, 20sslot, runs for 208 epochs (4,492,800 slots) - Shelley+ era: 432000 slotsepoch, 1sslot, open-ended

This causes slot-to-time conversions to differ from a simple fixedEpochInfo because Byron slots are 20x longer than Shelley slots.

genNonCanonicalHashableScriptData :: Gen HashableScriptData Source #

Generate HashableScriptData whose CBOR uses a definite-length array for constructor fields instead of the Plutus-canonical indefinite-length form. Both encodings are valid on L1, but cardano-api's FromJSON re-canonicalises, producing a different hash — the root cause of the replay crash-loop.