In combination with validity sync issues, we saw state sync getting stuck.
This could happen if we synced all chunks (end_key = None) and subsequently paused state sync but then failed to apply the last chunk.
This PR addresses the issue in two ways:
Store the block number at which the last chunk should be applied. If we pass it and are not complete, unpause the state sync.
If a chunk was still buffered from before a reset, a new duplicate chunk with the same start key would be discarded – resulting in an unordered list of chunks that eventually will fail to apply. We thus replace the duplicate check by a check that the buffer is ordered. It it isn't, we discard old entries in favour of new ones.
Pull request checklist
[x] All tests pass. The project builds and runs.
[x] I have resolved any merge conflicts.
[x] I have resolved all clippy and rustfmt warnings.
What's in this pull request?
In combination with validity sync issues, we saw state sync getting stuck. This could happen if we synced all chunks (
end_key = None
) and subsequently paused state sync but then failed to apply the last chunk.This PR addresses the issue in two ways:
Pull request checklist
clippy
andrustfmt
warnings.