Crate polkadot_node_subsystem_util

Source
Expand description

Utility module for subsystems

Many subsystems have common interests such as canceling a bunch of spawned jobs, or determining what their validator ID is. These common interests are factored into this module.

This crate also reexports Prometheus metric types which are expected to be implemented by subsystems.

Re-exports§

pub use rand;
pub use metered;

Modules§

availability_chunks
Helpers for the validator->chunk index mapping.
backing_implicit_view
A utility for managing the implicit view of the relay-chain derived from active leaves and the minimum allowed relay-parents that parachain candidates can have and be backed in those leaves’ children.
database
Database trait for subsystem. Database trait for polkadot db.
inclusion_emulator
An emulator for node-side code to predict the results of on-chain parachain inclusion and predict future constraints.
metrics
This module reexports Prometheus types and defines the Metrics trait.
nesting_sender
Nested message sending
reexports
These reexports are required so that external crates can use the delegated_subsystem macro properly.
reputation
A utility abstraction to collect and send reputation changes.
runtime
Convenient and efficient runtime info access. Convenient interface to runtime information.
vstaging
Helpers for working with unreleased runtime calls Contains helpers for staging runtime calls.

Structs§

Metronome
Create a stream of ticks with a defined cycle duration.
Timeout
A future that wraps another future with a Delay allowing for time-limited futures.
Validator
Local validator information

Enums§

Error
Utility errors
OverseerError
An error type that describes faults that may happen

Constants§

JOB_CHANNEL_CAPACITY
Capacity of channels to and from individual jobs
JOB_GRACEFUL_STOP_DURATION
Duration a job will wait after sending a stop signal before hard-aborting.
MIN_GOSSIP_PEERS
The minimum amount of peers to send gossip messages to.

Traits§

Subsystem
A trait that describes the Subsystems that can run on the Orchestra.
TimeoutExt
Extends Future to allow time-limited futures.

Functions§

choose_random_subset
Choose a random subset of min elements. But always include is_priority elements.
choose_random_subset_with_rng
Choose a random subset of min elements using a specific Random Generator Rng But always include is_priority elements.
determine_new_blocks
Given a new chain-head hash, this determines the hashes of all new blocks we should track metadata for, given this head.
executor_params_at_relay_parent
Requests executor parameters from the runtime effective at given relay-parent. First obtains session index at the relay-parent, relying on the fact that it should be cached by the runtime API caching layer even if the block itself has already been pruned. Then requests executor parameters by session index. Returns an error if failed to communicate to the runtime, or the parameters are not in the storage, which should never happen. Returns default execution parameters if the runtime doesn’t yet support SessionExecutorParams API call. Otherwise, returns execution parameters returned by the runtime.
find_validator_group
Find the validator group the given validator index belongs to.
gen_ratio
Returns a bool with a probability of a / b of being true.
gen_ratio_rng
Returns a bool with a probability of a / b of being true.
has_required_runtime
Verifies if ParachainHost runtime api is at least at version required_runtime_version. This method is used to determine if a given runtime call is supported by the runtime.
request_assumed_validation_data
Request AssumedValidationData from the runtime
request_async_backing_params
Request AsyncBackingParams from the runtime
request_authorities
Request Authorities from the runtime
request_availability_cores
Request AvailabilityCores from the runtime
request_backing_constraints
Request BackingConstraints from the runtime
request_candidate_events
Request CandidateEvents from the runtime
request_candidate_pending_availability
Request CandidatePendingAvailability from the runtime
request_candidates_pending_availability
Request CandidatesPendingAvailability from the runtime
request_claim_queue
Request ClaimQueue from the runtime
request_disabled_validators
Request DisabledValidators from the runtime
request_from_runtime
Request some data from the RuntimeApi.
request_key_ownership_proof
Request KeyOwnershipProof from the runtime
request_min_backing_votes
Request MinimumBackingVotes from the runtime
request_node_features
Request NodeFeatures from the runtime
request_on_chain_votes
Request FetchOnChainVotes from the runtime
request_para_backing_state
Request ParaBackingState from the runtime
request_persisted_validation_data
Request PersistedValidationData from the runtime
request_runtime_api_version
Request Version from the runtime
request_session_executor_params
Request SessionExecutorParams from the runtime
request_session_index_for_child
Request SessionIndexForChild from the runtime
request_session_info
Request SessionInfo from the runtime
request_submit_report_dispute_lost
Request SubmitReportDisputeLost from the runtime
request_unapplied_slashes
Request UnappliedSlashes from the runtime
request_validation_code
Request ValidationCode from the runtime
request_validation_code_by_hash
Request ValidationCodeByHash from the runtime
request_validation_code_hash
Request ValidationCodeHash from the runtime
request_validator_groups
Request ValidatorGroups from the runtime
request_validators
Request Validators from the runtime
sign
Sign the given data with the given validator ID.
signing_key
From the given set of validators, find the first key we can sign with, if any.
signing_key_and_index
From the given set of validators, find the first key we can sign with, if any, and return it along with the validator index.

Type Aliases§

RuntimeApiReceiver
A type alias for Runtime API receivers.