Fix bitfield signing (#1466)

* Apply suggestions from #1364 code review

- use CoreState, not CoreOccupied
- query for availability chunks, not the whole PoV
- create a stub `fn availability_cores`

* link to issue documenting unimplemented

* implement get_availability_cores by adding a new runtime api request

* back out an unrelated change properly part of #1404

* av-store: handle QueryChunkAvailability

* simplify QueryDataAvailability

* remove extraneous whitespace

* compact primitive imports
This commit is contained in:
Peter Goodspeed-Niklaus
2020-07-30 00:33:06 +02:00
committed by GitHub
parent 756f95c407
commit 4b2cb04e56
3 changed files with 62 additions and 46 deletions
+6 -8
View File
@@ -149,16 +149,14 @@ fn process_message(db: &Arc<dyn KeyValueDB>, msg: AvailabilityStoreMessage) -> R
tx.send(available_data(db, &hash).map(|d| d.data)).map_err(|_| oneshot::Canceled)?;
}
QueryDataAvailability(hash, tx) => {
let result = match available_data(db, &hash) {
Some(_) => true,
None => false,
};
tx.send(result).map_err(|_| oneshot::Canceled)?;
tx.send(available_data(db, &hash).is_some()).map_err(|_| oneshot::Canceled)?;
}
QueryChunk(hash, id, tx) => {
tx.send(get_chunk(db, &hash, id)?).map_err(|_| oneshot::Canceled)?;
}
QueryChunkAvailability(hash, id, tx) => {
tx.send(get_chunk(db, &hash, id)?.is_some()).map_err(|_| oneshot::Canceled)?;
}
StoreChunk(hash, id, chunk, tx) => {
match store_chunk(db, &hash, id, chunk) {
Err(e) => {
@@ -394,7 +392,7 @@ mod tests {
let chunk_msg = AvailabilityStoreMessage::StoreChunk(
relay_parent,
validator_index,
validator_index,
chunk.clone(),
tx,
);
@@ -436,7 +434,7 @@ mod tests {
global_validation,
local_validation,
};
let available_data = AvailableData {
pov,
omitted_validation,