Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dot/parachain): implement constructAvailabilityBitfield() #4414

Open
1 task
Tracked by #3605
haikoschol opened this issue Dec 17, 2024 · 0 comments
Open
1 task
Tracked by #3605

feat(dot/parachain): implement constructAvailabilityBitfield() #4414

haikoschol opened this issue Dec 17, 2024 · 0 comments
Labels
C-simple Minor changes changes, no additional research needed. Good first issue/review. S-subsystems-availability issues related to polkadot host availability subsystem functionality. T-implementation this issue/pr is a new feature or functionality.

Comments

@haikoschol
Copy link
Contributor

haikoschol commented Dec 17, 2024

Issue summary

The creation of availability bitfields involves querying the runtime and the availability store. The result is an availability bitfield with no signature attached.

Implementation details

type availabilityBitfield []bool

func constructAvailabilityBitfield(
    ctx context.Context,
    relayParent common.Hash,
    validatorIdx parachaintypes.ValidatorIndex,
    response chan<- availabilityBitfield,
) { ... }

The signing task receives as inputs a context for cancellation, a relay parent hash, the validator index of the node and a channel on which to send the result. It needs to perform the following steps:

  1. Query the set of availability cores for the given leaf from the runtime.

This is done by calling the runtime function ParachainHostAvailabilityCores(). The index of each CoreState element in the returned slice maps to the index in the bitfield.

  1. For each CoreState retrieved in step 1:

If the value of CoreState is not of type parachaintypes.OccupiedCore, set the associated index in the bitfield to false.

If the value of CoreState is of type parachaintypes.OccupiedCore, send a QueryChunkAvailability message to the availability store, via the overseer. In the message, pass the candidate hash from OccupiedCore, the validator index and a channel for receiving the result. Make sure to maintain the correct indices to set in the bitfield when receiving the result. Ideally, perform this query and receipt of the results concurrently for all occupied cores.

  1. After chunk availability has been determined for all cores and the bitfield set accordingly, send it over the channel passed into constructAvailabilityBitfield().

Other information and links

Acceptance criteria

  • New code is 60% covered with unit tests
@haikoschol haikoschol added C-simple Minor changes changes, no additional research needed. Good first issue/review. S-subsystems-availability issues related to polkadot host availability subsystem functionality. T-implementation this issue/pr is a new feature or functionality. labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-simple Minor changes changes, no additional research needed. Good first issue/review. S-subsystems-availability issues related to polkadot host availability subsystem functionality. T-implementation this issue/pr is a new feature or functionality.
Projects
None yet
Development

No branches or pull requests

1 participant