This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
staking miner: Check the queue one last time before submission #4819
staking miner: Check the queue one last time before submission #4819
Changes from 32 commits
feb0a7b
633ee73
4c2dbd6
4d9644e
21546b1
00ff014
54f3bf1
ecfe004
5fddbbe
b760a30
1d08111
69a3096
32c877a
9ea9f99
e87406d
1a5d18b
c94aed1
92de8a0
756694a
5488de1
b3b9a58
b3740f5
359a469
fabfd6e
c633e44
2e638d5
5946494
0d8aca7
be2f3fc
51c4140
deeee60
e42aca8
19fc667
75d9698
e3ebf7c
64c4a33
35f26ff
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 kinda wanted to rewrite this with
.any()
but I realized async code in closures it still a PITA right?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.
it's possible but then we need convert the futures to a stream or batch them together.
Something like FuturesOrdered or JSON-RPC batch request might make this is little bit nicer to read.
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 assume we do this here to prevent heavy network usage from
create_election_ext
and then again right before submitting to make sure its not pointless to submit?I think its fine for now, but in the future I think we should look into only doing it right before submitting. Even if it ends up with a lot of wasted network usage it should be fine as long as we are not executing this function righter before the signed phase, since that is when we want to be really fast to get the solution in. But if there fear is that this will be executing at the end of the sign phase I think its fine because we will have awhile until the next signed phase, so the extra network usage won't slow itself down. (Assuming its just traffic to a node on the local network)
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.
Yeah
I'm just afraid that it will flood the JSON-RPC client and it can't keep up with all pending calls because fetching the entire pallet data is quite large (even if the future is dropped the client has to process to responses to check whether it's a valid call). This will occur on every block if we try to do everything in parallel.
Thus, I think we could try to make a subscription to the
Phase
and only spawn these tasks if it'sPhase::Signed
thenI'd be okay in spawning the huge calls in parallel but we could try to benchmark this just to be on the safe side. I could be wrong :)
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.
//cc @emostov now this these calls are performed in parallel however the code is a bit nasty with the clones
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'm going to revert the
create_election_ext
because it increases network usage significantly on average even if the we drop the requests the server will answer it anyway.In addition we only need to fetch these in signed phase anyway still no performance issues what I'm aware of anyway.