Align the rows returned by Ethereum fee history

The execution base fee array has an extra item. Pairing every item with a gas-used ratio shifts the last observation into a block the query never sampled.

Map each array to its block

Request three blocks ending at latest and a single reward percentile. Use oldestBlock from the response as the starting height. If it is 100 and three blocks are available, index zero refers to block 100 across the sampled rows.

{"jsonrpc":"2.0","id":1,"method":"eth_feeHistory","params":["0x3","latest",[50]]}

The three gas-used ratios and three reward rows correspond to blocks 100 through 102. Four base-fee entries correspond to 100 through 103. The last is derived for the next block from the newest returned block. It has no measured gas-used ratio here.

Label the percentile accurately

A reward percentile describes effective priority fees weighted by gas used within that block. It is not an inclusion guarantee for a new transaction. Handle shortened history by using the actual response lengths instead of the requested count. ethereum.github.io eth_feeHistory