Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Abstract cleveland interface not bound to a particular implementation.
The interface may look a bit untyped and unsafe in some places. For example, in order to call a contract one should supply a simple address rather than a contract ref, so it is easy to pass a value of wrong type. Also it is easy to call a non-existing entrypoint.
Subjectively, it makes writing test scenarios easier because you have to prove less to the compiler. It also makes implementation of cleveland engine a bit easier. Of course, it also makes it easier to make certain mistakes. However, we expect users of this interface to also use the functionality of the Test.Cleveland.Internal.Pure module and convert cleveland scenarios to purely testable scenarios for integrational testing engine. In this case errors should be detected almost as quickly as they would reported by the compiler, at least before trying to run scenario on a live network.
Also this interface uses Address
rather than EpAddress
.
I (@gromak) concluded that EpAddress
can not be passed to tezos-client
.
For key addresses it just does not make sense and for contract addresses
I get such errors:
bad contract notation Invalid contract notation "KT1VrFpBPwBTm3hsK7DB7SPmY8fTHJ3vY6sJ%mint"
Synopsis
- data ContractHandle (cp :: Type) (st :: Type) (vd :: Type) = (NiceParameter cp, NiceStorage st, NiceViewsDescriptor vd) => ContractHandle {}
- data OriginateData param st vd (large :: LargeOrigination) = OriginateData {
- odName :: ContractAlias
- odBalance :: Mutez
- odStorage :: st
- odContract :: Contract param st vd
- data TransferData = forall v addr.(NiceParameter v, ToL1Address addr) => TransferData {
- tdTo :: addr
- tdAmount :: Mutez
- tdEntrypoint :: EpName
- tdParameter :: v
- newtype Sender = Sender {}
- newtype Moneybag = Moneybag {}
- data UntypedOriginateData (large :: LargeOrigination) = UntypedOriginateData {
- uodName :: ContractAlias
- uodBalance :: Mutez
- uodStorage :: Value
- uodContract :: Contract
- data TypedOriginateData cp st vd (large :: LargeOrigination) = TypedOriginateData {
- todName :: ContractAlias
- todBalance :: Mutez
- todStorage :: st
- todContract :: Contract (ToT cp) (ToT st)
- data LargeOrigination
- data TypedContract cp st vd where
- TypedContract :: Contract (ToT cp) (ToT st) -> TypedContract cp st vd
- data RunCode cp st vd = RunCode {
- rcContract :: Contract cp st vd
- rcParameter :: Value
- rcStorage :: Value
- rcAmount :: Mutez
- rcLevel :: Maybe Natural
- rcNow :: Maybe Timestamp
- rcBalance :: Mutez
- rcSource :: Maybe ImplicitAddress
- data ClevelandInput
- data ClevelandResult
- data ContractEvent = ContractEvent {}
- newtype DefaultAliasCounter = DefaultAliasCounter {}
- data SpecificOrDefaultAlias
- data ClevelandOpsImpl m = ClevelandOpsImpl {
- coiRunOperationBatch :: HasCallStack => [OperationInfo ClevelandInput] -> m [OperationInfo ClevelandResult]
- data ClevelandMiscImpl m = ClevelandMiscImpl {
- cmiRunIO :: forall res. HasCallStack => IO res -> m res
- cmiResolveAddress :: forall kind. HasCallStack => Alias kind -> m (KindedAddress kind)
- cmiGenKey :: HasCallStack => SpecificOrDefaultAlias -> m ImplicitAddress
- cmiGenFreshKey :: HasCallStack => SpecificOrDefaultAlias -> m ImplicitAddress
- cmiSignBytes :: HasCallStack => ByteString -> ImplicitAddress -> m Signature
- cmiOriginateLargeUntyped :: HasCallStack => Sender -> UntypedOriginateData 'IsLarge -> m ContractAddress
- cmiComment :: HasCallStack => Text -> m ()
- cmiGetBalance :: HasCallStack => L1Address -> m Mutez
- cmiGetSomeStorage :: HasCallStack => ContractAddress -> m SomeAnnotatedValue
- cmiGetBigMapValueMaybe :: forall k v. (HasCallStack, NiceComparable k, NicePackedValue k, NiceUnpackedValue v) => BigMapId k v -> k -> m (Maybe v)
- cmiGetAllBigMapValuesMaybe :: forall k v. (HasCallStack, NiceComparable k, NiceUnpackedValue v) => BigMapId k v -> m (Maybe [v])
- cmiGetPublicKey :: HasCallStack => ImplicitAddress -> m PublicKey
- cmiGetDelegate :: HasCallStack => ContractAddress -> m (Maybe KeyHash)
- cmiRegisterDelegate :: HasCallStack => ImplicitAddress -> m ()
- cmiGetChainId :: HasCallStack => m ChainId
- cmiAdvanceTime :: forall unit. (HasCallStack, KnownDivRat unit Second) => Time unit -> m ()
- cmiAdvanceToLevel :: HasCallStack => (Natural -> Natural) -> m ()
- cmiGetNow :: HasCallStack => m Timestamp
- cmiGetLevel :: HasCallStack => m Natural
- cmiFailure :: forall a. HasCallStack => Builder -> m a
- cmiThrow :: forall a. HasCallStack => SomeException -> m a
- cmiGetApproximateBlockInterval :: HasCallStack => m (Time Second)
- cmiAttempt :: forall a e. (Exception e, HasCallStack) => m a -> m (Either e a)
- cmiMarkAddressRefillable :: ImplicitAddress -> m ()
- cmiUnderlyingImpl :: m (Either (EmulatedImpl m) NetworkEnv)
- cmiRunCode :: forall cp st vd. (HasCallStack, HasRPCRepr st, IsoValue (AsRPC st)) => Sender -> RunCode cp st vd -> m (AsRPC st)
- data EmulatedImpl m = EmulatedImpl {
- eiBranchout :: [(Text, m ())] -> m ()
- eiGetStorage :: forall st addr. (HasCallStack, ToStorageType st addr) => addr -> m st
- eiGetMorleyLogs :: forall a. m a -> m (LogsInfo, a)
- eiSetVotingPowers :: VotingPowers -> m ()
- mapClevelandOpsImplExceptions :: (forall a. HasCallStack => m a -> m a) -> ClevelandOpsImpl m -> ClevelandOpsImpl m
- mapClevelandMiscImplExceptions :: (forall a. HasCallStack => m a -> m a) -> ClevelandMiscImpl m -> ClevelandMiscImpl m
- data BatchResultMismatch = BatchResultMismatch Text
- data ClevelandOpsBatch a
- runBatched :: (HasCallStack, Functor m) => ClevelandOpsImpl m -> ClevelandOpsBatch a -> m a
- batchedOpsImpl :: ClevelandOpsImpl ClevelandOpsBatch
- runOperationBatchM :: (HasCallStack, Buildable e, Functor m) => Proxy e -> ClevelandOpsImpl m -> BatchingM (OperationInfo ClevelandInput) (OperationInfo ClevelandResult) e a -> m a
- runSingleOperation :: (HasCallStack, Functor m) => ClevelandOpsImpl m -> Text -> OperationInfo ClevelandInput -> (OperationInfo ClevelandResult -> Maybe a) -> m a
- data AddressAndAlias = AddressAndAlias Address (Maybe ContractAlias)
- data TransferFailure = TransferFailure {}
- data TransferFailureReason
- = FailedWith ExpressionOrTypedValue (Maybe ErrorSrcPos)
- | EmptyTransaction
- | BadParameter
- | MutezArithError MutezArithErrorType
- | ShiftOverflow
- | GasExhaustion
- data FailedInBranch = FailedInBranch ScenarioBranchName SomeException
- newtype ScenarioBranchName = ScenarioBranchName {
- unTestBranch :: [Text]
- data GenericTestError = UnexpectedSuccess
- data ExpressionOrTypedValue where
- EOTVExpression :: Expression -> ExpressionOrTypedValue
- EOTVTypedValue :: (SingI t, ConstantScope t) => Value t -> ExpressionOrTypedValue
- auto :: SpecificOrDefaultAlias
- ep :: EntrypointNameConstructor epName a => a
- mkDefaultAlias :: Natural -> ImplicitAlias
- data Alias (kind :: AddressKind)
- type ImplicitAlias = Alias 'AddressKindImplicit
- type ContractAlias = Alias 'AddressKindContract
- data KindedAddress (kind :: AddressKind)
- type ContractAddress = KindedAddress 'AddressKindContract
- type ImplicitAddress = KindedAddress 'AddressKindImplicit
- data ClevelandCaps m = ClevelandCaps {
- ccSender :: Sender
- ccMoneybag :: Moneybag
- ccMiscCap :: ClevelandMiscImpl m
- ccOpsCap :: Sender -> ClevelandOpsImpl m
- data EmulatedCaps m = EmulatedCaps {}
- data NetworkCaps m = NetworkCaps {}
- class Monad (ClevelandBaseMonad caps) => HasClevelandCaps caps where
- type ClevelandBaseMonad caps :: Type -> Type
- clevelandCapsL :: Lens' caps (ClevelandCaps (ClevelandBaseMonad caps))
- senderL :: HasClevelandCaps caps => Lens' caps Sender
- moneybagL :: HasClevelandCaps caps => Lens' caps Moneybag
- getMiscCap :: HasClevelandCaps caps => caps -> ClevelandMiscImpl (ClevelandBaseMonad caps)
- getOpsCap :: HasClevelandCaps caps => caps -> ClevelandOpsImpl (ClevelandBaseMonad caps)
- class HasClevelandCaps caps => HasEmulatedCaps caps where
- getEmulatedCap :: caps -> EmulatedImpl (ClevelandBaseMonad caps)
- class HasClevelandCaps caps => HasNetworkCaps caps where
- getNetworkEnvCap :: caps -> NetworkEnv
- type MonadCleveland caps m = (m ~ ReaderT caps (ClevelandBaseMonad caps), HasClevelandCaps caps)
- type MonadEmulated caps m = (MonadCleveland caps m, HasEmulatedCaps caps)
- type MonadNetwork caps m = (MonadCleveland caps m, HasNetworkCaps caps)
- type ClevelandT m = ReaderT (ClevelandCaps m) m
- type EmulatedT m = ReaderT (EmulatedCaps m) m
- type NetworkT m = ReaderT (NetworkCaps m) m
- type LogsInfo = [ScenarioLogs]
- data ScenarioLogs = ScenarioLogs {
- _slAddr :: Address
- _slLog :: MorleyLogs
- slAddr :: Lens' ScenarioLogs Address
- slLog :: Lens' ScenarioLogs MorleyLogs
- logsL :: Lens' ScenarioLogs MorleyLogs
- filterLogsByAddrL :: (ToAddress addr, Applicative f) => addr -> (MorleyLogs -> f MorleyLogs) -> ScenarioLogs -> f ScenarioLogs
- logsForAddress :: (Each s s ScenarioLogs ScenarioLogs, ToAddress addr) => addr -> s -> [MorleyLogs]
- collectLogs :: LogsInfo -> MorleyLogs
- data NetworkEnv = NetworkEnv {
- neMorleyClientEnv :: MorleyClientEnv
- neSecretKey :: Maybe SecretKey
- neMoneybagAlias :: ImplicitAlias
- neExplicitDataDir :: Bool
- neMorleyClientEnvL :: Lens' NetworkEnv MorleyClientEnv
- neSecretKeyL :: Lens' NetworkEnv (Maybe SecretKey)
- neMoneybagAliasL :: Lens' NetworkEnv ImplicitAlias
- neExplicitDataDirL :: Lens' NetworkEnv Bool
Documentation
data ContractHandle (cp :: Type) (st :: Type) (vd :: Type) Source #
Handle to a contract.
This is what you get when originating a contract and that allows further operations with the contract within the test framework.
Note that this is part of the testing framework and exists solely in Haskell
world, so it has no IsoValue
and related instances and cannot be used in
Lorentz code.
(NiceParameter cp, NiceStorage st, NiceViewsDescriptor vd) => ContractHandle | |
Instances
data OriginateData param st vd (large :: LargeOrigination) Source #
OriginateData | |
|
Instances
ModifyOriginationData (OriginateData cp st vd) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate setBalance :: forall (large :: LargeOrigination). Mutez -> OriginateData cp st vd large -> OriginateData cp st vd large Source # setLarge :: OriginateData cp st vd 'NotLarge -> OriginateData cp st vd 'IsLarge Source # | |
(a ~ ContractHandle cp st vd, MonadOpsInternal m, Originator (UntypedOriginateData large) (m ContractAddress)) => Originator (OriginateData cp st vd large) (m a) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate originateFn :: OriginateData cp st vd large -> m a Source # |
data TransferData Source #
Information about transfer operation.
forall v addr.(NiceParameter v, ToL1Address addr) => TransferData | |
|
Designates the special sender address.
Transfers and some other operations will occur on behalf of this address.
This is initialized to moneybag
address and then can be locally modified.
Operations in ClevelandOpsImpl
are affected by this address.
Designates the address that gifts money to new addresses.
Once a new address is allocated in a test scenario, we have to transfer some
money to it so that it is able to serve as transactions sender. Moneybag
serves as a source of that money.
We do not use Sender
for this purpose because in most situations changing
moneybag is not necessary. If a user wraps a large piece of their script with
withSender
call and that changes the moneybag - this behaviour may be
undesired and unexpected to the user.
data UntypedOriginateData (large :: LargeOrigination) Source #
Untyped version of OriginateData. It can be used for interaction with raw Michelson contracts
UntypedOriginateData | |
|
Instances
ModifyOriginationData UntypedOriginateData Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate setBalance :: forall (large :: LargeOrigination). Mutez -> UntypedOriginateData large -> UntypedOriginateData large Source # setLarge :: UntypedOriginateData 'NotLarge -> UntypedOriginateData 'IsLarge Source # | |
(a ~ ContractAddress, MonadOpsInternal m) => Originator (UntypedOriginateData 'NotLarge) (m a) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate originateFn :: UntypedOriginateData 'NotLarge -> m a Source # | |
(HasClevelandCaps caps, base ~ ClevelandBaseMonad caps, a ~ ContractAddress) => Originator (UntypedOriginateData 'IsLarge) (ReaderT caps base a) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate originateFn :: UntypedOriginateData 'IsLarge -> ReaderT caps base a Source # |
data TypedOriginateData cp st vd (large :: LargeOrigination) Source #
Untyped version of OriginateData. It can be used for interaction with raw Michelson contracts
TypedOriginateData | |
|
Instances
ModifyOriginationData (TypedOriginateData cp st vd) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate setBalance :: forall (large :: LargeOrigination). Mutez -> TypedOriginateData cp st vd large -> TypedOriginateData cp st vd large Source # setLarge :: TypedOriginateData cp st vd 'NotLarge -> TypedOriginateData cp st vd 'IsLarge Source # | |
(a ~ ContractHandle cp st vd, MonadOpsInternal m, Originator (UntypedOriginateData large) (m ContractAddress), NiceStorage st, NiceViewsDescriptor vd, NiceParameter cp) => Originator (TypedOriginateData cp st vd large) (m a) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate originateFn :: TypedOriginateData cp st vd large -> m a Source # |
data LargeOrigination Source #
Whether this contract should be originated in a single origination operation or, if it goes over the origination size limit, in multiple operations.
data TypedContract cp st vd where Source #
A wrapper around Contract
to reduce awkwardness
TypedContract :: Contract (ToT cp) (ToT st) -> TypedContract cp st vd |
Instances
ContractClass (TypedContract cp st vd) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate type ContractStorage (TypedContract cp st vd) Source # type ContractOriginateData (TypedContract cp st vd) :: LargeOrigination -> Type Source # initialData :: ContractAlias -> ContractStorage (TypedContract cp st vd) -> TypedContract cp st vd -> ContractOriginateData (TypedContract cp st vd) 'NotLarge Source # | |
type ContractOriginateData (TypedContract cp st vd) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate | |
type ContractStorage (TypedContract cp st vd) Source # | |
Defined in Test.Cleveland.Internal.Actions.Originate |
data RunCode cp st vd Source #
The data needed to call the /run_code
RPC endpoint.
RunCode | |
|
data ClevelandInput Source #
Designates an operation input.
Instances
OperationInfoDescriptor ClevelandInput Source # | |
Defined in Test.Cleveland.Internal.Abstract | |
type OriginationInfo ClevelandInput Source # | |
Defined in Test.Cleveland.Internal.Abstract | |
type RevealInfo ClevelandInput Source # | |
Defined in Test.Cleveland.Internal.Abstract type RevealInfo ClevelandInput = PublicKey | |
type TransferInfo ClevelandInput Source # | |
Defined in Test.Cleveland.Internal.Abstract |
data ClevelandResult Source #
Designates an operation result.
Instances
OperationInfoDescriptor ClevelandResult Source # | |
Defined in Test.Cleveland.Internal.Abstract type TransferInfo ClevelandResult type OriginationInfo ClevelandResult type RevealInfo ClevelandResult | |
type OriginationInfo ClevelandResult Source # | |
Defined in Test.Cleveland.Internal.Abstract type OriginationInfo ClevelandResult = OriginationInfo Result | |
type RevealInfo ClevelandResult Source # | |
Defined in Test.Cleveland.Internal.Abstract type RevealInfo ClevelandResult = RevealInfo Result | |
type TransferInfo ClevelandResult Source # | |
Defined in Test.Cleveland.Internal.Abstract |
newtype DefaultAliasCounter Source #
Counter which is used to provide different default aliases.
Instances
Show DefaultAliasCounter Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> DefaultAliasCounter -> ShowS # show :: DefaultAliasCounter -> String # showList :: [DefaultAliasCounter] -> ShowS # | |
Eq DefaultAliasCounter Source # | |
Defined in Test.Cleveland.Internal.Abstract (==) :: DefaultAliasCounter -> DefaultAliasCounter -> Bool # (/=) :: DefaultAliasCounter -> DefaultAliasCounter -> Bool # |
data SpecificOrDefaultAlias Source #
An alias with default value that can be used to define unique alias automatically.
Instances
IsString SpecificOrDefaultAlias Source # | |
Defined in Test.Cleveland.Internal.Abstract | |
Show SpecificOrDefaultAlias Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> SpecificOrDefaultAlias -> ShowS # show :: SpecificOrDefaultAlias -> String # showList :: [SpecificOrDefaultAlias] -> ShowS # | |
Default SpecificOrDefaultAlias Source # | |
Defined in Test.Cleveland.Internal.Abstract |
Actions
data ClevelandOpsImpl m Source #
A record data type with operations creating primitives.
ClevelandOpsImpl | |
|
data ClevelandMiscImpl m Source #
A record data type with all base methods one can use during a cleveland test.
ClevelandMiscImpl | |
|
data EmulatedImpl m Source #
A record data type with all base methods one can use during cleveland, but which are available only when running on an emulated environment (e.g. Morley.Michelson.Runtime) and not on a real network.
EmulatedImpl | |
|
mapClevelandOpsImplExceptions :: (forall a. HasCallStack => m a -> m a) -> ClevelandOpsImpl m -> ClevelandOpsImpl m Source #
Runs a handler over every action.
mapClevelandMiscImplExceptions :: (forall a. HasCallStack => m a -> m a) -> ClevelandMiscImpl m -> ClevelandMiscImpl m Source #
Runs a handler over every action (except cmiAttempt
and cmiThrow
),
possibly transforming exceptions thrown by those actions.
Batching
data BatchResultMismatch Source #
A batch returned invalid output, e.g. origination address when transaction was supplied.
BatchResultMismatch Text | Carries expected operation type in lowercase |
Instances
Buildable BatchResultMismatch Source # | |
Defined in Test.Cleveland.Internal.Abstract build :: BatchResultMismatch -> Builder # |
data ClevelandOpsBatch a Source #
Where the batched operations occur.
Note that this is not a Monad
, rather an Applicative
- use
-XApplicativeDo
extension for nicer experience.
Instances
runBatched :: (HasCallStack, Functor m) => ClevelandOpsImpl m -> ClevelandOpsBatch a -> m a Source #
Run a series of operations within a batch.
Example:
contract <- runBatched impl $ do
-- this block is executed within ClevelandOpsBatch
contract <- runSingleOperation batchedOpsImpl "origination" ...
for_ [1..3] i ->
runSingleOperation batchedOpsImpl "transfer" ...
return contract
See ClevelandOpsBatch
for some precautions.
batchedOpsImpl :: ClevelandOpsImpl ClevelandOpsBatch Source #
ClevelandOpsImpl
suitable for methods executed within a batch.
runOperationBatchM :: (HasCallStack, Buildable e, Functor m) => Proxy e -> ClevelandOpsImpl m -> BatchingM (OperationInfo ClevelandInput) (OperationInfo ClevelandResult) e a -> m a Source #
Version of coiRunOperationBatch
that uses BatchingM
.
This is an internal function.
Invariant: all errors described by e
must be internal and should not occur
in practice (we require e
type to be specified explicitly to hinder
incorrect usage).
runSingleOperation :: (HasCallStack, Functor m) => ClevelandOpsImpl m -> Text -> OperationInfo ClevelandInput -> (OperationInfo ClevelandResult -> Maybe a) -> m a Source #
Helper that runs a single operation using ClevelandOpsImpl
.
Validation
data AddressAndAlias Source #
AddressAndAlias Address (Maybe ContractAlias) |
Instances
Show AddressAndAlias Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> AddressAndAlias -> ShowS # show :: AddressAndAlias -> String # showList :: [AddressAndAlias] -> ShowS # | |
Buildable AddressAndAlias Source # | |
Defined in Test.Cleveland.Internal.Abstract build :: AddressAndAlias -> Builder # | |
Eq AddressAndAlias Source # | |
Defined in Test.Cleveland.Internal.Abstract (==) :: AddressAndAlias -> AddressAndAlias -> Bool # (/=) :: AddressAndAlias -> AddressAndAlias -> Bool # |
data TransferFailure Source #
Failures that could be expected in the execution of a transfer.
These can be caught and handled with attempt
.
Instances
Exception TransferFailure Source # | |
Defined in Test.Cleveland.Internal.Abstract | |
Show TransferFailure Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> TransferFailure -> ShowS # show :: TransferFailure -> String # showList :: [TransferFailure] -> ShowS # | |
Buildable TransferFailure Source # | |
Defined in Test.Cleveland.Internal.Abstract build :: TransferFailure -> Builder # | |
Eq TransferFailure Source # | |
Defined in Test.Cleveland.Internal.Abstract (==) :: TransferFailure -> TransferFailure -> Bool # (/=) :: TransferFailure -> TransferFailure -> Bool # |
data TransferFailureReason Source #
FailedWith ExpressionOrTypedValue (Maybe ErrorSrcPos) | Expect that interpretation of contract with the given address ended
with |
EmptyTransaction | Expect failure due to an attempt to transfer 0tz towards a simple address. |
BadParameter | Expect failure due to an attempt to call a contract with an invalid parameter. |
MutezArithError MutezArithErrorType | Expect failure due to an arithmetic over-/underflow |
ShiftOverflow | Expect that interpretation of contract with the given address ended with an overflow error. |
GasExhaustion |
Instances
Show TransferFailureReason Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> TransferFailureReason -> ShowS # show :: TransferFailureReason -> String # showList :: [TransferFailureReason] -> ShowS # | |
Buildable TransferFailureReason Source # | |
Defined in Test.Cleveland.Internal.Abstract build :: TransferFailureReason -> Builder # | |
Eq TransferFailureReason Source # | |
Defined in Test.Cleveland.Internal.Abstract (==) :: TransferFailureReason -> TransferFailureReason -> Bool # (/=) :: TransferFailureReason -> TransferFailureReason -> Bool # |
data FailedInBranch Source #
When an exception is thrown in a branchout
branch, we wrap it in this
constructor to remember in _which_ branch it was thrown.
We use this information to provide better error messages when a test fails.
Instances
Exception FailedInBranch Source # | |
Defined in Test.Cleveland.Internal.Abstract | |
Show FailedInBranch Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> FailedInBranch -> ShowS # show :: FailedInBranch -> String # showList :: [FailedInBranch] -> ShowS # | |
Buildable FailedInBranch Source # | |
Defined in Test.Cleveland.Internal.Abstract build :: FailedInBranch -> Builder # |
newtype ScenarioBranchName Source #
When using branchout
function for building test scenarios - names
of branches we are currently within.
Instances
Show ScenarioBranchName Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> ScenarioBranchName -> ShowS # show :: ScenarioBranchName -> String # showList :: [ScenarioBranchName] -> ShowS # | |
Buildable ScenarioBranchName Source # | |
Defined in Test.Cleveland.Internal.Abstract build :: ScenarioBranchName -> Builder # | |
Eq ScenarioBranchName Source # | |
Defined in Test.Cleveland.Internal.Abstract (==) :: ScenarioBranchName -> ScenarioBranchName -> Bool # (/=) :: ScenarioBranchName -> ScenarioBranchName -> Bool # |
data GenericTestError Source #
Instances
Exception GenericTestError Source # | |
Defined in Test.Cleveland.Internal.Abstract | |
Show GenericTestError Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> GenericTestError -> ShowS # show :: GenericTestError -> String # showList :: [GenericTestError] -> ShowS # | |
Buildable GenericTestError Source # | |
Defined in Test.Cleveland.Internal.Abstract build :: GenericTestError -> Builder # |
data ExpressionOrTypedValue where Source #
Representation of Expression we got from the RPC or a typed value we got from the emulator.
EOTVExpression :: Expression -> ExpressionOrTypedValue | |
EOTVTypedValue :: (SingI t, ConstantScope t) => Value t -> ExpressionOrTypedValue |
Instances
Show ExpressionOrTypedValue Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> ExpressionOrTypedValue -> ShowS # show :: ExpressionOrTypedValue -> String # showList :: [ExpressionOrTypedValue] -> ShowS # | |
Buildable ExpressionOrTypedValue Source # | |
Defined in Test.Cleveland.Internal.Abstract build :: ExpressionOrTypedValue -> Builder # | |
Eq ExpressionOrTypedValue Source # | |
Defined in Test.Cleveland.Internal.Abstract |
Helpers
auto :: SpecificOrDefaultAlias Source #
Helper to use automatically determined unique alias.
ep :: EntrypointNameConstructor epName a => a Source #
A short partial constructor for EpName
or EntrypointRef
. It accepts a
type-level string as its type argument. The programmer is responsible for
validity. And this code is for tests anyway, so each failure is a
programmer mistake.
Note that entrypoint names should be capitalized, e.g.
ep @"Entrypoint"
corresponds to entrypoint
, etc.
It is intentionally here and not in some deeper module because the name is really short and more suitable for writing scenarios.
For EpName
, an instance is provided accepting a value-level Text
instead of a type-level symbol. This is mostly for cases where the
type-level symbol doesn't work. Note that value-level string will be used
verbatim, hence capitalization is arbitrary.
ep "entrypoint"
Morley client re-exports
data Alias (kind :: AddressKind) #
Instances
IsString ContractAlias Source # | |
Defined in Test.Cleveland.Instances fromString :: String -> ContractAlias # | |
IsString ImplicitAlias Source # | |
Defined in Test.Cleveland.Instances fromString :: String -> ImplicitAlias # | |
(SingI kind, L1AddressKind kind) => FromJSON (Alias kind) | |
ToJSON (Alias kind) | |
Defined in Morley.Tezos.Address.Alias | |
Show (Alias kind) | |
Buildable (Alias kind) | |
Defined in Morley.Tezos.Address.Alias | |
Eq (Alias kind) | |
Ord (Alias kind) | |
Defined in Morley.Tezos.Address.Alias | |
CmdArg (Alias kind) | |
Defined in Morley.Client.TezosClient.Types |
type ImplicitAlias = Alias 'AddressKindImplicit #
type ContractAlias = Alias 'AddressKindContract #
data KindedAddress (kind :: AddressKind) #
Instances
type ContractAddress = KindedAddress 'AddressKindContract #
type ImplicitAddress = KindedAddress 'AddressKindImplicit #
Capability records
data ClevelandCaps m Source #
A record with all the capabilities available to any cleveland test.
ClevelandCaps | |
|
Instances
Monad m => HasClevelandCaps (ClevelandCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract type ClevelandBaseMonad (ClevelandCaps m) :: Type -> Type Source # clevelandCapsL :: Lens' (ClevelandCaps m) (ClevelandCaps (ClevelandBaseMonad (ClevelandCaps m))) Source # | |
type ClevelandBaseMonad (ClevelandCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract |
data EmulatedCaps m Source #
A record with all the capabilities available to a cleveland test on the emulator.
Instances
Monad m => HasClevelandCaps (EmulatedCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract type ClevelandBaseMonad (EmulatedCaps m) :: Type -> Type Source # clevelandCapsL :: Lens' (EmulatedCaps m) (ClevelandCaps (ClevelandBaseMonad (EmulatedCaps m))) Source # | |
Monad m => HasEmulatedCaps (EmulatedCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract getEmulatedCap :: EmulatedCaps m -> EmulatedImpl (ClevelandBaseMonad (EmulatedCaps m)) Source # | |
type ClevelandBaseMonad (EmulatedCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract |
data NetworkCaps m Source #
A record with all the capabilities available to a cleveland test on the network.
Instances
Monad m => HasClevelandCaps (NetworkCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract type ClevelandBaseMonad (NetworkCaps m) :: Type -> Type Source # clevelandCapsL :: Lens' (NetworkCaps m) (ClevelandCaps (ClevelandBaseMonad (NetworkCaps m))) Source # | |
Monad m => HasNetworkCaps (NetworkCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract getNetworkEnvCap :: NetworkCaps m -> NetworkEnv Source # | |
type ClevelandBaseMonad (NetworkCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract |
class Monad (ClevelandBaseMonad caps) => HasClevelandCaps caps where Source #
A proof that the given caps
record contains
the basic cleveland capabilities.
type ClevelandBaseMonad caps :: Type -> Type Source #
This will be either PureM
or ClientM
.
clevelandCapsL :: Lens' caps (ClevelandCaps (ClevelandBaseMonad caps)) Source #
Instances
Monad m => HasClevelandCaps (ClevelandCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract type ClevelandBaseMonad (ClevelandCaps m) :: Type -> Type Source # clevelandCapsL :: Lens' (ClevelandCaps m) (ClevelandCaps (ClevelandBaseMonad (ClevelandCaps m))) Source # | |
Monad m => HasClevelandCaps (EmulatedCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract type ClevelandBaseMonad (EmulatedCaps m) :: Type -> Type Source # clevelandCapsL :: Lens' (EmulatedCaps m) (ClevelandCaps (ClevelandBaseMonad (EmulatedCaps m))) Source # | |
Monad m => HasClevelandCaps (NetworkCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract type ClevelandBaseMonad (NetworkCaps m) :: Type -> Type Source # clevelandCapsL :: Lens' (NetworkCaps m) (ClevelandCaps (ClevelandBaseMonad (NetworkCaps m))) Source # |
getMiscCap :: HasClevelandCaps caps => caps -> ClevelandMiscImpl (ClevelandBaseMonad caps) Source #
getOpsCap :: HasClevelandCaps caps => caps -> ClevelandOpsImpl (ClevelandBaseMonad caps) Source #
class HasClevelandCaps caps => HasEmulatedCaps caps where Source #
A proof that the given caps
record contains
the basic cleveland capabilities + the emulator capabilities.
getEmulatedCap :: caps -> EmulatedImpl (ClevelandBaseMonad caps) Source #
Instances
Monad m => HasEmulatedCaps (EmulatedCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract getEmulatedCap :: EmulatedCaps m -> EmulatedImpl (ClevelandBaseMonad (EmulatedCaps m)) Source # |
class HasClevelandCaps caps => HasNetworkCaps caps where Source #
A proof that the given caps
record contains
the basic cleveland capabilities + the network capabilities.
getNetworkEnvCap :: caps -> NetworkEnv Source #
Instances
Monad m => HasNetworkCaps (NetworkCaps m) Source # | |
Defined in Test.Cleveland.Internal.Abstract getNetworkEnvCap :: NetworkCaps m -> NetworkEnv Source # |
type MonadCleveland caps m = (m ~ ReaderT caps (ClevelandBaseMonad caps), HasClevelandCaps caps) Source #
Constraint for a monad in which we can do cleveland actions.
type MonadEmulated caps m = (MonadCleveland caps m, HasEmulatedCaps caps) Source #
Constraint for a monad in which we can do cleveland actions that can't be
run on a real network. It requires the EmulatedCaps
capability.
type MonadNetwork caps m = (MonadCleveland caps m, HasNetworkCaps caps) Source #
Constraint for a monad in which we can do cleveland actions that can only
be run on a real network. It requires the NetworkCaps
capability.
type ClevelandT m = ReaderT (ClevelandCaps m) m Source #
Monad transformer that adds only the ClevelandCaps
capabilities.
type EmulatedT m = ReaderT (EmulatedCaps m) m Source #
Monad transformer that adds both ClevelandCaps
and EmulatedCaps
capabilities.
type NetworkT m = ReaderT (NetworkCaps m) m Source #
Monad transformer that adds both ClevelandCaps
and NetworkCaps
capabilities.
Log utilities
type LogsInfo = [ScenarioLogs] Source #
data ScenarioLogs Source #
ScenarioLogs | |
|
Instances
Show ScenarioLogs Source # | |
Defined in Test.Cleveland.Internal.Abstract showsPrec :: Int -> ScenarioLogs -> ShowS # show :: ScenarioLogs -> String # showList :: [ScenarioLogs] -> ShowS # | |
Eq ScenarioLogs Source # | |
Defined in Test.Cleveland.Internal.Abstract (==) :: ScenarioLogs -> ScenarioLogs -> Bool # (/=) :: ScenarioLogs -> ScenarioLogs -> Bool # | |
MonadWriter LogsInfo PureM Source # | |
slAddr :: Lens' ScenarioLogs Address Source #
logsL :: Lens' ScenarioLogs MorleyLogs Source #
An alias for slLog
with a clearer name
filterLogsByAddrL :: (ToAddress addr, Applicative f) => addr -> (MorleyLogs -> f MorleyLogs) -> ScenarioLogs -> f ScenarioLogs Source #
Lens combinator specified for filtering logs by address from LogsInfo
logsForAddress :: (Each s s ScenarioLogs ScenarioLogs, ToAddress addr) => addr -> s -> [MorleyLogs] Source #
Get logs for a given address from LogsInfo
collectLogs :: LogsInfo -> MorleyLogs Source #
Collect logs produced by all contracts into the single list
Network environment
data NetworkEnv Source #
NetworkEnv | |
|
neSecretKeyL :: Lens' NetworkEnv (Maybe SecretKey) Source #