Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type ImpTestM era = ImpM (LedgerSpec era)
- type BaseImpM a = Expectation
- data LedgerSpec era
- data SomeSTSEvent era = ∀ (rule ∷ Symbol).(Typeable (Event (EraRule rule era)), Eq (Event (EraRule rule era)), ToExpr (Event (EraRule rule era))) ⇒ SomeSTSEvent (Event (EraRule rule era))
- data ImpTestState era
- data ImpTestEnv era = ImpTestEnv {
- iteFixup ∷ Tx era → ImpTestM era (Tx era)
- iteExpectLedgerRuleConformance ∷ Globals → Either (NonEmpty (PredicateFailure (EraRule "LEDGER" era))) (State (EraRule "LEDGER" era), [Event (EraRule "LEDGER" era)]) → LedgerEnv era → LedgerState era → Tx era → BaseImpM ()
- iteCborRoundTripFailures ∷ !Bool
- data ImpException = ImpException {}
- class (EraGov era, EraUTxO era, EraTxOut era, EraPParams era, ShelleyEraTxCert era, ShelleyEraScript era, ToExpr (Tx era), NFData (Tx era), ToExpr (TxBody era), ToExpr (TxOut era), ToExpr (Value era), ToExpr (PParams era), ToExpr (PParamsHKD Identity era), ToExpr (PParamsHKD StrictMaybe era), Show (NewEpochState era), ToExpr (NewEpochState era), ToExpr (GovState era), Eq (StashedAVVMAddresses era), Show (StashedAVVMAddresses era), ToExpr (StashedAVVMAddresses era), NFData (StashedAVVMAddresses era), Default (StashedAVVMAddresses era), STS (EraRule "BBODY" era), BaseM (EraRule "BBODY" era) ~ ShelleyBase, Environment (EraRule "BBODY" era) ~ BbodyEnv era, State (EraRule "BBODY" era) ~ ShelleyBbodyState era, Signal (EraRule "BBODY" era) ~ Block BHeaderView era, State (EraRule "LEDGERS" era) ~ LedgerState era, STS (EraRule "LEDGER" era), BaseM (EraRule "LEDGER" era) ~ ShelleyBase, Signal (EraRule "LEDGER" era) ~ Tx era, State (EraRule "LEDGER" era) ~ LedgerState era, Environment (EraRule "LEDGER" era) ~ LedgerEnv era, Eq (PredicateFailure (EraRule "LEDGER" era)), Show (PredicateFailure (EraRule "LEDGER" era)), ToExpr (PredicateFailure (EraRule "LEDGER" era)), NFData (PredicateFailure (EraRule "LEDGER" era)), EncCBOR (PredicateFailure (EraRule "LEDGER" era)), DecCBOR (PredicateFailure (EraRule "LEDGER" era)), EraRuleEvent "LEDGER" era ~ Event (EraRule "LEDGER" era), Eq (EraRuleEvent "LEDGER" era), ToExpr (EraRuleEvent "LEDGER" era), NFData (EraRuleEvent "LEDGER" era), Typeable (EraRuleEvent "LEDGER" era), STS (EraRule "TICK" era), BaseM (EraRule "TICK" era) ~ ShelleyBase, Signal (EraRule "TICK" era) ~ SlotNo, State (EraRule "TICK" era) ~ NewEpochState era, Environment (EraRule "TICK" era) ~ (), NFData (PredicateFailure (EraRule "TICK" era)), EraRuleEvent "TICK" era ~ Event (EraRule "TICK" era), Eq (EraRuleEvent "TICK" era), ToExpr (EraRuleEvent "TICK" era), NFData (EraRuleEvent "TICK" era), Typeable (EraRuleEvent "TICK" era), ToExpr (PredicateFailure (EraRule "UTXOW" era))) ⇒ ShelleyEraImp era where
- initGenesis ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (Genesis era)
- initNewEpochState ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (NewEpochState era)
- initImpTestState ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (ImpTestState era)
- impSatisfyNativeScript ∷ Set (KeyHash 'Witness) → TxBody era → NativeScript era → ImpTestM era (Maybe (Map (KeyHash 'Witness) (KeyPair 'Witness)))
- modifyPParams ∷ (PParams era → PParams era) → ImpTestM era ()
- fixupTx ∷ HasCallStack ⇒ Tx era → ImpTestM era (Tx era)
- data PlutusArgs
- data ScriptTestContext
- impWitsVKeyNeeded ∷ EraUTxO era ⇒ TxBody era → ImpTestM era (Set BootstrapAddress, Set (KeyHash 'Witness))
- modifyPrevPParams ∷ EraGov era ⇒ (PParams era → PParams era) → ImpTestM era ()
- passEpoch ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ ImpTestM era ()
- passNEpochs ∷ ∀ era. ShelleyEraImp era ⇒ Natural → ImpTestM era ()
- passNEpochsChecking ∷ ∀ era. ShelleyEraImp era ⇒ Natural → ImpTestM era () → ImpTestM era ()
- passTick ∷ ∀ era. (HasCallStack, ShelleyEraImp era) ⇒ ImpTestM era ()
- freshKeyAddr ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m (KeyHash r, Addr)
- freshKeyAddr_ ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m Addr
- freshKeyHash ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m (KeyHash r)
- freshKeyPair ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m (KeyHash r, KeyPair r)
- lookupKeyPair ∷ (HasCallStack, HasKeyPairs s, MonadState s m) ⇒ KeyHash r → m (KeyPair r)
- freshByronKeyHash ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m (KeyHash r)
- freshBootstapAddress ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m BootstrapAddress
- lookupByronKeyPair ∷ (HasCallStack, HasKeyPairs s, MonadState s m) ⇒ BootstrapAddress → m ByronKeyPair
- freshSafeHash ∷ ImpTestM era (SafeHash a)
- freshKeyHashVRF ∷ ImpTestM era (VRFVerKeyHash (r ∷ KeyRoleVRF))
- submitTx ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era (Tx era)
- submitTx_ ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era ()
- submitTxAnn ∷ (HasCallStack, ShelleyEraImp era) ⇒ String → Tx era → ImpTestM era (Tx era)
- submitTxAnn_ ∷ (HasCallStack, ShelleyEraImp era) ⇒ String → Tx era → ImpTestM era ()
- submitFailingTx ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → NonEmpty (PredicateFailure (EraRule "LEDGER" era)) → ImpTestM era ()
- submitFailingTxM ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → (Tx era → ImpTestM era (NonEmpty (PredicateFailure (EraRule "LEDGER" era)))) → ImpTestM era ()
- trySubmitTx ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Either (NonEmpty (PredicateFailure (EraRule "LEDGER" era)), Tx era) (Tx era))
- modifyNES ∷ (NewEpochState era → NewEpochState era) → ImpTestM era ()
- getProtVer ∷ EraGov era ⇒ ImpTestM era ProtVer
- getsNES ∷ SimpleGetter (NewEpochState era) a → ImpTestM era a
- getUTxO ∷ ImpTestM era (UTxO era)
- impAddNativeScript ∷ ∀ era. EraScript era ⇒ NativeScript era → ImpTestM era ScriptHash
- impAnn ∷ NFData a ⇒ String → ImpM t a → ImpM t a
- impAnnDoc ∷ NFData a ⇒ Doc AnsiStyle → ImpM t a → ImpM t a
- impLogToExpr ∷ (HasCallStack, ToExpr a) ⇒ ImpTestM era a → ImpTestM era a
- runImpRule ∷ ∀ rule era. (HasCallStack, KnownSymbol rule, STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase, NFData (State (EraRule rule era)), NFData (Event (EraRule rule era)), ToExpr (Event (EraRule rule era)), Eq (Event (EraRule rule era)), Typeable (Event (EraRule rule era))) ⇒ Environment (EraRule rule era) → State (EraRule rule era) → Signal (EraRule rule era) → ImpTestM era (State (EraRule rule era))
- tryRunImpRule ∷ ∀ rule era. (STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase) ⇒ Environment (EraRule rule era) → State (EraRule rule era) → Signal (EraRule rule era) → ImpTestM era (Either (NonEmpty (PredicateFailure (EraRule rule era))) (State (EraRule rule era), [Event (EraRule rule era)]))
- tryRunImpRuleNoAssertions ∷ ∀ rule era. (STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase) ⇒ Environment (EraRule rule era) → State (EraRule rule era) → Signal (EraRule rule era) → ImpTestM era (Either (NonEmpty (PredicateFailure (EraRule rule era))) (State (EraRule rule era), [Event (EraRule rule era)]))
- delegateStake ∷ ShelleyEraImp era ⇒ Credential 'Staking → KeyHash 'StakePool → ImpTestM era ()
- registerRewardAccount ∷ ∀ era. (HasCallStack, ShelleyEraImp era) ⇒ ImpTestM era RewardAccount
- registerStakeCredential ∷ ∀ era. (HasCallStack, ShelleyEraImp era) ⇒ Credential 'Staking → ImpTestM era RewardAccount
- getRewardAccountFor ∷ Credential 'Staking → ImpTestM era RewardAccount
- tryLookupReward ∷ Credential 'Staking → ImpTestM era (Maybe Coin)
- lookupReward ∷ HasCallStack ⇒ Credential 'Staking → ImpTestM era Coin
- poolParams ∷ ShelleyEraImp era ⇒ KeyHash 'StakePool → RewardAccount → ImpTestM era PoolParams
- registerPool ∷ ShelleyEraImp era ⇒ KeyHash 'StakePool → ImpTestM era ()
- registerPoolWithRewardAccount ∷ ShelleyEraImp era ⇒ KeyHash 'StakePool → RewardAccount → ImpTestM era ()
- registerAndRetirePoolToMakeReward ∷ ShelleyEraImp era ⇒ Credential 'Staking → ImpTestM era ()
- getRewardAccountAmount ∷ RewardAccount → ImpTestM era Coin
- shelleyFixupTx ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Tx era)
- lookupImpRootTxOut ∷ ImpTestM era (TxIn, TxOut era)
- sendValueTo ∷ (ShelleyEraImp era, HasCallStack) ⇒ Addr → Value era → ImpTestM era TxIn
- sendCoinTo ∷ (ShelleyEraImp era, HasCallStack) ⇒ Addr → Coin → ImpTestM era TxIn
- expectUTxOContent ∷ (HasCallStack, ToExpr (TxOut era)) ⇒ UTxO era → [(TxIn, Maybe (TxOut era) → Bool)] → ImpTestM era ()
- expectRegisteredRewardAddress ∷ RewardAccount → ImpTestM era ()
- expectNotRegisteredRewardAddress ∷ RewardAccount → ImpTestM era ()
- expectTreasury ∷ HasCallStack ⇒ Coin → ImpTestM era ()
- disableTreasuryExpansion ∷ ShelleyEraImp era ⇒ ImpTestM era ()
- updateAddrTxWits ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era (Tx era)
- addNativeScriptTxWits ∷ ShelleyEraImp era ⇒ Tx era → ImpTestM era (Tx era)
- addRootTxIn ∷ ShelleyEraImp era ⇒ Tx era → ImpTestM era (Tx era)
- fixupTxOuts ∷ (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Tx era)
- fixupFees ∷ (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Tx era)
- fixupAuxDataHash ∷ (EraTx era, Applicative m) ⇒ Tx era → m (Tx era)
- impGetNativeScript ∷ ScriptHash → ImpTestM era (Maybe (NativeScript era))
- impLookupUTxO ∷ ShelleyEraImp era ⇒ TxIn → ImpTestM era (TxOut era)
- defaultInitNewEpochState ∷ ∀ era g s m. (MonadState s m, HasKeyPairs s, HasStatefulGen g m, MonadFail m, ShelleyEraImp era, ShelleyEraImp (PreviousEra era), TranslateEra era NewEpochState, TranslationError era NewEpochState ~ Void, TranslationContext era ~ Genesis era) ⇒ (NewEpochState (PreviousEra era) → NewEpochState (PreviousEra era)) → m (NewEpochState era)
- defaultInitImpTestState ∷ ∀ era s g m. (EraGov era, EraTxOut era, HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ NewEpochState era → m (ImpTestState era)
- impEraStartEpochNo ∷ ∀ era. Era era ⇒ EpochNo
- impSetSeed ∷ Int → ImpM t ()
- modifyImpInitProtVer ∷ ∀ era. ShelleyEraImp era ⇒ Version → SpecWith (ImpInit (LedgerSpec era)) → SpecWith (ImpInit (LedgerSpec era))
- modifyImpInitExpectLedgerRuleConformance ∷ ∀ era. (Globals → Either (NonEmpty (PredicateFailure (EraRule "LEDGER" era))) (State (EraRule "LEDGER" era), [Event (EraRule "LEDGER" era)]) → LedgerEnv era → LedgerState era → Tx era → BaseImpM ()) → SpecWith (ImpInit (LedgerSpec era)) → SpecWith (ImpInit (LedgerSpec era))
- data Doc ann
- data AnsiStyle
- logDoc ∷ HasCallStack ⇒ Doc AnsiStyle → ImpM t ()
- logText ∷ HasCallStack ⇒ Text → ImpM t ()
- logString ∷ HasCallStack ⇒ String → ImpM t ()
- logToExpr ∷ (HasCallStack, ToExpr a) ⇒ a → ImpM t ()
- logStakeDistr ∷ HasCallStack ⇒ ImpTestM era ()
- logFeeMismatch ∷ (EraGov era, EraUTxO era, HasCallStack) ⇒ Tx era → ImpTestM era ()
- withCustomFixup ∷ ((Tx era → ImpTestM era (Tx era)) → Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a
- withFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a
- withNoFixup ∷ ImpTestM era a → ImpTestM era a
- withPostFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a
- withPreFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a
- withCborRoundTripFailures ∷ ImpTestM era a → ImpTestM era a
- impNESL ∷ Lens' (ImpTestState era) (NewEpochState era)
- impGlobalsL ∷ Lens' (ImpTestState era) Globals
- impLastTickG ∷ SimpleGetter (ImpTestState era) SlotNo
- impKeyPairsG ∷ SimpleGetter (ImpTestState era) (Map (KeyHash 'Witness) (KeyPair 'Witness))
- impNativeScriptsG ∷ SimpleGetter (ImpTestState era) (Map ScriptHash (NativeScript era))
- produceScript ∷ (ShelleyEraImp era, HasCallStack) ⇒ ScriptHash → ImpTestM era TxIn
- advanceToPointOfNoReturn ∷ ImpTestM era ()
- data ImpM t a
- data ImpInit t
Documentation
type ImpTestM era = ImpM (LedgerSpec era) Source #
type BaseImpM a = Expectation Source #
data LedgerSpec era Source #
Instances
ShelleyEraImp era ⇒ ImpSpec (LedgerSpec era) Source # | |
Defined in Test.Cardano.Ledger.Shelley.ImpTest type ImpSpecEnv (LedgerSpec era) = (r ∷ Type) Source # type ImpSpecState (LedgerSpec era) = (r ∷ Type) Source # impInitIO ∷ QCGen → IO (ImpInit (LedgerSpec era)) Source # impPrepAction ∷ ImpM (LedgerSpec era) () Source # | |
MonadWriter [SomeSTSEvent era] (ImpTestM era) Source # | |
Defined in Test.Cardano.Ledger.Shelley.ImpTest writer ∷ (a, [SomeSTSEvent era]) → ImpTestM era a Source # tell ∷ [SomeSTSEvent era] → ImpTestM era () Source # listen ∷ ImpTestM era a → ImpTestM era (a, [SomeSTSEvent era]) Source # pass ∷ ImpTestM era (a, [SomeSTSEvent era] → [SomeSTSEvent era]) → ImpTestM era a Source # | |
type ImpSpecEnv (LedgerSpec era) Source # | |
Defined in Test.Cardano.Ledger.Shelley.ImpTest | |
type ImpSpecState (LedgerSpec era) Source # | |
Defined in Test.Cardano.Ledger.Shelley.ImpTest |
data SomeSTSEvent era Source #
∀ (rule ∷ Symbol).(Typeable (Event (EraRule rule era)), Eq (Event (EraRule rule era)), ToExpr (Event (EraRule rule era))) ⇒ SomeSTSEvent (Event (EraRule rule era)) |
Instances
Eq (SomeSTSEvent era) Source # | |
Defined in Test.Cardano.Ledger.Shelley.ImpTest (==) ∷ SomeSTSEvent era → SomeSTSEvent era → Bool Source # (/=) ∷ SomeSTSEvent era → SomeSTSEvent era → Bool Source # | |
ToExpr (SomeSTSEvent era) Source # | |
Defined in Test.Cardano.Ledger.Shelley.ImpTest toExpr ∷ SomeSTSEvent era → Expr Source # listToExpr ∷ [SomeSTSEvent era] → Expr Source # | |
MonadWriter [SomeSTSEvent era] (ImpTestM era) Source # | |
Defined in Test.Cardano.Ledger.Shelley.ImpTest writer ∷ (a, [SomeSTSEvent era]) → ImpTestM era a Source # tell ∷ [SomeSTSEvent era] → ImpTestM era () Source # listen ∷ ImpTestM era a → ImpTestM era (a, [SomeSTSEvent era]) Source # pass ∷ ImpTestM era (a, [SomeSTSEvent era] → [SomeSTSEvent era]) → ImpTestM era a Source # |
data ImpTestState era Source #
data ImpTestEnv era Source #
ImpTestEnv | |
|
data ImpException Source #
Stores extra information about the failure of the unit test
ImpException | |
|
Instances
Exception ImpException | |
Show ImpException | |
Defined in Test.ImpSpec.Internal |
class (EraGov era, EraUTxO era, EraTxOut era, EraPParams era, ShelleyEraTxCert era, ShelleyEraScript era, ToExpr (Tx era), NFData (Tx era), ToExpr (TxBody era), ToExpr (TxOut era), ToExpr (Value era), ToExpr (PParams era), ToExpr (PParamsHKD Identity era), ToExpr (PParamsHKD StrictMaybe era), Show (NewEpochState era), ToExpr (NewEpochState era), ToExpr (GovState era), Eq (StashedAVVMAddresses era), Show (StashedAVVMAddresses era), ToExpr (StashedAVVMAddresses era), NFData (StashedAVVMAddresses era), Default (StashedAVVMAddresses era), STS (EraRule "BBODY" era), BaseM (EraRule "BBODY" era) ~ ShelleyBase, Environment (EraRule "BBODY" era) ~ BbodyEnv era, State (EraRule "BBODY" era) ~ ShelleyBbodyState era, Signal (EraRule "BBODY" era) ~ Block BHeaderView era, State (EraRule "LEDGERS" era) ~ LedgerState era, STS (EraRule "LEDGER" era), BaseM (EraRule "LEDGER" era) ~ ShelleyBase, Signal (EraRule "LEDGER" era) ~ Tx era, State (EraRule "LEDGER" era) ~ LedgerState era, Environment (EraRule "LEDGER" era) ~ LedgerEnv era, Eq (PredicateFailure (EraRule "LEDGER" era)), Show (PredicateFailure (EraRule "LEDGER" era)), ToExpr (PredicateFailure (EraRule "LEDGER" era)), NFData (PredicateFailure (EraRule "LEDGER" era)), EncCBOR (PredicateFailure (EraRule "LEDGER" era)), DecCBOR (PredicateFailure (EraRule "LEDGER" era)), EraRuleEvent "LEDGER" era ~ Event (EraRule "LEDGER" era), Eq (EraRuleEvent "LEDGER" era), ToExpr (EraRuleEvent "LEDGER" era), NFData (EraRuleEvent "LEDGER" era), Typeable (EraRuleEvent "LEDGER" era), STS (EraRule "TICK" era), BaseM (EraRule "TICK" era) ~ ShelleyBase, Signal (EraRule "TICK" era) ~ SlotNo, State (EraRule "TICK" era) ~ NewEpochState era, Environment (EraRule "TICK" era) ~ (), NFData (PredicateFailure (EraRule "TICK" era)), EraRuleEvent "TICK" era ~ Event (EraRule "TICK" era), Eq (EraRuleEvent "TICK" era), ToExpr (EraRuleEvent "TICK" era), NFData (EraRuleEvent "TICK" era), Typeable (EraRuleEvent "TICK" era), ToExpr (PredicateFailure (EraRule "UTXOW" era))) ⇒ ShelleyEraImp era where Source #
initGenesis ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (Genesis era) Source #
initNewEpochState ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (NewEpochState era) Source #
default initNewEpochState ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m, ShelleyEraImp (PreviousEra era), TranslateEra era NewEpochState, TranslationError era NewEpochState ~ Void, TranslationContext era ~ Genesis era) ⇒ m (NewEpochState era) Source #
initImpTestState ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (ImpTestState era) Source #
impSatisfyNativeScript Source #
∷ Set (KeyHash 'Witness) | Set of Witnesses that have already been satisfied |
→ TxBody era | The transaction body that the script will be applied to |
→ NativeScript era | |
→ ImpTestM era (Maybe (Map (KeyHash 'Witness) (KeyPair 'Witness))) |
Try to find a sufficient number of KeyPairs that would satisfy a native script. Whenever script can't be satisfied, Nothing is returned
modifyPParams ∷ (PParams era → PParams era) → ImpTestM era () Source #
This modifer should change not only the current PParams, but also the future PParams. If the future PParams are not updated, then they will overwrite the mofication of the current PParams at the next epoch.
fixupTx ∷ HasCallStack ⇒ Tx era → ImpTestM era (Tx era) Source #
Instances
ShelleyEraScript ShelleyEra ⇒ ShelleyEraImp ShelleyEra Source # | |
Defined in Test.Cardano.Ledger.Shelley.ImpTest initGenesis ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (Genesis ShelleyEra) Source # initNewEpochState ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (NewEpochState ShelleyEra) Source # initImpTestState ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ m (ImpTestState ShelleyEra) Source # impSatisfyNativeScript ∷ Set (KeyHash 'Witness) → TxBody ShelleyEra → NativeScript ShelleyEra → ImpTestM ShelleyEra (Maybe (Map (KeyHash 'Witness) (KeyPair 'Witness))) Source # modifyPParams ∷ (PParams ShelleyEra → PParams ShelleyEra) → ImpTestM ShelleyEra () Source # fixupTx ∷ Tx ShelleyEra → ImpTestM ShelleyEra (Tx ShelleyEra) Source # |
data PlutusArgs Source #
Instances
Generic PlutusArgs | |
Defined in Test.Cardano.Ledger.Plutus.ScriptTestContext from ∷ PlutusArgs → Rep PlutusArgs x Source # to ∷ Rep PlutusArgs x → PlutusArgs Source # | |
Show PlutusArgs | |
Defined in Test.Cardano.Ledger.Plutus.ScriptTestContext | |
NFData PlutusArgs | |
Defined in Test.Cardano.Ledger.Plutus.ScriptTestContext rnf ∷ PlutusArgs → () Source # | |
type Rep PlutusArgs | |
Defined in Test.Cardano.Ledger.Plutus.ScriptTestContext type Rep PlutusArgs = D1 ('MetaData "PlutusArgs" "Test.Cardano.Ledger.Plutus.ScriptTestContext" "cardano-ledger-core-1.17.0.0-inplace-testlib" 'False) (C1 ('MetaCons "PlutusArgs" 'PrefixI 'True) (S1 ('MetaSel ('Just "paData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Data) :*: S1 ('MetaSel ('Just "paSpendDatum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Data)))) |
data ScriptTestContext Source #
Instances
impWitsVKeyNeeded ∷ EraUTxO era ⇒ TxBody era → ImpTestM era (Set BootstrapAddress, Set (KeyHash 'Witness)) Source #
Figure out all the Byron Addresses that need witnesses as well as all of the KeyHashes for Shelley Key witnesses that are required.
modifyPrevPParams ∷ EraGov era ⇒ (PParams era → PParams era) → ImpTestM era () Source #
Modify the previous PParams in the current state with the given function. For current
and future PParams, use modifyPParams
passEpoch ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ ImpTestM era () Source #
Runs the TICK rule until the next epoch is reached
passNEpochs ∷ ∀ era. ShelleyEraImp era ⇒ Natural → ImpTestM era () Source #
Runs the TICK rule until the n
epochs are passed
passNEpochsChecking ∷ ∀ era. ShelleyEraImp era ⇒ Natural → ImpTestM era () → ImpTestM era () Source #
Runs the TICK rule until the n
epochs are passed, running the checks
each time.
passTick ∷ ∀ era. (HasCallStack, ShelleyEraImp era) ⇒ ImpTestM era () Source #
Runs the TICK rule once
freshKeyAddr ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m (KeyHash r, Addr) Source #
freshKeyAddr_ ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m Addr Source #
freshKeyHash ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m (KeyHash r) Source #
Generates a fresh KeyHash
and stores the corresponding KeyPair
in the
ImpTestState. If you also need the KeyPair
consider using freshKeyPair
for
generation or lookupKeyPair
to look up the KeyPair
corresponding to the KeyHash
freshKeyPair ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m (KeyHash r, KeyPair r) Source #
Generate a random KeyPair
and add it to the known keys in the Imp state
lookupKeyPair ∷ (HasCallStack, HasKeyPairs s, MonadState s m) ⇒ KeyHash r → m (KeyPair r) Source #
Looks up the KeyPair
corresponding to the KeyHash
. The KeyHash
must be
created with freshKeyHash
for this to work.
freshByronKeyHash ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m (KeyHash r) Source #
Generates a fresh KeyHash
and stores the corresponding ByronKeyPair
in the
ImpTestState. If you also need the ByronKeyPair
consider using freshByronKeyPair
for
generation or lookupByronKeyPair
to look up the ByronKeyPair
corresponding to the KeyHash
freshBootstapAddress ∷ (HasKeyPairs s, MonadState s m, HasStatefulGen g m) ⇒ m BootstrapAddress Source #
lookupByronKeyPair ∷ (HasCallStack, HasKeyPairs s, MonadState s m) ⇒ BootstrapAddress → m ByronKeyPair Source #
Looks up the keypair corresponding to the BootstrapAddress
. The BootstrapAddress
must be created with freshBootstrapAddess
for this to work.
freshSafeHash ∷ ImpTestM era (SafeHash a) Source #
Creates a fresh SafeHash
freshKeyHashVRF ∷ ImpTestM era (VRFVerKeyHash (r ∷ KeyRoleVRF)) Source #
submitTx ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era (Tx era) Source #
submitTx_ ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era () Source #
submitTxAnn ∷ (HasCallStack, ShelleyEraImp era) ⇒ String → Tx era → ImpTestM era (Tx era) Source #
submitTxAnn_ ∷ (HasCallStack, ShelleyEraImp era) ⇒ String → Tx era → ImpTestM era () Source #
submitFailingTx ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → NonEmpty (PredicateFailure (EraRule "LEDGER" era)) → ImpTestM era () Source #
Submit a transaction that is expected to be rejected with the given predicate failures. The inputs and outputs are automatically balanced.
submitFailingTxM ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → (Tx era → ImpTestM era (NonEmpty (PredicateFailure (EraRule "LEDGER" era)))) → ImpTestM era () Source #
Submit a transaction that is expected to be rejected, and compute the expected predicate failures from the fixed-up tx using the supplied action. The inputs and outputs are automatically balanced.
trySubmitTx ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Either (NonEmpty (PredicateFailure (EraRule "LEDGER" era)), Tx era) (Tx era)) Source #
modifyNES ∷ (NewEpochState era → NewEpochState era) → ImpTestM era () Source #
Modify the current new epoch state with a function
getsNES ∷ SimpleGetter (NewEpochState era) a → ImpTestM era a Source #
Get a value from the current new epoch state using the lens
impAddNativeScript ∷ ∀ era. EraScript era ⇒ NativeScript era → ImpTestM era ScriptHash Source #
impAnn ∷ NFData a ⇒ String → ImpM t a → ImpM t a Source #
Annotation for when failure happens. All the logging done within annotation will be discarded if there no failures within the annotation.
impLogToExpr ∷ (HasCallStack, ToExpr a) ⇒ ImpTestM era a → ImpTestM era a Source #
Adds the result of an action to the log, which is only shown if the test fails
runImpRule ∷ ∀ rule era. (HasCallStack, KnownSymbol rule, STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase, NFData (State (EraRule rule era)), NFData (Event (EraRule rule era)), ToExpr (Event (EraRule rule era)), Eq (Event (EraRule rule era)), Typeable (Event (EraRule rule era))) ⇒ Environment (EraRule rule era) → State (EraRule rule era) → Signal (EraRule rule era) → ImpTestM era (State (EraRule rule era)) Source #
tryRunImpRule ∷ ∀ rule era. (STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase) ⇒ Environment (EraRule rule era) → State (EraRule rule era) → Signal (EraRule rule era) → ImpTestM era (Either (NonEmpty (PredicateFailure (EraRule rule era))) (State (EraRule rule era), [Event (EraRule rule era)])) Source #
tryRunImpRuleNoAssertions ∷ ∀ rule era. (STS (EraRule rule era), BaseM (EraRule rule era) ~ ShelleyBase) ⇒ Environment (EraRule rule era) → State (EraRule rule era) → Signal (EraRule rule era) → ImpTestM era (Either (NonEmpty (PredicateFailure (EraRule rule era))) (State (EraRule rule era), [Event (EraRule rule era)])) Source #
delegateStake ∷ ShelleyEraImp era ⇒ Credential 'Staking → KeyHash 'StakePool → ImpTestM era () Source #
registerRewardAccount ∷ ∀ era. (HasCallStack, ShelleyEraImp era) ⇒ ImpTestM era RewardAccount Source #
registerStakeCredential ∷ ∀ era. (HasCallStack, ShelleyEraImp era) ⇒ Credential 'Staking → ImpTestM era RewardAccount Source #
tryLookupReward ∷ Credential 'Staking → ImpTestM era (Maybe Coin) Source #
lookupReward ∷ HasCallStack ⇒ Credential 'Staking → ImpTestM era Coin Source #
poolParams ∷ ShelleyEraImp era ⇒ KeyHash 'StakePool → RewardAccount → ImpTestM era PoolParams Source #
registerPool ∷ ShelleyEraImp era ⇒ KeyHash 'StakePool → ImpTestM era () Source #
registerPoolWithRewardAccount ∷ ShelleyEraImp era ⇒ KeyHash 'StakePool → RewardAccount → ImpTestM era () Source #
registerAndRetirePoolToMakeReward ∷ ShelleyEraImp era ⇒ Credential 'Staking → ImpTestM era () Source #
shelleyFixupTx ∷ ∀ era. (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Tx era) Source #
sendValueTo ∷ (ShelleyEraImp era, HasCallStack) ⇒ Addr → Value era → ImpTestM era TxIn Source #
sendCoinTo ∷ (ShelleyEraImp era, HasCallStack) ⇒ Addr → Coin → ImpTestM era TxIn Source #
expectUTxOContent ∷ (HasCallStack, ToExpr (TxOut era)) ⇒ UTxO era → [(TxIn, Maybe (TxOut era) → Bool)] → ImpTestM era () Source #
expectRegisteredRewardAddress ∷ RewardAccount → ImpTestM era () Source #
expectNotRegisteredRewardAddress ∷ RewardAccount → ImpTestM era () Source #
expectTreasury ∷ HasCallStack ⇒ Coin → ImpTestM era () Source #
disableTreasuryExpansion ∷ ShelleyEraImp era ⇒ ImpTestM era () Source #
updateAddrTxWits ∷ (HasCallStack, ShelleyEraImp era) ⇒ Tx era → ImpTestM era (Tx era) Source #
Adds TxWits
that will satisfy all of the required key witnesses
addNativeScriptTxWits ∷ ShelleyEraImp era ⇒ Tx era → ImpTestM era (Tx era) Source #
Modifies transaction by adding necessary scripts
addRootTxIn ∷ ShelleyEraImp era ⇒ Tx era → ImpTestM era (Tx era) Source #
This fixup step ensures that there are enough funds in the transaction.
fixupTxOuts ∷ (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Tx era) Source #
fixupFees ∷ (ShelleyEraImp era, HasCallStack) ⇒ Tx era → ImpTestM era (Tx era) Source #
fixupAuxDataHash ∷ (EraTx era, Applicative m) ⇒ Tx era → m (Tx era) Source #
Adds an auxiliary data hash if auxiliary data present, while the hash of it is not.
impGetNativeScript ∷ ScriptHash → ImpTestM era (Maybe (NativeScript era)) Source #
impLookupUTxO ∷ ShelleyEraImp era ⇒ TxIn → ImpTestM era (TxOut era) Source #
defaultInitNewEpochState ∷ ∀ era g s m. (MonadState s m, HasKeyPairs s, HasStatefulGen g m, MonadFail m, ShelleyEraImp era, ShelleyEraImp (PreviousEra era), TranslateEra era NewEpochState, TranslationError era NewEpochState ~ Void, TranslationContext era ~ Genesis era) ⇒ (NewEpochState (PreviousEra era) → NewEpochState (PreviousEra era)) → m (NewEpochState era) Source #
defaultInitImpTestState ∷ ∀ era s g m. (EraGov era, EraTxOut era, HasKeyPairs s, MonadState s m, HasStatefulGen g m, MonadFail m) ⇒ NewEpochState era → m (ImpTestState era) Source #
impEraStartEpochNo ∷ ∀ era. Era era ⇒ EpochNo Source #
For debugging purposes we start the era at the epoch number that matches the starting protocol version for the era times a 100
impSetSeed ∷ Int → ImpM t () Source #
Override the QuickCheck generator using a fixed seed.
modifyImpInitProtVer ∷ ∀ era. ShelleyEraImp era ⇒ Version → SpecWith (ImpInit (LedgerSpec era)) → SpecWith (ImpInit (LedgerSpec era)) Source #
modifyImpInitExpectLedgerRuleConformance ∷ ∀ era. (Globals → Either (NonEmpty (PredicateFailure (EraRule "LEDGER" era))) (State (EraRule "LEDGER" era), [Event (EraRule "LEDGER" era)]) → LedgerEnv era → LedgerState era → Tx era → BaseImpM ()) → SpecWith (ImpInit (LedgerSpec era)) → SpecWith (ImpInit (LedgerSpec era)) Source #
Logging
The abstract data type
represents pretty documents that have
been annotated with data of type Doc
annann
.
More specifically, a value of type
represents a non-empty set of
possible layouts of a document. The layout functions select one of these
possibilities, taking into account things like the width of the output
document.Doc
The annotation is an arbitrary piece of data associated with (part of) a document. Annotations may be used by the rendering backends in order to display output differently, such as
- color information (e.g. when rendering to the terminal)
- mouseover text (e.g. when rendering to rich HTML)
- whether to show something or not (to allow simple or detailed versions)
The simplest way to display a Doc
is via the Show
class.
>>>
putStrLn (show (vsep ["hello", "world"]))
hello world
Instances
Render the annotated document in a certain style. Styles not set in the annotation will use the style of the surrounding document, or the terminal’s default if none has been set yet.
style =color
Green
<>
bold
styledDoc =annotate
style "hello world"
Instances
Monoid AnsiStyle |
|
Semigroup AnsiStyle | Keep the first decision for each of foreground color, background color, boldness, italication, and underlining. If a certain style is not set, the terminal’s default will be used. Example:
is red because the first color wins, and not bold because (or if) that’s the terminal’s default. |
Show AnsiStyle | |
Eq AnsiStyle | |
Ord AnsiStyle | |
Defined in Prettyprinter.Render.Terminal.Internal |
logDoc ∷ HasCallStack ⇒ Doc AnsiStyle → ImpM t () Source #
Adds a Doc to the log, which is only shown if the test fails
logText ∷ HasCallStack ⇒ Text → ImpM t () Source #
Adds a Text to the log, which is only shown if the test fails
logString ∷ HasCallStack ⇒ String → ImpM t () Source #
Adds a String to the log, which is only shown if the test fails
logToExpr ∷ (HasCallStack, ToExpr a) ⇒ a → ImpM t () Source #
Adds a ToExpr to the log, which is only shown if the test fails
logStakeDistr ∷ HasCallStack ⇒ ImpTestM era () Source #
Logs the current stake distribution
logFeeMismatch ∷ (EraGov era, EraUTxO era, HasCallStack) ⇒ Tx era → ImpTestM era () Source #
Combinators
withCustomFixup ∷ ((Tx era → ImpTestM era (Tx era)) → Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a Source #
Compose given function with the configured fixup
withFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a Source #
Replace all fixup with the given function
withNoFixup ∷ ImpTestM era a → ImpTestM era a Source #
Performs the action without running the fix-up function on any transactions
withPostFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a Source #
Apply given fixup function after the configured fixup
withPreFixup ∷ (Tx era → ImpTestM era (Tx era)) → ImpTestM era a → ImpTestM era a Source #
Apply given fixup function before the configured fixup
withCborRoundTripFailures ∷ ImpTestM era a → ImpTestM era a Source #
impNESL ∷ Lens' (ImpTestState era) (NewEpochState era) Source #
impGlobalsL ∷ Lens' (ImpTestState era) Globals Source #
impLastTickG ∷ SimpleGetter (ImpTestState era) SlotNo Source #
impKeyPairsG ∷ SimpleGetter (ImpTestState era) (Map (KeyHash 'Witness) (KeyPair 'Witness)) Source #
impNativeScriptsG ∷ SimpleGetter (ImpTestState era) (Map ScriptHash (NativeScript era)) Source #
produceScript ∷ (ShelleyEraImp era, HasCallStack) ⇒ ScriptHash → ImpTestM era TxIn Source #
advanceToPointOfNoReturn ∷ ImpTestM era () Source #
ImpSpec re-exports
Instances
Instances
(Show (ImpSpecEnv t), Show (ImpSpecState t)) ⇒ Show (ImpInit t) | |
(Eq (ImpSpecEnv t), Eq (ImpSpecState t)) ⇒ Eq (ImpInit t) | |
(Ord (ImpSpecEnv t), Ord (ImpSpecState t)) ⇒ Ord (ImpInit t) | |
Defined in Test.ImpSpec.Internal |