Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chainHead: Allow methods to be called from within a single connection context and limit connections #3481

Merged
merged 40 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d99e173
Update jsonrpsee to branch PR
lexnv Feb 23, 2024
dd0a68f
rpc-v2: Implement connection limiter struct
lexnv Feb 26, 2024
09b7fc6
chainHead/api: Register raw methods for chainHead methods
lexnv Feb 26, 2024
7c682a4
chainHead: Allow chainHead to be called from a single connection
lexnv Feb 26, 2024
a38df08
chainHead/tests: Check multiple connection calls
lexnv Feb 26, 2024
ec9dd79
chainHead/tests: Ensure single connection works
lexnv Feb 26, 2024
e47477a
chainHead/tests: Ensure unpin does not work from different connections
lexnv Feb 26, 2024
64ee521
Cargo: Update jsonrpsee to 0.22.2 unreleased
lexnv Mar 5, 2024
683ecca
chainHead: Use connection details instead of connection id
lexnv Mar 5, 2024
e6547d6
cargo: Use jsonrpsee from crates.io
lexnv Mar 5, 2024
f215aa9
Merge branch 'master' into lexnv/single-chain-head-connection
lexnv Mar 15, 2024
1a503d2
chainHead/tests: Fix merge conflict with master
lexnv Mar 15, 2024
ad98383
rpc-v2/common: Limit the number of subscriptions for a connection ID
lexnv Mar 19, 2024
07a18a6
chainHead/config: Add max follow subscriptions per connection
lexnv Mar 19, 2024
d3fc06a
chainHead: Limit number of chainHead_follow subscriptions
lexnv Mar 19, 2024
493f933
chainHead: Add RAII wrappers for managing registering tokens
lexnv Mar 19, 2024
4b34a3b
chainHead/tests: Adjust testing
lexnv Mar 19, 2024
e726a51
chainHead/follow: Early detection when chainHead client is disconnected
lexnv Mar 19, 2024
539291d
chainHead/tests: Check connection limits
lexnv Mar 19, 2024
d5ce140
Update substrate/client/rpc-spec-v2/Cargo.toml
lexnv Mar 19, 2024
378d9b9
Update cargo lock
lexnv Mar 19, 2024
36e986f
chainHead: Clarify connection context for methods
lexnv Mar 19, 2024
9405b8a
chainHead: Adjust comment wrt jsonrpc future
lexnv Mar 19, 2024
e506c6a
chainHead: Generate runtime call event after the future is propagated
lexnv Mar 19, 2024
fe460db
chainHead/tests: Adjust testing to use jsonrpsee macro interface
lexnv Mar 19, 2024
827254c
Merge branch 'master' into lexnv/single-chain-head-connection
lexnv Mar 19, 2024
512d816
Update cargo.lock
lexnv Mar 19, 2024
109d2b7
rpc-v2/connections: Check empty connection cleans the connection ID
lexnv Mar 20, 2024
71cbfeb
chainHead: Encapsulate rpc connections with subscription management
lexnv Mar 20, 2024
0e015ab
subscription/tests: Check resource cleanup on drop
lexnv Mar 20, 2024
65e26e4
Update substrate/client/rpc-spec-v2/src/common/connections.rs
lexnv Mar 20, 2024
aae5a11
chainHead/connections: Detect duplicate tokens
lexnv Mar 20, 2024
f06138b
chainHead/connections: Change connection names
lexnv Mar 20, 2024
f78d74b
chainHead: Add comment for limit reached on invalid subscription ID
lexnv Mar 26, 2024
9b9d196
chainHead: Guard fn with cfg test
lexnv Mar 27, 2024
9e7803e
chainHead/tests: Adjust comment
lexnv Mar 27, 2024
f56316a
rpc-v2/connections: Remove data on empty identifiers as well
lexnv Mar 27, 2024
8a11f0e
Merge remote-tracking branch 'origin/master' into lexnv/single-chain-…
lexnv Mar 27, 2024
5d4d494
Merge branch 'master' into lexnv/single-chain-head-connection
lexnv Apr 2, 2024
5195aa9
rpc-v2/cargo: Fix taplo check
lexnv Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 99 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions substrate/client/rpc-spec-v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ futures-util = { version = "0.3.30", default-features = false }
rand = "0.8.5"

[dev-dependencies]
jsonrpsee = { version = "0.22", features = ["client-core", "macros", "client", "server"] }
lexnv marked this conversation as resolved.
Show resolved Hide resolved
serde_json = { workspace = true, default-features = true }
tokio = { version = "1.22.0", features = ["macros"] }
substrate-test-runtime-client = { path = "../../test-utils/runtime/client" }
Expand Down
28 changes: 14 additions & 14 deletions substrate/client/rpc-spec-v2/src/chain_head/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_body", blocking)]
fn chain_head_unstable_body(
#[method(name = "chainHead_unstable_body", raw_method)]
async fn chain_head_unstable_body(
&self,
follow_subscription: String,
hash: Hash,
Expand All @@ -73,8 +73,8 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_header", blocking)]
fn chain_head_unstable_header(
#[method(name = "chainHead_unstable_header", raw_method)]
async fn chain_head_unstable_header(
&self,
follow_subscription: String,
hash: Hash,
Expand All @@ -85,8 +85,8 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_storage", blocking)]
fn chain_head_unstable_storage(
#[method(name = "chainHead_unstable_storage", raw_method)]
async fn chain_head_unstable_storage(
&self,
follow_subscription: String,
hash: Hash,
Expand All @@ -99,8 +99,8 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_call", blocking)]
fn chain_head_unstable_call(
#[method(name = "chainHead_unstable_call", raw_method)]
async fn chain_head_unstable_call(
&self,
follow_subscription: String,
hash: Hash,
Expand All @@ -118,8 +118,8 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_unpin", blocking)]
fn chain_head_unstable_unpin(
#[method(name = "chainHead_unstable_unpin", raw_method)]
async fn chain_head_unstable_unpin(
&self,
follow_subscription: String,
hash_or_hashes: ListOrValue<Hash>,
Expand All @@ -131,8 +131,8 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_continue", blocking)]
fn chain_head_unstable_continue(
#[method(name = "chainHead_unstable_continue", raw_method)]
async fn chain_head_unstable_continue(
&self,
follow_subscription: String,
operation_id: String,
Expand All @@ -145,8 +145,8 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_stopOperation", blocking)]
fn chain_head_unstable_stop_operation(
#[method(name = "chainHead_unstable_stopOperation", raw_method)]
async fn chain_head_unstable_stop_operation(
&self,
follow_subscription: String,
operation_id: String,
Expand Down
Loading
Loading