-
Notifications
You must be signed in to change notification settings - Fork 799
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
client/rpc: Add new RPC for current transaction pool status #7334
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Shreevatsa N <[email protected]>
Tests from
Live RPC testing:
|
I don't know exactly which label to be requested to be added, I am guessing |
Signed-off-by: Shreevatsa N <[email protected]>
4f26999
to
a1587a7
Compare
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.
See: #7138
I'm not really happy to do this, but also discussed this a little bit more with @michalkucharczyk in DMs. Generally, if this would be added via the new RPC-api spec, I would lift my "No".
Description
This PR adds a new RPC
author_poolStatus
which shows the current status of the substrate transaction pool.During one of the implementation of a queue which submits batch transaction in thousands, I did not find a way of getting the status of the pool. We set the pool limit in transactions and its size with
--pool-limit
&--pool-kbytes
respectively.I wanted a way to find if the transaction pool is nearing its limit or not before any new bulk transactions are sent to the pool so the transaction do not get bounced, which is my current case.
I have used
author_pendingExtrinsics
RPC but it does not give the bytes occupied in the pool. Since bytes occupied is also another crucial factor along with count for the limit to be enforced whether the pool is full or not.Another downside of using this RPC is that that response is too big adding unnecessary load to the nodes and to parse the data as well.
Since we are already using
status()
method at various places ofTransactionPool
trait. Send the data as a RPC too, benefitting with low response size.In future I wish to add the current limits on count and size to this response as well. For now I will assume that
transaction-pool
will be full whenready.count + future.count(10% of ready.count) > pool_limit
orready.total_bytes + future.total_bytes(10% of ready.total_bytes) > pool_limit_bytes
.Review Notes
Utilise the
status()
method ofTransactionPool
trait to expose that data as part of a new RPC call namedpoolStatus
as part ofauthor
.I have added tests to demonstrate the same.
Signed-off-by: Shreevatsa N [email protected]