* Guide: Reindent the router module with 4 spaces The guide used to use 2 spaces for indentation. The problem with that is `mdbook` doesn't recognize them as a proper indentation and thus doesn't render indent properly. A couple of things are not indented here because they will be changed in the following commits * Guide: a bunch of fixes
2.2 KiB
InclusionInherent
This module is responsible for all the logic carried by the Inclusion entry-point. This entry-point is mandatory, in that it must be invoked exactly once within every block, and it is also "inherent", in that it is provided with no origin by the block author. The data within it carries its own authentication. If any of the steps within fails, the entry-point is considered as having failed and the block will be invalid.
This module does not have the same initialization/finalization concerns as the others, as it only requires that entry points be triggered after all modules have initialized and that finalization happens after entry points are triggered. Both of these are assumptions we have already made about the runtime's order of operations, so this module doesn't need to be initialized or finalized by the Initializer.
Storage
Included: Option<()>,
Finalization
- Take (get and clear) the value of
Included. If it is notSome, throw an unrecoverable error.
Entry Points
inclusion: This entry-point accepts two parameters:BitfieldsandBackedCandidates.- The
Bitfieldsare first forwarded to theInclusion::process_bitfieldsroutine, returning a set of freed cores. Provide aScheduler::core_paraas a core-lookup to theprocess_bitfieldsroutine. Annotate each of these freed cores withFreedReason::Concluded. - If
Scheduler::availability_timeout_predicateisSome, invokeInclusion::collect_pendingusing it, and add timed-out cores to the free cores, annotated withFreedReason::TimedOut. - Invoke
Scheduler::schedule(freed) - Invoke the
Inclusion::process_candidatesroutine with the parameters(backed_candidates, Scheduler::scheduled(), Scheduler::group_validators). - Call
Scheduler::occupiedusing the return value of theInclusion::process_candidatescall above, first sorting the list of assigned core indices. - Call the
Router::process_pending_upward_dispatchablesroutine to execute all messages in upward dispatch queues. - If all of the above succeeds, set
IncludedtoSome(()).
- The