Skip to content

Commit

Permalink
fix lint and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
broper2 authored and fselmo committed Feb 1, 2022
1 parent cf47f0c commit 8c3c7a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/integration/test_ethereum_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from eth_tester.exceptions import (
TransactionFailed,
)
from eth_typing import (
BlockNumber,
)
from eth_utils import (
is_checksum_address,
is_dict,
Expand Down Expand Up @@ -292,15 +295,12 @@ def test_eth_getBlockByHash_pending(
block = web3.eth.get_block('pending')
assert block['hash'] is not None

@pytest.mark.xfail(reason='eth_feeHistory is not implemented on eth-tester')
def test_eth_fee_history(self, web3: "Web3"):
super().test_eth_fee_history(web3)

@pytest.mark.xfail(reason='eth_feeHistory is not implemented on eth-tester')
def test_eth_fee_history_with_integer(self, web3: "Web3"):
super().test_eth_fee_history_with_integer(web3)
super().test_eth_fee_history_with_integer(web3, BlockData(number=BlockNumber(1)))

@pytest.mark.xfail(reason='eth_feeHistory is not implemented on eth-tester')
def test_eth_fee_history_no_reward_percentiles(self, web3: "Web3"):
super().test_eth_fee_history_no_reward_percentiles(web3)

Expand Down
4 changes: 2 additions & 2 deletions web3/eth.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ async def max_priority_fee(self) -> Wei:
fee_history = await self.fee_history(20, 'pending', [float(1)])
priority_fees_per_gas = fee_history['reward']
fees_sum = sum([fee[0] for fee in priority_fees_per_gas])
max_priority_fee_estimate = round(fees_sum/len(priority_fees_per_gas))
max_priority_fee_estimate = round(fees_sum / len(priority_fees_per_gas))
return Wei(max_priority_fee_estimate)

@property
Expand Down Expand Up @@ -611,7 +611,7 @@ def max_priority_fee(self) -> Wei:
fee_history = self.fee_history(20, 'pending', [float(1)])
priority_fees_per_gas = fee_history['reward']
fees_sum = sum([fee[0] for fee in priority_fees_per_gas])
max_priority_fee_estimate = round(fees_sum/len(priority_fees_per_gas))
max_priority_fee_estimate = round(fees_sum / len(priority_fees_per_gas))
return Wei(max_priority_fee_estimate)

def get_storage_at_munger(
Expand Down
7 changes: 5 additions & 2 deletions web3/providers/eth_tester/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,11 @@ def personal_send_transaction(eth_tester: "EthereumTester", params: Any) -> HexS
'hashrate': static_return(0),
'chainId': static_return('0x3d'),
'feeHistory': static_return(
{'baseFeePerGas': [134919017071, 134775902021, 117928914269], 'gasUsedRatio': [0.4957570088140204, 0.0],
'oldestBlock': 13865084, 'reward': [[2500000000], [1500000000]]}),
{'baseFeePerGas': [134919017071, 134775902021, 117928914269],
'gasUsedRatio': [0.4957570088140204, 0.0],
'oldestBlock': 13865084,
'reward': [[2500000000], [1500000000]]}
),
'maxPriorityFeePerGas': static_return(10 ** 9),
'gasPrice': static_return(10 ** 9), # must be >= base fee post-London
'accounts': call_eth_tester('get_accounts'),
Expand Down

0 comments on commit 8c3c7a4

Please sign in to comment.