Commit 0e286451 authored by Alexandru Vasile's avatar Alexandru Vasile Committed by GitHub
Browse files

rpc: Use the blocks pinning API for chainHead methods (#13233)



* rpc/chain_head: Add backend to subscription management

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Pin blocks internally and adjust testing

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* client/in_mem: Reference for the number of pinned blocks

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/tests: Check in-memory references to pinned blocks

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Fix clippy

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Remove unused comment

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Place subscription handle under `Arc` and unpin blocks on drop

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/tests: Check all pinned blocks are unpinned on drop

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* Apply suggestions from code review

Co-authored-by: default avatarBastian Köcher <[email protected]>

* Update client/rpc-spec-v2/src/chain_head/subscription.rs

Co-authored-by: default avatarBastian Köcher <[email protected]>

* rpc/tests: Retry fetching the pinned references for CI correctness

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* client/service: Use 512 as maximum number of pinned blocks

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* chain_head: Fix merging conflicts

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Adjust subscriptions to use pinning API

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head/tests: Test subscription management

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Adjust chain_head follow to the new API

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Adjust chain_head.rs to the new API

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head/tests: Adjust test.rs to the new API

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* client/builder: Use new chainHead API

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Fix documentation

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* rpc/chain_head: Fix clippy

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* client/in_mem: ChainHead no longer uses `in_mem::children`

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* Update client/rpc-spec-v2/src/chain_head/subscription.rs

Co-authored-by: default avatarSebastian Kunert <[email protected]>

* Update client/rpc-spec-v2/src/chain_head/subscription.rs

Co-authored-by: default avatarSebastian Kunert <[email protected]>

* Update client/rpc-spec-v2/src/chain_head/subscription.rs

Co-authored-by: default avatarSebastian Kunert <[email protected]>

* Update client/rpc-spec-v2/src/chain_head/subscription.rs

Co-authored-by: default avatarSebastian Kunert <[email protected]>

* chain_head: Add block state machine

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* Address feedback

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* Use new_native_or_wasm_executor

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* chain_head: Remove 'static on Backend

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* chain_head: Add documentation

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* chain_head: Lock blocks before async blocks

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* chain_head_follower: Remove static on backend

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* Update client/service/src/builder.rs

Co-authored-by: default avatarDavide Galassi <[email protected]>

* Update client/service/src/builder.rs

Co-authored-by: default avatarDavide Galassi <[email protected]>

* chain_head: Add BlockHeaderAbsent to the PartialEq impl

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* client: Add better documentation around pinning constants

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* chain_head: Move subscription to dedicated module

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

* subscription: Rename global pin / unpin functions

Signed-off-by: default avatarAlexandru Vasile <[email protected]>

---------

Signed-off-by: default avatarAlexandru Vasile <[email protected]>
Co-authored-by: default avatarBastian Köcher <[email protected]>
Co-authored-by: parity-processbot <>
Co-authored-by: default avatarSebastian Kunert <[email protected]>
Co-authored-by: default avatarDavide Galassi <[email protected]>
parent bedb497d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment