Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module, containing function to interpret Michelson instructions against given context and input stack.
Synopsis
- data ContractEnv = ContractEnv {}
- data InterpreterState = InterpreterState {}
- data MichelsonFailed where
- MichelsonFailedWith :: KnownT t => Value t -> MichelsonFailed
- MichelsonArithError :: (Typeable n, Typeable m, Typeable instr) => ArithError (Value' instr n) (Value' instr m) -> MichelsonFailed
- MichelsonGasExhaustion :: MichelsonFailed
- MichelsonFailedTestAssert :: Text -> MichelsonFailed
- MichelsonAmbigousEpRef :: EpName -> EpAddress -> MichelsonFailed
- newtype RemainingSteps = RemainingSteps Word64
- data SomeItStack where
- SomeItStack :: ExtInstr inp -> Rec Value inp -> SomeItStack
- newtype MorleyLogs = MorleyLogs {
- unMorleyLogs :: [Text]
- noMorleyLogs :: MorleyLogs
- interpret :: ContractCode cp st -> EntrypointCallT cp arg -> Value arg -> Value st -> ContractEnv -> ContractReturn st
- interpretInstr :: ContractEnv -> Instr inp out -> Rec Value inp -> Either MichelsonFailed (Rec Value out)
- type ContractReturn st = (Either MichelsonFailed ([Operation], Value st), InterpreterState)
- mkInitStack :: Value param -> Value st -> Rec Value (ContractInp param st)
- fromFinalStack :: Rec Value (ContractOut st) -> ([Operation], Value st)
- newtype InterpretError = InterpretError (MichelsonFailed, MorleyLogs)
- data InterpretResult where
- InterpretResult :: StorageScope st => {..} -> InterpretResult
- type EvalM m = (MonadReader ContractEnv m, MonadState InterpreterState m, MonadError MichelsonFailed m)
- type InstrRunner m = forall inp out. Instr inp out -> Rec Value inp -> m (Rec Value out)
- runInstr :: EvalM m => InstrRunner m
- runInstrNoGas :: EvalM m => InstrRunner m
- runUnpack :: forall t. UnpackedValScope t => ByteString -> Either UnpackError (Value t)
- initInterpreterState :: ContractEnv -> InterpreterState
- handleContractReturn :: StorageScope st => ContractReturn st -> Either InterpretError InterpretResult
- runInstrImpl :: EvalM m => InstrRunner m -> InstrRunner m
Documentation
data ContractEnv Source #
Environment for contract execution.
ContractEnv | |
|
data InterpreterState Source #
Instances
data MichelsonFailed where Source #
Represents `[FAILED]` state of a Michelson program. Contains
value that was on top of the stack when FAILWITH
was called.
MichelsonFailedWith :: KnownT t => Value t -> MichelsonFailed | |
MichelsonArithError :: (Typeable n, Typeable m, Typeable instr) => ArithError (Value' instr n) (Value' instr m) -> MichelsonFailed | |
MichelsonGasExhaustion :: MichelsonFailed | |
MichelsonFailedTestAssert :: Text -> MichelsonFailed | |
MichelsonAmbigousEpRef :: EpName -> EpAddress -> MichelsonFailed |
Instances
Eq MichelsonFailed Source # | |
Defined in Michelson.Interpret (==) :: MichelsonFailed -> MichelsonFailed -> Bool # (/=) :: MichelsonFailed -> MichelsonFailed -> Bool # | |
Show MichelsonFailed Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> MichelsonFailed -> ShowS # show :: MichelsonFailed -> String # showList :: [MichelsonFailed] -> ShowS # | |
NFData MichelsonFailed Source # | |
Defined in Michelson.Interpret rnf :: MichelsonFailed -> () # | |
Buildable MichelsonFailed Source # | |
Defined in Michelson.Interpret build :: MichelsonFailed -> Builder # |
newtype RemainingSteps Source #
Instances
data SomeItStack where Source #
SomeItStack :: ExtInstr inp -> Rec Value inp -> SomeItStack |
newtype MorleyLogs Source #
Morley logs for interpreter state.
MorleyLogs | |
|
Instances
interpret :: ContractCode cp st -> EntrypointCallT cp arg -> Value arg -> Value st -> ContractEnv -> ContractReturn st Source #
interpretInstr :: ContractEnv -> Instr inp out -> Rec Value inp -> Either MichelsonFailed (Rec Value out) Source #
Interpret an instruction in vacuum, putting no extra contraints on its execution.
Mostly for testing purposes.
type ContractReturn st = (Either MichelsonFailed ([Operation], Value st), InterpreterState) Source #
mkInitStack :: Value param -> Value st -> Rec Value (ContractInp param st) Source #
fromFinalStack :: Rec Value (ContractOut st) -> ([Operation], Value st) Source #
newtype InterpretError Source #
Instances
Show InterpretError Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> InterpretError -> ShowS # show :: InterpretError -> String # showList :: [InterpretError] -> ShowS # | |
Generic InterpretError Source # | |
Defined in Michelson.Interpret type Rep InterpretError :: Type -> Type # from :: InterpretError -> Rep InterpretError x # to :: Rep InterpretError x -> InterpretError # | |
Buildable InterpretError Source # | |
Defined in Michelson.Interpret build :: InterpretError -> Builder # | |
type Rep InterpretError Source # | |
Defined in Michelson.Interpret type Rep InterpretError = D1 ('MetaData "InterpretError" "Michelson.Interpret" "morley-1.7.0-inplace" 'True) (C1 ('MetaCons "InterpretError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MichelsonFailed, MorleyLogs)))) |
data InterpretResult where Source #
InterpretResult | |
|
Instances
Show InterpretResult Source # | |
Defined in Michelson.Interpret showsPrec :: Int -> InterpretResult -> ShowS # show :: InterpretResult -> String # showList :: [InterpretResult] -> ShowS # |
type EvalM m = (MonadReader ContractEnv m, MonadState InterpreterState m, MonadError MichelsonFailed m) Source #
runInstr :: EvalM m => InstrRunner m Source #
Function to change amount of remaining steps stored in State monad
runInstrNoGas :: EvalM m => InstrRunner m Source #
runUnpack :: forall t. UnpackedValScope t => ByteString -> Either UnpackError (Value t) Source #
Unpacks given raw data into a typed value.
Internals
handleContractReturn :: StorageScope st => ContractReturn st -> Either InterpretError InterpretResult Source #
runInstrImpl :: EvalM m => InstrRunner m -> InstrRunner m Source #
Function to interpret Michelson instruction(s) against given stack.