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

internal/ethapi: accept both hex and decimal for blockCount #23363

Merged
merged 1 commit into from Aug 10, 2021

Conversation

@zsfelfoldi
Copy link
Contributor

@zsfelfoldi zsfelfoldi commented Aug 9, 2021

This PR allows both hex and decimal formats for the blockCount input parameter eth_feeHistory API.

Copy link
Member

@karalabe karalabe left a comment

Nonononon :D

Please make a new type rpc.DecimalOrHex inside rpc/types.go and add a custom JSON unmarshaller, similar to https://github.com/ethereum/go-ethereum/blob/master/rpc/types.go#L71

@@ -87,8 +87,23 @@ type feeHistoryResult struct {
GasUsedRatio []float64 `json:"gasUsedRatio"`
}

func (s *PublicEthereumAPI) FeeHistory(ctx context.Context, blockCount hexutil.Uint, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*feeHistoryResult, error) {
oldest, reward, baseFee, gasUsed, err := s.b.FeeHistory(ctx, int(blockCount), lastBlock, rewardPercentiles)
func (s *PublicEthereumAPI) FeeHistory(ctx context.Context, blockCount interface{}, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*feeHistoryResult, error) {
Copy link
Contributor

@rjl493456442 rjl493456442 Aug 9, 2021

Perhaps defining the rpc.HexUintOrUint type to resolve the value from the json stream is better?

@zsfelfoldi zsfelfoldi requested review from fjl and holiman as code owners Aug 9, 2021
Copy link
Member

@karalabe karalabe left a comment

LGTM

@karalabe karalabe added this to the 1.10.7 milestone Aug 10, 2021
@karalabe karalabe merged commit 97bd6cd into ethereum:master Aug 10, 2021
1 of 2 checks passed
atif-konasl added a commit to lukso-network/pandora-execution-engine that referenced this issue Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants