Module Evm_node_lib_dev.Prevalidator

type Tezos_base.TzPervasives.error +=
  1. | Gas_limit_too_low of {
    1. gas_limit : Z.t;
    2. minimum_gas_limit_required : Z.t;
    }
  2. | Prague_not_enabled
type mode =
  1. | Minimal
    (*

    Minimal validation, includes:

    • chain id is valid
    • nonce is superior to current one
    • sender is an EOA
    • transaction data is not too large
    • gas limit is valid with minimum gas price
    *)
  2. | Full
    (*

    Full validation, is minimal validation plus:

    • balance is enough
    • max_fee_per_gas is inferior to current gas price
    *)
type prevalidation_result = {
  1. next_nonce : Evm_node_lib_dev_encoding.Ethereum_types.quantity;
    (*

    The next nonce expected for the given caller, which is lesser than or equal to the nonce of the prevalidated transaction.

    *)
  2. transaction_object : Evm_node_lib_dev_encoding.Ethereum_types.legacy_transaction_object;
    (*

    Decoded informations about the prevalidated transaction.

    *)
}
val start : ?max_number_of_chunks:int -> chain_family:'a Evm_node_lib_dev_encoding.L2_types.chain_family -> mode -> (module Services_backend_sig.S with type Reader.state = 'state) -> unit Tezos_base.TzPervasives.tzresult Lwt.t

start ~chain_family mode backend will attempt to start the worker.

  • parameter chain_family

    is not EVM, this operation is a no-op.

  • parameter backend

    is being used to fetch the most recent state of the chain, and to read key parameters from it.

  • parameter max_number_of_chunks

    can be optionally provided to limit the size of transactions accepted by the prevalidator. This is typically done by the sequencer mode of the node based on its configuration.

val prevalidate_raw_transaction : string -> (prevalidation_result, string) Stdlib.result Tezos_base.TzPervasives.tzresult Lwt.t

prevalidate_raw_transaction raw_txn sends a prevalidation request to the worker, and waits for the result.

If the worker failed to start, a new initialization attempt will be performed.

val refresh_state : unit -> unit Tezos_base.TzPervasives.tzresult Lwt.t

refresh_state () sends a refresh request to the worker, to be processed in the background.

If the worker failed to start, a new initialization attempt will be performed.

type validation_state = {
  1. config : validation_config;
  2. addr_balance : Z.t Tezos_base.TzPervasives.String.Map.t;
  3. addr_nonce : Z.t Tezos_base.TzPervasives.String.Map.t;
}