Files
pezkuwi-subxt/polkadot/roadmap/implementers-guide/src/node/availability/bitfield-signing.md
T
Peter Goodspeed-Niklaus ba4bfa4dd0 implement bitfield signing subsystem (#1364)
* update guide to reduce confusion and TODOs

* work from previous bitfield signing effort

There were large merge issues with the old bitfield signing PR, so
we're just copying all the work from that onto this and restarting.

Much of the existing work will be discarded because we now have better
tools available, but that's fine.

* start rewriting bitfield signing in terms of the util module

* implement construct_availability_bitvec

It's not an ideal implementation--we can make it much more concurrent--
but at least it compiles.

* implement the unimplemented portions of bitfield signing

* get core availability concurrently, not sequentially

* use sp-std instead of std for a parachain item

* resolve type inference failure caused by multiple From impls

* handle bitfield signing subsystem & Allmessages variant in overseer

* fix more multi-From inference issues

* more concisely handle overflow

Co-authored-by: Andronik Ordian <write@reusable.software>

* Revert "resolve type inference failure caused by multiple From impls"

This reverts commit 7fc77805de5e5074a1b01037f8d4e3919e03e0e1.

* Revert "fix more multi-From inference issues"

This reverts commit f14ffe589e20d664d8a900ed62f68b6fb844a514.

* impl From<i32> for ParaId

* handle another instance of AllSubsystems

* improve consistency when returning existing options

Co-authored-by: Andronik Ordian <write@reusable.software>
2020-07-23 16:05:48 +02:00

1.5 KiB

Bitfield Signing

Validators vote on the availability of a backed candidate by issuing signed bitfields, where each bit corresponds to a single candidate. These bitfields can be used to compactly determine which backed candidates are available or not based on a 2/3+ quorum.

Protocol

Input:

There is no dedicated input mechanism for bitfield signing. Instead, Bitfield Signing produces a bitfield representing the current state of availability on StartWork.

Output:

  • BitfieldDistribution::DistributeBitfield: distribute a locally signed bitfield
  • AvailabilityStore::QueryChunk(CandidateHash, validator_index, response_channel)

Functionality

Upon receipt of an ActiveLeavesUpdate, launch bitfield signing job for each activated head. Stop the job for each deactivated head.

Bitfield Signing Job

Localized to a specific relay-parent r If not running as a validator, do nothing.

  • Begin by waiting a fixed period of time so availability distribution has the chance to make candidates available.
  • Determine our validator index i, the set of backed candidates pending availability in r, and which bit of the bitfield each corresponds to.
  • Start with an empty bitfield. For each bit in the bitfield, if there is a candidate pending availability, query the Availability Store for whether we have the availability chunk for our validator index.
  • For all chunks we have, set the corresponding bit in the bitfield.
  • Sign the bitfield and dispatch a BitfieldDistribution::DistributeBitfield message.