Mavryk_shell.Block_validator_process
Block_validator_process is used to validate new blocks. This validation can be
Block_validation:check_liveness
).type validator_environment = {
user_activated_upgrades : Mavryk_base.User_activated.upgrades;
user activated upgrades
*)user_activated_protocol_overrides : Mavryk_base.User_activated.protocol_overrides;
user activated protocol overrides
*)operation_metadata_size_limit : Mavryk_shell_services.Shell_limits.operation_metadata_size_limit;
size limit for operation metadata that should be written on disk
*)}
type validator_kind =
| Internal : validator_environment
* Mavryk_store.Store.Chain.chain_store -> validator_kind
| External : {
parameters : Mavryk_validation.External_validation.parameters;
process_path : string;
} -> validator_kind
For performances reasons, it may be interesting to use another processus (from the OS) to validate blocks (External). However, in that case, only one processus has a write access to the context. Currently informations are exchanged via the file system.
val init : validator_kind -> t Mavryk_base.TzPervasives.tzresult Lwt.t
val kind : t -> simple_kind
val close : t -> unit Lwt.t
close vp
closes the given vp
. In the case of an External
validator process, we first ask the validator to shutdown. If it is still running after 5 seconds, we notice that the block validation process is unresponsive and we force its termination (using a registered Lwt_exit.clean_up_callback).
val reconfigure_event_logging :
t ->
Mavryk_base_unix.Internal_event_unix.Configuration.t ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
val apply_block :
?simulate:bool ->
?should_precheck:bool ->
t ->
Mavryk_store.Store.chain_store ->
predecessor:Mavryk_store.Store.Block.t ->
Mavryk_base.Block_header.t ->
Mavryk_validation.Block_validation.operation list list ->
Mavryk_validation.Block_validation.result Mavryk_base.TzPervasives.tzresult
Lwt.t
apply_block bvp predecessor header ops
checks the liveness of the operations and then call Block_validation.apply
should_precheck
when set, triggers the block prechecking before applying it, see Block_validation.apply
.
If simulate
is true, the context resulting from the application will not be committed to disk. Set to false by default.
val preapply_block :
t ->
Mavryk_store.Store.chain_store ->
predecessor:Mavryk_store.Store.Block.t ->
protocol_data:bytes ->
timestamp:Mavryk_base.Time.Protocol.t ->
Mavryk_validation.Block_validation.operation list list ->
(Mavryk_base.Block_header.shell_header
* Mavryk_base.TzPervasives.error Mavryk_shell_services.Preapply_result.t
list)
Mavryk_base.TzPervasives.tzresult
Lwt.t
preapply_block bvp chain_store ~predecessor ~protocol_data ~timestamp ops
is a wrapper for Block_validation.preapply
.
val precheck_block :
t ->
Mavryk_store.Store.chain_store ->
predecessor:Mavryk_store.Store.Block.t ->
Mavryk_base.Block_header.t ->
Mavryk_base.TzPervasives.Block_hash.t ->
Mavryk_validation.Block_validation.operation Mavryk_base.TzPervasives.trace
Mavryk_base.TzPervasives.trace ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
precheck_block bvp chain_store ~predecessor header hash ops
is a wrapper for Block_validation.precheck
.
val context_garbage_collection :
t ->
Mavryk_context_ops.Context_ops.index ->
Mavryk_base.TzPervasives.Context_hash.t ->
gc_lockfile_path:string ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
context_garbage_collection bvp context_index context_hash
removes contexts that are below context_hash
in the context tree.
val context_split :
t ->
Mavryk_context_ops.Context_ops.index ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
context_split bvp context_index
splits the context storage layout into a new chunk.
val commit_genesis :
t ->
chain_id:Mavryk_base.TzPervasives.Chain_id.t ->
Mavryk_base.TzPervasives.Context_hash.t Mavryk_base.TzPervasives.tzresult
Lwt.t
val init_test_chain :
t ->
Mavryk_base.TzPervasives.Chain_id.t ->
Mavryk_store.Store.Block.t ->
Mavryk_base.Block_header.t Mavryk_base.TzPervasives.tzresult Lwt.t
init_test_chain
must only be called on a forking block.