Skip to content
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

feat: add eth_getLogs rpc endpoint #2146

Merged
merged 2 commits into from
Jun 20, 2019
Merged

feat: add eth_getLogs rpc endpoint #2146

merged 2 commits into from
Jun 20, 2019

Conversation

zachdaniel
Copy link
Contributor

@zachdaniel zachdaniel commented Jun 11, 2019

Resolves #2016

Motivation

  • This replicates the standard JSON RPC behavior of the eth_getLogs endpoint.

Changelog

Enhancements

  • Add eth_getLogs endpoint to the eth copy api.

    • I added an entry to CHANGELOG.md with this PR
    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
    • I checked whether I should update the docs and did so if necessary

@coveralls
Copy link

coveralls commented Jun 11, 2019

Pull Request Test Coverage Report for Build 4162a842-d7d4-4405-8451-b6aed1f91989

  • 67 of 78 (85.9%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 80.901%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/explorer/lib/explorer/etherscan/logs.ex 8 10 80.0%
apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/eth_controller.ex 59 63 93.65%
apps/explorer/lib/explorer/chain.ex 0 5 0.0%
Totals Coverage Status
Change from base Build bcffae98-c61e-4d56-b843-3765b216599c: 0.04%
Covered Lines: 4990
Relevant Lines: 6168

💛 - Coveralls

@zachdaniel zachdaniel force-pushed the add_eth_getLogs branch 2 times, most recently from 2d5858a to d7d3f0d Compare June 12, 2019 18:48
@zachdaniel zachdaniel added the ready for review This PR is ready for reviews. label Jun 12, 2019
vbaranov pushed a commit that referenced this pull request Jun 13, 2019
Copy link
Member

@vbaranov vbaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zachdaniel

I've got Internal server error on stg with the request:

curl -H "Content-type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"], "fromBlock": "0x79A2E3"}],"id":1}'

vbaranov pushed a commit that referenced this pull request Jun 19, 2019
@vbaranov
Copy link
Member

@zachdaniel when there is nothing to return in response, this method returns Params 'module' and 'action' are required parameters. For example,

curl -H "Content-type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"topics":["0x0000000000000000000000002f3aabb402bc175fe82890b9f9337a2e1fd5039c"], "fromBlock": "0x79A2E3"}],"id":1}' http://localhost:4000/api/eth_rpcc
{"status":"0","result":null,"message":"Params 'module' and 'action' are required parameters"}

@zachdaniel
Copy link
Contributor Author

The url is misspelled, so it is trying to route you to the other RPC (the one that takes module and action). You have /api/eth_rpcc

@vbaranov
Copy link
Member

Indeed, thanks!

@vbaranov vbaranov self-requested a review June 20, 2019 12:40
@vbaranov vbaranov merged commit c7bff3c into master Jun 20, 2019
@vbaranov vbaranov deleted the add_eth_getLogs branch June 20, 2019 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add eth_getLogs JSON RPC API method
4 participants