package tezos-protocol-016-PtMumbai
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7062cd57addd452852598a2214ade393130efa087b99068d53713bdf912b3680
sha512=08e4091144a03ce3c107fb91a66501bd8b65ca3278917c455a2eaac6df3e108ade63f6ab8340a4bb152d60f404326e464d0ec95d26cafe8e82f870465d24a5fc
doc/tezos-protocol-016-PtMumbai.raw/Tezos_raw_protocol_016_PtMumbai/Script_ir_unparser/index.html
Module Tezos_raw_protocol_016_PtMumbai.Script_ir_unparserSource
Flag that drives unparsing of typed values to nodes.
Optimized_legacymust be kept backward-compatible in order to compute valid hashes (of big map keys).Optimizedmay be used as long as the result can be read byScript_translator.parse_data.Readableproduces withstringvalues instead ofbyteswhen feasible.
type ('ty, 'depth) comb_witness = | Comb_Pair : ('t, 'd) comb_witness -> (_ * 't, unit -> 'd) comb_witness| Comb_Any : (_, _) comb_witness
('t, 'd) comb_witness describes types of values belonging to a comb of type 't and size 'd.
serialize_ty_for_error ty returns the Micheline representation of ty suitable for rendering in an error message. Does not consume gas, since when this function is called, the operation must have already failed.
val serialize_stack_for_error :
Alpha_context.context ->
('a, 'b) Script_typed_ir.stack_ty ->
Alpha_context.Script.expr listserialize_stack_for_error ctxt stack_ty returns a Micheline representation of stack_ty as a list of Micheline expressions ONLY IF gas is unlimited in ctxt. Otherwise returns an empty list.
val unparse_ty :
loc:'loc ->
Alpha_context.context ->
('b, 'c) Script_typed_ir.ty ->
('loc Alpha_context.Script.michelson_node * Alpha_context.context,
Tezos_protocol_environment_016_PtMumbai.Error_monad.error
Tezos_protocol_environment_016_PtMumbai.Error_monad.trace)
Tezos_protocol_environment_016_PtMumbai.Pervasives.resultunparse_ty ~loc ctxt ty returns the Micheline representation of a given type and an update context, where gas has been properly consumed.
val unparse_comparable_ty_uncarbonated :
loc:'loc ->
'a Script_typed_ir.comparable_ty ->
'loc Alpha_context.Script.michelson_nodeunparse_comparable_ty_uncarbonated ~loc ty returns the Michelson representation of comparable type ty without consuming gas.
val unparse_stack_uncarbonated :
('a, 's) Script_typed_ir.stack_ty ->
Alpha_context.Script.expr listunparse_stack_uncarbonated stack_ty returns the Micheline representation of stack_ty. Does not consume gas.
val unparse_parameter_ty :
loc:'loc ->
Alpha_context.context ->
('a, 'c) Script_typed_ir.ty ->
entrypoints:'a Script_typed_ir.entrypoints ->
('loc Alpha_context.Script.michelson_node * Alpha_context.context,
Tezos_protocol_environment_016_PtMumbai.Error_monad.error
Tezos_protocol_environment_016_PtMumbai.Error_monad.trace)
Tezos_protocol_environment_016_PtMumbai.Pervasives.resultunparse_parameter_ty ~loc ctxt ty ~entrypoints is a specialised version of unparse_ty, which also analyses entrypoints in order to annotate the returned type with adequate annotations.
val unparse_bls12_381_g1 :
loc:'loc ->
Alpha_context.context ->
Script_typed_ir.Script_bls.G1.t ->
('loc Alpha_context.Script.michelson_node * Alpha_context.context,
Tezos_protocol_environment_016_PtMumbai.Error_monad.error
Tezos_protocol_environment_016_PtMumbai.Error_monad.trace)
Tezos_protocol_environment_016_PtMumbai.Pervasives.resultunparse_bls12_381_g1 ~loc ctxt bls returns the Micheline representation of bls and consumes gas from ctxt.
val unparse_bls12_381_g2 :
loc:'loc ->
Alpha_context.context ->
Script_typed_ir.Script_bls.G2.t ->
('loc Alpha_context.Script.michelson_node * Alpha_context.context,
Tezos_protocol_environment_016_PtMumbai.Error_monad.error
Tezos_protocol_environment_016_PtMumbai.Error_monad.trace)
Tezos_protocol_environment_016_PtMumbai.Pervasives.resultunparse_bls12_381_g1 ~loc ctxt bls returns the Micheline representation of bls and consumes gas from ctxt.
val unparse_bls12_381_fr :
loc:'loc ->
Alpha_context.context ->
Script_typed_ir.Script_bls.Fr.t ->
('loc Alpha_context.Script.michelson_node * Alpha_context.context,
Tezos_protocol_environment_016_PtMumbai.Error_monad.error
Tezos_protocol_environment_016_PtMumbai.Error_monad.trace)
Tezos_protocol_environment_016_PtMumbai.Pervasives.resultunparse_bls12_381_g1 ~loc ctxt bls returns the Micheline representation of bls and consumes gas from ctxt.
val unparse_operation :
loc:'loc ->
Alpha_context.context ->
Script_typed_ir.operation ->
('loc Alpha_context.Script.michelson_node * Alpha_context.context,
Tezos_protocol_environment_016_PtMumbai.Error_monad.error
Tezos_protocol_environment_016_PtMumbai.Error_monad.trace)
Tezos_protocol_environment_016_PtMumbai.Pervasives.resultunparse_operation ~loc ctxt op returns the Micheline representation of op and consumes gas from ctxt. Useful only for producing execution traces in the interpreter.
val unparse_with_data_encoding :
loc:'loc ->
Alpha_context.context ->
'a ->
Alpha_context.Gas.cost ->
'a Tezos_protocol_environment_016_PtMumbai.Data_encoding.t ->
('loc Alpha_context.Script.michelson_node * Alpha_context.context,
Tezos_protocol_environment_016_PtMumbai.Error_monad.error
Tezos_protocol_environment_016_PtMumbai.Error_monad.trace)
Tezos_protocol_environment_016_PtMumbai.Pervasives.result
Tezos_protocol_environment_016_PtMumbai.Lwt.tunparse_with_data_encoding ~loc ctxt v gas_cost enc returns the bytes representation of v wrapped in Micheline.Bytes, consuming gas_cost from ctxt.
val unparse_comparable_data :
Alpha_context.context ->
unparsing_mode ->
'a Script_typed_ir.comparable_ty ->
'a ->
(Alpha_context.Script.expr * Alpha_context.context)
Tezos_protocol_environment_016_PtMumbai.Error_monad.tzresult
Tezos_protocol_environment_016_PtMumbai.Lwt.tunparse_comparable_data ctxt unparsing_mode ty v returns the Micheline representation of v of type ty, consuming gas from ctxt.
val unparse_contract :
loc:'loc ->
Alpha_context.context ->
unparsing_mode ->
'b Script_typed_ir.typed_contract ->
('loc Alpha_context.Script.michelson_node * Alpha_context.context,
Tezos_protocol_environment_016_PtMumbai.Error_monad.error
Tezos_protocol_environment_016_PtMumbai.Error_monad.trace)
Tezos_protocol_environment_016_PtMumbai.Pervasives.resultunparse_contract ~loc ctxt unparsin_mode contract returns a Micheline representation of a given contract in a given unparsing_mode. Consumes gas ctxt.
Lambdas are normalized at parsing and also at unparsing. These normalizations require to parse and unparse data appearing inside PUSH and introduces a mutual dependency between this module and Script_ir_translator which is resolved as follows:
Script_ir_translator.parse_datatakes the normalization functionunparse_code_recas argument,- the unparsing function
unparse_data_recand the normalization functionunparse_code_recare mutually defined in a functor parameterized by the missing bits fromScript_ir_translator; see the module signatureMICHELSON_PARSERbelow.
type unparse_code_rec =
Alpha_context.context ->
stack_depth:int ->
unparsing_mode ->
Alpha_context.Script.node ->
(Alpha_context.Script.node * Alpha_context.context)
Tezos_protocol_environment_016_PtMumbai.Error_monad.tzresult
Tezos_protocol_environment_016_PtMumbai.Lwt.tThe unparse_code_rec function is not exported (except through the Internal_for_benchmarking module), but needs to be called by parse_data to normalize lambdas so it is passed as argument to the parse_data of the MICHELSON_PARSER signature below and to several functions of Script_ir_translator. To avoid repeating the signature of this function we define a type alias for it.
MICHELSON_PARSER signature describes a set of dependencies required to unparse arbitrary values in the IR. Because some of those values contain just a Michelson code that does not need to be parsed immediately, unparsing them requires extracting information from that code – that's why we depend on the parser here.