besu icon indicating copy to clipboard operation
besu copied to clipboard

Wrong return value when using getFeeHistory API

Open JosephK95 opened this issue 3 years ago • 0 comments
trafficstars

Description

(Similar but more general than #4231)

When we execute getFeeHistory API, it seems that Besu returns a wrong value if the requested number of blocks exceeds that of available blocks.

Steps to Reproduce (Bug)

  1. Download the following file and untar it: test_fee_history.tar.gz
  2. Execute Besu binary with the following flags: besu --data-path test_fee_history/data-besu --genesis-file test_fee_history/besu.json --rpc-http-port 8549 --rpc-http-enabled --rpc-http-api ETH --network-id 15 --discovery-enabled false
  3. Execute the test case file: node test1.js

Expected behavior: All other client implementations return the following result:

{
  oldestBlock: '0x0',
  reward: [ [ '0x0' ], [ '0x0' ], [ '0x0' ], [ '0x0' ], [ '0x0' ], [ '0x0' ] ],
  baseFeePerGas: [
    '0x0',
    '0x3b9aca00',
    '0x342770c0',
    '0x2da282a8',
    '0x27ee3253',
    '0x22f06c09',
    '0x1e925e88'
  ],
  gasUsedRatio: [ 0, 0, 0, 0, 0, 0 ]
}

Actual behavior: Only Besu returns the following result:

{
  oldestBlock: '0x0',
  baseFeePerGas: [
    '0x0',        '0x3b9aca00',
    '0x342770c0', '0x2da282a8',
    '0x27ee3253', '0x22f06c09',
    '0x1e925e88', '0x1ac012b7',
    '0x17681061', '0x147b0e55',
    '0x1e925e88'
  ],
  gasUsedRatio: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0013010214939282877 ],
  reward: [
    [ '0x0' ],
    [ '0x0' ],
    [ '0x0' ],
    [ '0x0' ],
    [ '0x0' ],
    [ '0x0' ],
    [ '0x0' ],
    [ '0x0' ],
    [ '0x0' ],
    [ '0x1158ae3ab' ]
  ]
}

Frequency: Always

Versions (Add all that apply)

  • Software version: besu/v22.4.4/linux-x86_64/openjdk-java-16
  • OS Name & Version: Ubuntu 20.04.4 LTS
  • Node.js / web3.js Versions: v16.15.0 / v1.7.3

JosephK95 avatar Aug 10 '22 00:08 JosephK95