fix: correctly count chunk produced #2535
Merged
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.
The current way of counting expected number of chunks for a chunk producer is flawed. While I took into consideration that when a block is not produced, not chunk can be included in that block, I failed to realize that if block at height
h
is not produced, chunks at heighth
can be included in blockh+1
, if it is produced. Therefore, what we really need to count when processing a block is whether chunk producers for heightprev_block_height + 1
produced their chunks. Resolves #2534.Test plan
test_expected_chunks_prev_block_not_produced
that tests when a chunk producer failed to produce a chunk due to the block at previous height not being produced, it does not get kicked out.