Skip to content

Commit

Permalink
#1719 small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Apr 24, 2024
1 parent d8bd5da commit cafa20d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libweb3jsonrpc/Eth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ Json::Value Eth::eth_feeHistory( const std::string& _blockCount, const std::stri
auto blockInfo = client()->blockInfo( bn - 1 );

if ( EIP1559TransactionsPatch::isEnabledWhen( blockInfo.timestamp() ) )
result["baseFeePerGas"].append( toJS( client()->gasBidPrice( bn ) ) );
result["baseFeePerGas"].append( toJS( client()->gasBidPrice( bn - 1 ) ) );
else
result["baseFeePerGas"].append( toJS( 0 ) );

Expand Down
4 changes: 2 additions & 2 deletions test/unittests/libweb3jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3097,7 +3097,7 @@ BOOST_AUTO_TEST_CASE( eip1559RpcMethods ) {
percentiles[0] = 20;
percentiles[1] = 80;

size_t blockCnt = 7;
size_t blockCnt = 9;
auto feeHistory = fixture.rpcClient->eth_feeHistory( toJS( blockCnt ), "latest", percentiles );

BOOST_REQUIRE( feeHistory["oldestBlock"] == toJS( bn - blockCnt + 1 ) );
Expand All @@ -3108,7 +3108,7 @@ BOOST_AUTO_TEST_CASE( eip1559RpcMethods ) {
for (Json::Value::ArrayIndex i = 0; i < blockCnt; ++i) {
BOOST_REQUIRE( feeHistory["baseFeePerGas"][i].isString() );
std::string estimatedBaseFeePerGas = EIP1559TransactionsPatch::isEnabledWhen(
fixture.client->blockInfo( bn - i ).timestamp() ) ? toJS( fixture.client->gasBidPrice( bn - i ) ) : toJS( 0 );
fixture.client->blockInfo( bn - i - 1 ).timestamp() ) ? toJS( fixture.client->gasBidPrice( bn - i ) ) : toJS( 0 );
BOOST_REQUIRE( feeHistory["baseFeePerGas"][i].asString() == estimatedBaseFeePerGas );
BOOST_REQUIRE_GT( feeHistory["gasUsedRatio"][i].asDouble(), 0 );
BOOST_REQUIRE_GT( 1, feeHistory["gasUsedRatio"][i].asDouble() );
Expand Down

0 comments on commit cafa20d

Please sign in to comment.