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

Accept predefined block numbers for eth_feeHistory #4213

Merged
merged 3 commits into from
Aug 5, 2021

Conversation

brg8
Copy link

@brg8 brg8 commented Jul 30, 2021

Description

Allow the eth_feeHistory method to accept predefined block numbers, e.g. "latest". This is the appropriate schema type as defined in the ethereum spec: https://github.com/ethereum/eth1.0-specs/blob/master/json-rpc/spec.json.

The current behavior of forcing the parameter into utils.toHex actually does convert "latest" into a hex far beyond head resulting in the node response of "request beyond head block" (for geth).

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1081048064

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 72.811%

Totals Coverage Status
Change from base Build 1076530205: 0.0%
Covered Lines: 3305
Relevant Lines: 4287

💛 - Coveralls

@spacesailor24
Copy link
Contributor

spacesailor24 commented Aug 3, 2021

So the reason why this wasn't implemented with #4191 is because while the support for block tags is mentioned in the RPC spec, it doesn't seem to be supported via Geth. If you look here it seems that only hex values are supported, and my testing confirms this

I've open an issue in Geth repo to track this

I was mistaken on this, seems to be working for Geth

@spacesailor24 spacesailor24 added Do Not Merge Not allowed to be merged On Ice Important but no longer pursued for the near future 1.x 1.0 related issues labels Aug 3, 2021
@spacesailor24 spacesailor24 removed Do Not Merge Not allowed to be merged On Ice Important but no longer pursued for the near future labels Aug 5, 2021
@spacesailor24 spacesailor24 changed the base branch from 1.x to wyatt/eth_feeHistory-blocktags August 5, 2021 02:53
@spacesailor24 spacesailor24 merged commit 9dde5a7 into web3:wyatt/eth_feeHistory-blocktags Aug 5, 2021
spacesailor24 added a commit that referenced this pull request Aug 5, 2021
* Accept predefined block numbers for eth_feeHistory (#4213)

* Accept predefined block numbers for eth_feeHistory

* Update feeHistory tests to reflect new input formatter

Co-authored-by: Wyatt Barnes <wyatt@writerof.software>

* Add block tag tests

* Update CHANGELOG

* Replace inputFormatter with null to match existing code

Co-authored-by: brg8 <bgodlove88@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants