-
Notifications
You must be signed in to change notification settings - Fork 539
eth_pubsub support #103
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
eth_pubsub support #103
Conversation
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.
Looks good so far
Implemented Each subscription message expects a single The proposed solution is |
Same strategy for |
#107 will include several changes in the project, makes sense to wait until that is merged and then adapt this PR - should be reasonably easy. As a side note, both |
# Conflicts: # frame/ethereum/src/lib.rs # rpc/src/lib.rs # template/node/src/rpc.rs
81e43d4
to
78abbfe
Compare
@crystalin @sorpaas I tried the NewHeads today and it works. Tomorrow I will try the logs and pending subscriptions, if that works I will send the PR. Please do a quick review over this and let me know. |
# Conflicts: # rpc/src/lib.rs # template/node/src/rpc.rs
Added We want to keep track What I did is just subscribe to a storage notification that streams per block, and then send to the subscriber only if the syncing state changed from the previous check. |
@tgmichel , did you look at adding the event into substrate directly ? Is that a long work |
I don't want to mess with the NetworkWorker poll if possible, but we may end up going back to do more research on it if we find this approach does not work. |
Please pull master. |
# Conflicts: # frame/ethereum/src/lib.rs # rpc/Cargo.toml # rpc/src/lib.rs # template/runtime/src/lib.rs
@sorpaas Updated. Pushed some minor runtime changes for |
Bumped Added a minor runtime fix to add |
# Conflicts: # frame/ethereum/src/lib.rs
Really sorry about this, but can you pull master again? |
@ermalkaleci @crystalin @sorpaas This test https://github.com/paritytech/frontier/blob/master/ts-tests/tests/test-block.ts#L120 was previously skipped and recently was changed to be included in this PR: https://github.com/paritytech/frontier/pull/135/files I'm getting random behaviour from it. You can reproduce it locally by running the tests. Sometimes passes and sometimes fails. The error is this - returned by
I will revert it back to skip so I can move forward. Please let me know. |
@tgmichel I think that's alright. The error was not related to this PR -- we probably just missed a timestamp inherent or something like that in the manual seal. Still good to have it fixed in a separate PR though. |
* Pubsub service setup * Add LatestHeader StorageValue, change Module name * Implement Kind::NewHeads for eth_subscribe * Styling fix * Add .cargo-remote.toml to .gitignore * Update Cargo.lock * pallet_ethereum LatestHeader to LatestBlock * Refactor to accommodate new Kinds * Implement Kind::Logs * Move Vec<Log> build to its own function * Added missing fields from Log response * Implement Kind::NewPendingTransactions * Implement eth_unsubscribe * Implement filtering for Kind::Logs * Small fixes * Add stream_build macro * Adapt to frontier consensus * Indentation cleanup * Formatting and cleanup * Remove unused imports * Remove Pending.take and add on_initialize * Fix Kind:NewPendingTransactions * Add NetworkService to pubsub rpc handler * Implement Kind::Syncing * Fix checker * pallet_ethereum handle Log response from evm execution * Runtime update substrate#12d0b7e * Return Vec<Log> in handle_exec * Fix checker * Runtime update substrate#93b2c36 * Bump jsonrpc-ore and jsonrpc-pubsub version * Update Cargo.lock * Update pallet-ethereum mock * Add missing const * Move internal error handler to crate root * Update pubsub to one-to-many * Skip previous block hash as parent test
This PR add support for subscription RPC calls -
eth_subscribe
andeth_unsubscribe
.Included
EthPubSubApi
implementation.Kind::NewHeads
,Kind::Logs
,Kind::NewPendingTransactions
,Kind::Syncing
subscriptions.Example
While running the template locally, in PolkadotJs the subscription to
Kind::NewHeads
can be tested using the Javascript console provided in the UI with: