* add tracing to approval voting * notify if session info is not working * add dispute period to chain specs * propagate genesis session to parachains runtime * use `on_genesis_session` * protect against zero cores in computation * tweak voting rule to be based off of best and add logs * genesis configuration should use VRF slots only * swallow more keystore errors * add some docs * make validation-worker args non-optional and update clap * better tracing for bitfield signing and provisioner * pass amount of bits in bitfields to inclusion instead of recomputing * debug -> warn for some logs * better tracing for availability recovery * a little av-store tracing * bridge: forward availability recovery messages * add missing try_from impl * some more tracing * improve approval distribution tracing * guide: hold onto pending approval messages until NewBlocks * Hold onto pending approval messages until NewBlocks * guide: adjust comment * process all actions for one wakeup at a time * vec * fix network bridge test * replace randomness-collective-flip with Babe * remove PairNotFound
4.2 KiB
ParaInherent
This module is responsible for providing all data given to the runtime by the block author to the various parachains modules. The 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; i.e. the data takes the form of signed statements by validators. 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.
There are a couple of important notes to the operations in this inherent as they relate to disputes.
- We don't accept bitfields or backed candidates if in "governance-only" mode from having a local dispute conclude on this fork.
- When disputes are initiated, we remove the block from pending availability. This allows us to roll back chains to the block before blocks are included as opposed to backing. It's important to do this before processing bitfields.
Inclusion::collect_disputedis kind of expensive so it's important to gate this on whether there are actually any new disputes. Which should be never.- And we don't accept parablocks that have open disputes or disputes that have concluded against the candidate. It's important to import dispute statements before backing, but this is already the case as disputes are imported before processing bitfields.
Storage
Included: Option<()>,
Finalization
- Take (get and clear) the value of
Included. If it is notSome, throw an unrecoverable error.
Entry Points
enter: This entry-point accepts three parameters: The relay-chain parent block header,BitfieldsandBackedCandidates.- Hash the parent header and make sure that it corresponds to the block hash of the parent (tracked by the
frame_systemFRAME module), - Invoke
Disputes::provide_multi_dispute_data. - If
Disputes::is_frozen, return and setIncludedtoSome(()). - If there are any created disputes from the current session, invoke
Inclusion::collect_disputedwith the disputed candidates. Annotate each returned core withFreedReason::Concluded. - The
Bitfieldsare first forwarded to theInclusion::process_bitfieldsroutine, returning a set of freed cores. Provide the number of availability cores (Scheduler::availability_cores().len()) as the expected number of bits and aScheduler::core_paraas a core-lookup to theprocess_bitfieldsroutine. Annotate each of these freed cores withFreedReason::Concluded. - For each freed candidate from the
Inclusion::process_bitfieldscall, invokeDisputes::note_included(current_session, candidate). - If
Scheduler::availability_timeout_predicateisSome, invokeInclusion::collect_pendingusing it and annotate each of those freed cores withFreedReason::TimedOut. - Combine and sort the dispute-freed cores, the bitfield-freed cores, and the timed-out cores.
- Invoke
Scheduler::clear - Invoke
Scheduler::schedule(freed_cores, System::current_block()) - Extract
parent_storage_rootfrom the parent header, - If
Disputes::could_be_invalid(current_session, candidate)is true for any of thebacked_candidates, fail. - Invoke the
Inclusion::process_candidatesroutine with the parameters(parent_storage_root, 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
Ump::process_pending_upward_messagesroutine to execute all messages in upward dispatch queues. - If all of the above succeeds, set
IncludedtoSome(()).
- Hash the parent header and make sure that it corresponds to the block hash of the parent (tracked by the