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.
The intent for eth_feeHistory for Arbitrum is to return the ratio of gas used per second / the target gas per second. The logic for calculating this gets the receipts for each tx in a block and gets the cumulative gas used, but it was using the wrong hash to look up the receipts (it should be the block hash and not the receipts hash).
Note: the current implementation returns 1.0 for gasUsedRatio for the blocks at the beginning of the window specified by eth_feeHistory's blockCount and newestBlock if the prior block has the same timestamp as the first block in the window (ie time has not ticked over).
Testing done
Not tested directly. By looking at results of eth_feeHistory on arb1 we can infer from first few blocks gasUsedRatio being 1 and the rest being zero that time is progressing but
currentTimestampGasUsed
must be zero.The only way for it to be zero is if there were no receipts. By looking at other uses of
Blockchain.GetReceiptsByHash
we can see it's supposed to be the block hash and not the receipts hash https://github.com/OffchainLabs/go-ethereum/blob/master/core/blockchain.go#L725, which would explain zero receipts.