Module slot_worker

Source
Expand description

Slot worker drives block and vote production based on slots produced in [sc_proof_of_time].

While slot worker uses [sc_consensus_slots], it is not driven by time, but instead by Proof of Time that is produced by PotSourceWorker.

Each time a new proof is found, [PotSlotWorker::on_proof] is called and corresponding [SlotInfo] notification is sent (SubspaceLink::new_slot_notification_stream) to farmers to do the audit and try to prove they have a solution without actually waiting for the response. ChainConstants::block_authoring_delay slots later (when corresponding future proof arrives) all the solutions produced by farmers so far are collected and corresponding block and/or votes are produced. In case PoT chain reorg happens, outdated solutions (they are tied to proofs of time) are thrown away.

Custom SubspaceSyncOracle wrapper is introduced due to Subspace-specific changes comparing to the base Substrate behavior where major syncing is assumed to not happen in case authoring is forced.

Structsยง

NewSlotInfo
Information about new slot that just arrived
NewSlotNotification
New slot notification with slot information and sender for solution for the slot.
RewardSigningNotification
Notification with a hash that needs to be signed to receive reward and sender for signature.
SubspaceSlotWorker
Subspace slot worker responsible for block and vote production
SubspaceSlotWorkerOptions
Parameters for SubspaceSlotWorker
SubspaceSyncOracle
Subspace sync oracle.