ExPlasma.Utils.RlpDecoder (ExPlasma v0.3.0)

Provides functions to decode various data types from RLP raw format

Link to this section Summary

Functions

Attempt to decode the given binary to a list of RLP items

Parses 20-bytes address Case <<>> is necessary, because RLP handles empty string equally to integer 0

Parses unsigned at-most 32-bytes integer. Leading zeros are disallowed

Parses unsigned at-most 32-bytes integer. Leading zeros are allowed

Link to this section Types

Link to this type

parse_uint256_errors()

Specs

parse_uint256_errors() :: :encoded_uint_too_big | :malformed_uint256

Link to this section Functions

Link to this function

decode(tx_bytes)

Specs

decode(binary()) :: {:ok, list()} | {:error, :malformed_rlp}

Attempt to decode the given binary to a list of RLP items

Link to this function

parse_address(binary)

Specs

parse_address(<<_::0>> | ExPlasma.Crypto.address_t()) ::
  {:ok, ExPlasma.Crypto.address_t()} | {:error, :malformed_address}

Parses 20-bytes address Case <<>> is necessary, because RLP handles empty string equally to integer 0

Link to this function

parse_uint256(binary)

Specs

parse_uint256(binary()) ::
  {:ok, non_neg_integer()}
  | {:error, parse_uint256_errors() | :leading_zeros_in_encoded_uint}

Parses unsigned at-most 32-bytes integer. Leading zeros are disallowed

Link to this function

parse_uint256_with_leading(binary)

Specs

parse_uint256_with_leading(binary()) ::
  {:ok, non_neg_integer()} | {:error, parse_uint256_errors()}

Parses unsigned at-most 32-bytes integer. Leading zeros are allowed