-
Notifications
You must be signed in to change notification settings - Fork 254
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
implement variant of subscription that returns finalized storage changes #237
Conversation
7ca22c1
to
5ab0ed3
Compare
Hmm this feature might need to wait until after the jsonrpsee V2 upgrade since for some reason the finalized block subscription isn't dropped... |
I've merged #214 so you can update this branch now |
34ed3e4
to
7ebf91e
Compare
@ascjones please review |
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.
Overall looks good. As mentioned I do think we should still allow subscribing to non finalized events when submitting an extrinsic still if we want to trade immediacy for finality.
Was just looking at the polkadot.js
api an they do it slightly differently with a status
field: https://polkadot.js.org/docs/api/start/api.tx.subs/, but it's a bit more low level than what we have here.
7ebf91e
to
d8ac8ff
Compare
@ascjones added a workaround to support configuration of the event subscription on |
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.
Yes that API looks fine, I'd like the comments expanding so it's clear exactly what is going on to avoid footguns.
} | ||
|
||
/// Subscribe to finalized events. | ||
pub async fn subscribe_finalized_events( |
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.
Perhaps instead of the two different methods we could just check the weak_inclusion
flag like we do in the submit transaction method. Though you would need different client instances if you wanted to do both in that case. What do you think?
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.
For now it's probably cleaner with two distinct methods as we also have subscribe_blocks
and subscribe_finalized_blocks
.
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.
Anyway I think we should remove accept_weak_inclusion
in favour of some config on the generated traits (like how it is done in polkadot{.js}) pending refactoring of the proc-macro crate.
d8ac8ff
to
3e22f0d
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.
Branch needs updating with master
.
Edit I see already done
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
3e22f0d
to
cc29156
Compare
BTW the force pushes make it hard to review updates because I can't see just the changes since I last reviewed. Merge commits are fine. |
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.
Great work!
Signed-off-by: Gregory Hill gregorydhill@outlook.com
Closes #238
https://github.com/paritytech/substrate-subxt/blob/9959f0d29950219f20b5cc79dfff46f8987239fc/src/rpc.rs#L465
https://github.com/paritytech/substrate-subxt/blob/9959f0d29950219f20b5cc79dfff46f8987239fc/src/rpc.rs#L481