-
Notifications
You must be signed in to change notification settings - Fork 131
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
Traitify Substrate client #2129
Conversation
Additional changes in this PR:
|
} | ||
|
||
/// Return subscription factory for this subscription. | ||
pub fn factory(&self) -> SharedSubscriptionFactory<T> { |
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.
Personally, I find it counter-intuitive that the subscription can return a SharedSubscriptionFactory
. I would expect only the SharedSubscriptionFactory
to be able to create Subscription
s. Would it make sense to remove this method and the subscribers_sender
from Subscription
?
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.
The idea was to return Subscription
from the Client
methods, not the factory. So I need some adapter to be able to share the subscribction. I started to make this adapter and found that both adapter and subscription are almost the same (some background task that reads elements from one stream and sends to 1
or multiple receivers). So I've made this tightly coupled subscription and factory. Regarding your suggestion - we can't simple remove the factory
method. I think we have following options:
- just make the method private - it'll only be available within the crate and won't cause any confusion for other users;
- return factory from
fn subscribe()
- revert this factory and reintroduce multiplexing adapter.
WDYT is better
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.
Hmmm I'm not sure which one would be best. Anyway it's not a blocker. We can merge it as it is, and I'll spend some more time thinking about it later.
This reverts commit ecd00d3.
This reverts commit 7e38a89.
related to #1820
What this PR does:
Client
trait, that will expose all node RPC methods, used by the relay;Client
structure toRpcClient
;CachingClient
, backed by theRpcClient
. This implementation caches result of someRpcClient
method calls. Additionally, it allows its clients to share theGRANDPA
andBEEFY
justification subscriptions - i.e. we'll only have one subscription between node and relay, but justifiications may be delivered to any number of subscribers in the relay;CachingClient<RpcClient>
where the oldClient
has been used.What is left in this PR:
What is left for future PRs:
CachingClient<RpcClient>
everywhere, but instead we shall be able to use anything that implementsClient
trait;TestClient
;TestClient
in tests where right now we have (or must have) "environment" traits;Cache performance in Rialto<>Millau (~30 mins running):
Cache performance in RialtoParachain<>Millau (~30 mins running):