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.
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
[r2r] Tendermint multiple rpcs optimization #1568
[r2r] Tendermint multiple rpcs optimization #1568
Changes from 22 commits
19dfcd6
014bc59
040f25f
c6e6b10
847072d
99fcd04
7f70b63
0f26cf9
5aa99fe
6e68b6e
557adc1
a58b40f
476f8d7
1b77448
0252557
f3c9753
5c684bb
0632c4c
f7a0808
e7c23df
619b607
af6a7e7
9f86b4a
d02353e
dfc4e3e
26acb77
28229b5
f137824
a1532d3
8c71642
238cead
3918e1c
a25ffaa
d3b46fe
5edff34
b561c11
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.
Is it possible to avoid adding such common RPC enum?
In my opinion,
RpcClientEnum
could be used as a return type ofMmCoinEnum::get_rpc_client
. As I can see, currently,RpcCommonOps::get_rpc_client
is used when the RPC client type is known.https://github.com/KomodoPlatform/atomicDEX-API/blob/af6a7e7ad7f5ea329e081a63b5df732224b50c7c/mm2src/coins/tendermint/tendermint_coin.rs#L439-L445
In conclusion, I believe that we could refactor this way:
Please note that
RpcCommonOps::iterate_over_urls
is going to be used withinRpcCommonOps::get_rpc_client
method implementation only, so we can remove it from from the publicRpcCommonOps
interface.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.
Actually thank you for this hint!
I removed enums due to adding types in trait.
So I can just implement this. it's like you suggested below.
please note, that we use
get_live_client
function like one line only inrpc_client
method from traitTendermintCommons
.But I can not remove
rpc_client
from trait and use justget_live_client
instead, bcz we need this function regardingtrait CoinCapabilities: TendermintCommons + CoinWithTxHistoryV2 + MmCoin + MarketCoinOps {}
.This explanation is just in case there is a question whether
rpc_client
should be removed.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.
Please consider the following changes:
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.
Sorry, could you tell, why do we need
Arc
here? As I can see we dont need to clone structure and share its instances.Should we just use this ?
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.
If we don't need to clone, let's avoid using
Arc
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.
Thanks for the code example. I left struct
TendermintRpcClient(AsyncMutex<TendermintRpcClientImpl>)
and usedUPD also I implemented pushing current url to the end