feat: add support for validating multiple content items #1868
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was wrong?
When we are offered multiple content, the overlay service does all of the following on per-content basis:
This doesn't work for EphemeralHeaders, which we have to process together (at least checking which content to accept and validating). This PR adds support for that.
How was it fixed?
Added
should_we_store_batch
function that checks whether multiple content items should be stored.Refactored Validator trait in the following ways:
additional_content_to_propagate
from ValidationResult (it's not used)Invalid(String)
variant into more descriptive type, e.g.Invalid(ValidationFailureReason)
where:Refactored
OverlayService::handle_offer
to use these functions insteadRemaining work
We would still do a fallback fetching in request fails or content is not validated.
I would have to think more whether this is desired for EphemeralContent, and if not, how exactly to distinguish/handle this case. This is something that I plan to do in a followup PR.
Modify history Store and Validator to actually implement custom logic for handling multiple content items (also in the followup PR).