Module sc_consensus_subspace::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§

  • Information about new slot that just arrived
  • New slot notification with slot information and sender for solution for the slot.
  • Notification with a hash that needs to be signed to receive reward and sender for signature.
  • Subspace slot worker responsible for block and vote production
  • Parameters for SubspaceSlotWorker
  • Subspace sync oracle that takes into account force authoring flag, allowing to bootstrap Subspace network from scratch due to our fork of Substrate where sync state of nodes depends on connected nodes (none of which will be synced initially). It also accounts for DSN sync, when normal Substrate sync is paused, which might happen before Substrate’s internals decide there is a sync happening, but DSN sync is already in progress.