package octez-protocol-019-PtParisB-libs

  1. Overview
  2. Docs
Octez protocol 019-PtParisB libraries

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/octez-protocol-019-PtParisB-libs.baking/Tezos_baking_019_PtParisB/Forge_worker/index.html

Module Tezos_baking_019_PtParisB.Forge_workerSource

Concurrent worker for consensus operations and block forging

Description

This component allows the concurrent production of consensus operations and blocks. It's meant to be used by pushing specific requests as tasks and waiting for their completions on a dedicated event stream.

Block forging implies the retrieval of current operations and context validation (and application if needed) and then producing a signature. For consensus operations, the heavy work is mostly on producing a signature. Signatures are expected to be concurrent in order not to block the main execution thread.

Concurrency

Each task is associated to a delegate. This worker is designed to work concurrently on each delegate's tasks. However, if a request is pushed for a delegate while an existing one is active, this new request will be enqueued and only be executed after the completion of the first one. Hence, only one request may be active per delegate at any time.

Cancellation

It is possible to cancel all pending tasks but it is not possible to cancel each delegate's active tasks. This is explained by the fact that we do not have control over the different signers scheme and, in particular, some are not cancellable at all (e.g., ledger).

Sourcetype worker

Worker type

Sourcetype t = worker
Sourceval push_request : worker -> Baking_state.forge_request -> unit

push_request worker request pushes the request to the worker to be treated. Each forge_request is associated to a specific delegate. The request will be treated whenever the delegate's associated queue is available. If, the delegate's queue did not previously exist, it will be created.

Sourceval get_event_stream : worker -> Baking_state.forge_event Lwt_stream.t

get_event_stream worker returns the worker's stream of events onto which tasks completion results are pushed.

Sourceval cancel_all_pending_tasks : worker -> unit

cancel_all_pending_tasks worker cancels all the worker's delegate queues pending tasks.

Sourceval shutdown : worker -> unit Lwt.t

shutdown worker triggers the worker shutdown. This function cancels all pending tasks but still waits for each active one to complete.

start global_state creates and runs a worker based on a baker's global_state.

OCaml

Innovation. Community. Security.