In ETH API, eth_feeHistory is originally intended to return the history of gas tips in recent blocks, which has to be used as a data source for a custom gas tip estimation. Typically, the resulting gas tip is expected to be an average or a median of the historic median values.
The same approach cannot be used in U2U due to the leaderless and asynchronous nature of the consensus algorithm. Instead, eth_feeHistory itself performs the estimation of gas tip and calculates a single gas tip, where percentile is interpreted as a confidence level (higher -> larger fee). This value is then copied for each requested block, in a case if multiple blocks were requested.
We expect that users can reuse the same code for gas tip estimation which they use for ETH, because both an average or a median of the copied values will still be equal to the intended value. However, it causes a confusion as it's apparent that the output doesn't match the ETH API description of the method.
This PR randomizes the copied gas tip by up to 2% upward in order to closer cosmetically mimic the original ETH API variant of the method. The gas tip for last requested block is left as-is without randomization.
The PR adds note to output of eth_feeHistory which explains the difference in output.
This way, we endeavor to balance fidelity to the original API design with the adaptations necessary for U2U unique architecture, thereby providing users with a tool that is both familiar and optimized for the new context.
In ETH API,
eth_feeHistory
is originally intended to return the history ofgas tip
s in recent blocks, which has to be used as a data source for a customgas tip
estimation. Typically, the resultinggas tip
is expected to be an average or a median of the historic median values. The same approach cannot be used in U2U due to the leaderless and asynchronous nature of the consensus algorithm. Instead,eth_feeHistory
itself performs the estimation ofgas tip
and calculates a singlegas tip
, wherepercentile
is interpreted as a confidence level (higher -> larger fee). This value is then copied for each requested block, in a case if multiple blocks were requested. We expect that users can reuse the same code forgas tip
estimation which they use for ETH, because both an average or a median of the copied values will still be equal to the intended value. However, it causes a confusion as it's apparent that the output doesn't match the ETH API description of the method.This PR randomizes the copied
gas tip
by up to 2% upward in order to closer cosmetically mimic the original ETH API variant of the method. Thegas tip
for last requested block is left as-is without randomization. The PR adds note to output ofeth_feeHistory
which explains the difference in output.This way, we endeavor to balance fidelity to the original API design with the adaptations necessary for U2U unique architecture, thereby providing users with a tool that is both familiar and optimized for the new context.