-
Notifications
You must be signed in to change notification settings - Fork 668
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
rpc-v2: Limit transactionBroadcast calls to 16 #3772
Conversation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
9a6d8ed
to
e2f1b82
Compare
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This reverts commit c447ac2. Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs
Outdated
Show resolved
Hide resolved
substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs
Outdated
Show resolved
Hide resolved
let mut best_block_import_stream: std::pin::Pin< | ||
Box<dyn Stream<Item = <Pool::Block as BlockT>::Hash> + Send>, | ||
> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why this type annotation needed adding!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an edge-case in the rust compiler, where the rustc cannot deduce the type of this stream.
I'm not entirely sure what is happening behind the scenes, I expect the async block cannot be properly deduced here.
The error I get is:
error[E0308]: mismatched types
--> substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs:222:3
|
146 | |notification| async move { notification.is_new_best.then_some(notification.hash) },
| --------------------------------------------------------------------
| |
| the expected `async` block
| the found `async` block
...
222 | sc_rpc::utils::spawn_subscription_task(&self.executor, fut);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected `async` block `{async block@substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs:146:20: 146:88}`
found `async` block `{async block@substrate/client/rpc-spec-v2/src/transaction/transaction_broadcast.rs:146:20: 146:88}`
note: the lifetime requirement is introduced here
--> /home/lexnv/workspace/polkadot-sdk/substrate/client/rpc/src/utils.rs:178:34
|
178 | fut: impl Future<Output = ()> + Send + 'static,
| ^^^^
For more information about this error, try `rustc --explain E0308`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of small nits but all makes sense to me!
I don't mind the limit being 4 just to exercise clients and nudge them to be able to handle a max of 4, but for most other cases I wonder what an actually sensible limit would be here
…cast.rs Co-authored-by: James Wilson <james@jsdw.me>
Review required! Latest push from author must always be reviewed |
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
substrate/client/rpc-spec-v2/src/transaction/tests/transaction_broadcast_tests.rs
Outdated
Show resolved
Hide resolved
&self, | ||
connection_details: ConnectionDetails, | ||
bytes: Bytes, | ||
) -> RpcResult<Option<String>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could probably change the return type Option<String>
because this error is never used by the impl
however, https://github.com/paritytech/jsonrpsee/blob/master/core/src/server/mod.rs#L153-#L171 IntoResponse is not implemented for Option<String>
so never mind.
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This PR stabilizes the txBroadcast API to version 1. Ideally needs: - #4050 - #3772 cc @paritytech/subxt-team --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This PR limits the number of active calls to the transactionBroadcast APIs to 16.
cc @paritytech/subxt-team
Closes: #3081