Evm_node_lib_dev_encoding.Rlp
A simple RLP encoding library, see https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ for the specification.
An RLP value is either a bytes value, or a list of RLP values.
encode_int i
encodes an integer in big endian in its smallest representation.
encode_z z
encodes a big integer in big endian in its smallest representation.
val encode : item -> bytes
encode item
takes an RLP item
and returns its encoded form.
val decode_int : bytes -> int Mavryk_base.TzPervasives.tzresult
decode_int bytes
decodes an integer encoded in big endian from the given bytes
. Returns an Rlp_decoding_error
if the bytes is not a valid RLP encoded integer.
val decode_z : bytes -> Z.t Mavryk_base.TzPervasives.tzresult
decode_z bytes
decodes a big integer encoded in big endian from the given bytes
. Returns an Rlp_decoding_error
if the bytes is not a valid RLP encoded big integer.
val decode : bytes -> item Mavryk_base.TzPervasives.tzresult
decode bytes
decodes an RLP value from the given bytes
. Returns an Rlp_decoding_error
if the bytes is not an RLP encoded value.
val decode_exn : bytes -> item
decode_exn bytes
calls decode
and raises Invalid_argument
if it fails to decode.
val decode_option :
(item -> 'a Mavryk_base.TzPervasives.tzresult) ->
item ->
'a option Mavryk_base.TzPervasives.tzresult
decode_option decode_value optional_value
decodes the option following Rust's RLP encoding.
val decode_result :
(item -> 'a Mavryk_base.TzPervasives.tzresult) ->
(item -> 'b Mavryk_base.TzPervasives.tzresult) ->
item ->
('a, 'b) Stdlib.result Mavryk_base.TzPervasives.tzresult
decode_result decode_ok decode_error value
decodes an encoded result type.
val pp : Stdlib.Format.formatter -> item -> unit
pp ppf item
pretty-prints an item.