rpc/chainHead: Fix pruned blocks events from forks (#13379)
* rpc/chainhead: Test unpin for noncanonical prunned blocks Signed-off-by: Alexandru Vasile <[email protected]> * rpc/tests: Ensure fork is not reported by the Finalized event Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chainhead: Detect pruned forks to ignore from events Signed-off-by: Alexandru Vasile <[email protected]> * rpc/tests: Check unpin can be called on pruned hashes Signed-off-by: Alexandru Vasile <[email protected]> * Fix clippy Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Handle race with memory blocks and notifications Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Add data config for the `follow` future Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Address feedback Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Move best block cache on the data config Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Send new events from the finalized stream Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chian_head: Report all pruned blocks Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Move `chainHead_follow` logic on dedicated file Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Delegate follow logic to `chain_head_follow` Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Remove subscriptions on drop Signed-off-by: Alexandru Vasile <[email protected]> * rpc/tests: Ignore pruned blocks for a longer fork Signed-off-by: Alexandru Vasile <[email protected]> * rpc/tests: Check all pruned blocks are reported, not just stale heads Signed-off-by: Alexandru Vasile <[email protected]> * rpc/tests: Remove println debug and fix indentation Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Remove unnecessary trait bounds Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Add debug log for pruned forks Signed-off-by: Alexandru Vasile <[email protected]> * Revert "rpc/chain_head: Add debug log for pruned forks" This reverts commit 425d6e7a8b60421bcece12add1941fe58524cf52. * Adjust blockID for testing Signed-off-by: Alexandru Vasile <[email protected]> * Update client/rpc-spec-v2/src/chain_head/chain_head_follow.rs Co-authored-by: Davide Galassi <[email protected]> * rpc/chain_head: Rename `ChainHeadFollow` to `ChainHeadFollower` Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Remove subscriptions manually Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Improve log messages by adding subID and errors Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Ensure `follow` stops sending events on first error Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Use default constructor Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Add `StartupPoint` structure Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Rename `in_memory_blocks` Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Fix comment typo Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Keep unique blocks and remove itertools Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Make sure `bestBlocks` events are generated in order Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Maintain order of reported blocks Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Parent of finalized block could be unpinned Signed-off-by: Alexandru Vasile <[email protected]> * rpc/chain_head: Fix warning Signed-off-by: Alexandru Vasile <[email protected]> --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: Davide Galassi <[email protected]>
parent
8b94c57e
Please register or sign in to comment