-
Notifications
You must be signed in to change notification settings - Fork 266
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
Add newPendingTransactions and syncing to RSKj eth_subscribe JSON-RPC Method #1580
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline: run |
633b0fb
to
0b2e459
Compare
pipeline: run |
2 similar comments
pipeline: run |
pipeline: run |
0b2e459
to
d4a3824
Compare
pipeline: run |
321b4f7
to
bb7e533
Compare
Kudos, SonarCloud Quality Gate passed! |
nagarev
approved these changes
Sep 22, 2021
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.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Implemented new pending transactions and sync transactions. Both behave the same as when geth is attached (subscribe sync start and end are events have replicated functionality with geth attaching to web3 endpoints). 100% code coverage on new files and increased test coverage percentage in co.rsk.rpc.modules.eth.subscribe package (attached master and current branch code coverage report for reference). Followed existing patterns.
Originated from #1530
Motivation and Context
Resolves rsksmart/rsk-gitcoin-hackathon-2021#15 & resolves rsksmart/rsk-gitcoin-hackathon-2021#16
Personally my participation in the hackathon was driven by:
Interested in cryptocurrency.
Want to continue honing skills in open source software.
How Has This Been Tested?
Subscribe Syncing:
JSONRPC Request:
{"jsonrpc": "2.0", "method":"eth_subscribe","params":["syncing"],"id":1}
Response examples:
Sync started:
{ "jsonrpc": "2.0", "method": "eth_subscription", "params": { "subscription": "0xfb93f2548a59febf37e77974c65439b5", "result": { "syncing": true, "status": { "startingBlock": 0, "currentBlock": 0, "highestBlock": 24255 } } } }
Sync ended:
{ "jsonrpc": "2.0", "method": "eth_subscription", "params": { "subscription": "0xfb93f2548a59febf37e77974c65439b5", "result": { "syncing": false, } }
Below is an example of same behavior being displayed in geth as in new subscribe functionality (Geth is attached to the RSKj node)
Subscribe new pending transactions
geth attach http://127.0.0.1:4444
{"jsonrpc": "2.0", "method":"eth_subscribe","params":["newPendingTransactions"],"id":1}
eth.sendTransaction({from:eth.accounts[1], to:"0xf6e443fd1c869c6a25d18a9866f3a6c7f8dfb703", value: web3.toWei(300000000000, "ether")})
{ "jsonrpc": "2.0", "method": "eth_subscription", "params": { "subscription": "0x9eec892ee10d588f63a3298dc28ca9ca", "result": "0xe8959f138720de78ef14c5688176c89dd8096546ca04bda698e3ee84e7ff67b1" } }
Below is an example of sending a transaction using attached geth
Types of changes
Checklist: