package octez-shell-libs
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/octez-shell-libs.shell/Tezos_shell/Block_validator/index.html
Module Tezos_shell.Block_validatorSource
This module is the main entry point to valide blocks and protocols.
type new_block = {block : Tezos_store.Store.Block.t;(*The block itself.
*)resulting_context_hash : Tezos_base.TzPervasives.Context_hash.t;(*The context hash resulting of
block's application.It may be the same one as contained in its header depending on the protocol expected semantics.
*)
}Type of a validated block
val create :
Tezos_shell_services.Shell_limits.block_validator_limits ->
Distributed_db.t ->
Block_validator_process.t ->
start_testchain:bool ->
t Lwt.tcreate limits ddb bvp start_testchain creates a Block_validator.
limitscontains varioustimeoutlimits.
ddbis used to commit a block on the storage and get the state of the chain for which the block is submitted to validation.
bvpis an instance of theBlock_validator_process.bvpis a proxy between the shell and the validation part related to the economic protocol (SeeBlock_validator_process).
start_testchainif set to true allows to run thetestchain.
This function is not supposed to fail. It is implemented this way because of the interface implemented by the Worker module.
type block_validity = | Valid| Invalid_after_precheck of Tezos_base.TzPervasives.error Tezos_base.TzPervasives.trace| Invalid of Tezos_base.TzPervasives.error Tezos_base.TzPervasives.trace
val validate :
t ->
?canceler:Lwt_canceler.t ->
?peer:Tezos_base.P2p_peer.Id.t ->
?notify_new_block:(new_block -> unit) ->
?precheck_and_notify:bool ->
Distributed_db.chain_db ->
Tezos_base.TzPervasives.Block_hash.t ->
Tezos_base.Block_header.t ->
Tezos_base.Operation.t list list ->
block_validity Lwt.tvalidate ?precheck_and_notify validator ddb hash header ops validates a block header ops of hash hash. It is a no-op in the following cases:
- If the block has already been validated.
- If the block level is before the
savepoint
Otherwise it calls the Block_validator_process process associated to the current validator.
canceleris trigerred when the validation of a block fails.
peeris the peer which sent the block.
If the validation succeeded it processes as follows:
1. The ddb commits the block on the storage.
2. If the next block requires a switch of protocol, it tries to fetch and precompile the next protocol.
3. Call notify_new_block with the committed block.
An error is raised if the validation failed or if the block was already known as invalid. However, if the first validation attempt failed because the protocol was missing, it tries to fetch and download the protocol before trying to validate the block a second time.
val preapply :
t ->
?canceler:Lwt_canceler.t ->
Tezos_store.Store.chain_store ->
predecessor:Tezos_store.Store.Block.t ->
timestamp:Tezos_base.Time.Protocol.t ->
protocol_data:bytes ->
Tezos_base.Operation.t list list ->
(Tezos_base.Block_header.shell_header
* Tezos_base.TzPervasives.error Tezos_shell_services.Preapply_result.t
Tezos_base.TzPervasives.trace)
Tezos_base.TzPervasives.tzresult
Lwt.tpreapply validator canceler chains_store predecessor timestamp protocol_data operations creates a new block and returns it. It may call the Block_validator_process process associated to the current validator. If the preapply is a succeeded, the application resulted is cached to avoid re-apply the block if the next call block validation, through validate, targets the same block.
An error is raised if the pre-apply failed. However, if the first pre-apply attempt failed because the protocol was missing, it tries to fetch and download the protocol before trying to pre-apply the block a second time.
val fetch_and_compile_protocol :
t ->
?peer:Tezos_base.P2p_peer.Id.t ->
?timeout:Tezos_base.Time.System.Span.t ->
Tezos_base.TzPervasives.Protocol_hash.t ->
Tezos_protocol_updater.Registered_protocol.t Tezos_base.TzPervasives.tzresult
Lwt.tval context_garbage_collection :
t ->
Tezos_context_ops.Context_ops.index ->
Tezos_base.TzPervasives.Context_hash.t ->
gc_lockfile_path:string ->
unit Tezos_base.TzPervasives.tzresult Lwt.tcontext_garbage_collection bv index chain_store context_hash ~gc_lockfile_path moves the contexts below the give context_hash from the upper layer to the lower layer. For full and rolling nodes, this is considered as a garbage collection. When a garbage collection occurs in another process, a lock, located at gc_lockfile_path, is taken to ensure synchronous GC calls.
val context_split :
t ->
Tezos_context_ops.Context_ops.index ->
unit Tezos_base.TzPervasives.tzresult Lwt.tcontext_split bv index finishes and then starts a new chunk in the context storage layout. This aims to be called at the dawn of each cycle, to improve the disk footprint when running a garbage collection.
val pending_requests :
t ->
(Tezos_base.Time.System.t
* Tezos_shell_services.Block_validator_worker_state.Request.view)
listval current_request :
t ->
(Tezos_base.Time.System.t
* Tezos_base.Time.System.t
* Tezos_shell_services.Block_validator_worker_state.Request.view)
option