Fix future-polling loop in availability and add a better early-exit (#2779)

* onto the front

* fix early exit for waiting for requests

* add logging back
This commit is contained in:
Robert Habermeier
2021-03-31 17:35:17 +02:00
committed by GitHub
parent bd9bdf5f5f
commit e65cad69ec
2 changed files with 26 additions and 16 deletions
@@ -133,7 +133,7 @@ Loop:
* If the phase is `InteractionPhase::RequestChunks`:
* If `received_chunks + requesting_chunks + shuffling` lengths are less than the threshold, break and return `Err(Unavailable)`.
* Poll for new updates from `requesting_chunks`. Check merkle proofs of any received chunks. If the request simply fails due to network issues, push onto the back of `shuffling` to be retried.
* Poll for new updates from `requesting_chunks`. Check merkle proofs of any received chunks. If the request simply fails due to network issues, insert into the front of `shuffling` to be retried.
* If `received_chunks` has more than `threshold` entries, attempt to recover the data. If that fails, or a re-encoding produces an incorrect erasure-root, break and issue a `Err(RecoveryError::Invalid)`. If correct, break and issue `Ok(available_data)`.
* While there are fewer than `N_PARALLEL` entries in `requesting_chunks`,
* Pop the next item from `shuffling`. If it's empty and `requesting_chunks` is empty, return `Err(RecoveryError::Unavailable)`.