Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On optimism swap (no errors with same code on arbitrum), two errors pop up: ValueError: {'code': -32601, 'message': 'the method eth_maxPriorityFeePerGas does not exist/is not available'} and ValueError: {'code': -32601, 'message': 'the method eth_feeHistory does not exist/is not available'} #299

Open
snarflakes opened this issue Dec 8, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@snarflakes
Copy link

snarflakes commented Dec 8, 2022

Describe the bug
A clear and concise description of what the bug is.

/usr/local/lib/python3.7/dist-packages/web3/eth.py:657: UserWarning: There was an issue with the method eth_maxPriorityFeePerGas. Calculating using eth_feeHistory.
"There was an issue with the method eth_maxPriorityFeePerGas. Calculating using "
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/web3/eth.py", line 654, in max_priority_fee
return self._max_priority_fee()
File "/usr/local/lib/python3.7/dist-packages/web3/module.py", line 60, in caller
null_result_formatters)
File "/usr/local/lib/python3.7/dist-packages/web3/manager.py", line 201, in request_blocking
null_result_formatters)
File "/usr/local/lib/python3.7/dist-packages/web3/manager.py", line 171, in formatted_response
raise ValueError(response["error"])
ValueError: {'code': -32601, 'message': 'the method eth_maxPriorityFeePerGas does not exist/is not available'}

Traceback (most recent call last):
File "optimismimage.py", line 442, in transactions
tx_hash = uniswap.make_trade(token_address, eth, token_balance, fee=500)
File "/usr/local/lib/python3.7/dist-packages/uniswap/decorators.py", line 37, in approved
self.approve(token)
File "/usr/local/lib/python3.7/dist-packages/uniswap/uniswap.py", line 1409, in approve
tx = self._build_and_send_tx(function)
File "/usr/local/lib/python3.7/dist-packages/uniswap/uniswap.py", line 1443, in _build_and_send_tx
transaction = function.build_transaction(tx_params)
File "/usr/local/lib/python3.7/dist-packages/web3/contract.py", line 1107, in build_transaction
**self.kwargs
File "/usr/local/lib/python3.7/dist-packages/web3/contract.py", line 1672, in build_transaction_for_function
prepared_transaction = fill_transaction_defaults(web3, prepared_transaction)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.call
File "/usr/local/lib/python3.7/dist-packages/web3/_utils/transactions.py", line 114, in fill_transaction_defaults
default_val = default_getter(web3, transaction)
File "/usr/local/lib/python3.7/dist-packages/web3/_utils/transactions.py", line 64, in
web3.eth.max_priority_fee + (2 * web3.eth.get_block('latest')['baseFeePerGas'])
File "/usr/local/lib/python3.7/dist-packages/web3/eth.py", line 660, in max_priority_fee
return fee_history_priority_fee(self)
File "/usr/local/lib/python3.7/dist-packages/web3/_utils/fee_utils.py", line 45, in fee_history_priority_fee
fee_history = eth.fee_history(*PRIORITY_FEE_HISTORY_PARAMS) # type: ignore
File "/usr/local/lib/python3.7/dist-packages/web3/eth.py", line 876, in fee_history
return self._fee_history(block_count, newest_block, reward_percentiles)
File "/usr/local/lib/python3.7/dist-packages/web3/module.py", line 60, in caller
null_result_formatters)
File "/usr/local/lib/python3.7/dist-packages/web3/manager.py", line 201, in request_blocking
null_result_formatters)
File "/usr/local/lib/python3.7/dist-packages/web3/manager.py", line 171, in formatted_response
raise ValueError(response["error"])
ValueError: {'code': -32601, 'message': 'the method eth_feeHistory does not exist/is not available'}

To Reproduce
uniswap V3 (0.03%tier), optimism, USDC to ETH token swap.

Expected behavior
Swap to occur

@snarflakes snarflakes added the bug Something isn't working label Dec 8, 2022
@snarflakes
Copy link
Author

snarflakes commented Dec 14, 2022

I tried all same code via alchemy api: get slightly different error, maybe it will help debug. Thanks

Approving 0x7F5c764cBc14f9669B88837ca1490cCa17c31607...
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/gpiozero/pins/rpigpio.py", line 223, in _call_when_changed
super(RPiGPIOPin, self)._call_when_changed()
File "/usr/local/lib/python3.7/dist-packages/gpiozero/pins/local.py", line 130, in _call_when_changed
self.state if state is None else state)
File "/usr/local/lib/python3.7/dist-packages/gpiozero/pins/pi.py", line 298, in _call_when_changed
method(ticks, state)
File "/usr/local/lib/python3.7/dist-packages/gpiozero/input_devices.py", line 182, in _pin_changed
self._fire_events(ticks, bool(self._state_to_value(state)))
File "/usr/local/lib/python3.7/dist-packages/gpiozero/mixins.py", line 401, in _fire_events
self._fire_activated()
File "/usr/local/lib/python3.7/dist-packages/gpiozero/mixins.py", line 447, in _fire_activated
super(HoldMixin, self)._fire_activated()
File "/usr/local/lib/python3.7/dist-packages/gpiozero/mixins.py", line 364, in _fire_activated
self.when_activated()
File "optimismimage.py", line 307, in push_button
transactions()
File "optimismimage.py", line 443, in transactions
tx_hash = uniswap.make_trade(token_address, eth, token_balance, fee=500)
File "/usr/local/lib/python3.7/dist-packages/uniswap/decorators.py", line 37, in approved
self.approve(token)
File "/usr/local/lib/python3.7/dist-packages/uniswap/uniswap.py", line 1409, in approve
tx = self._build_and_send_tx(function)
File "/usr/local/lib/python3.7/dist-packages/uniswap/uniswap.py", line 1443, in _build_and_send_tx
transaction = function.build_transaction(tx_params)
File "/usr/local/lib/python3.7/dist-packages/web3/contract.py", line 1107, in build_transaction
**self.kwargs
File "/usr/local/lib/python3.7/dist-packages/web3/contract.py", line 1672, in build_transaction_for_function
prepared_transaction = fill_transaction_defaults(web3, prepared_transaction)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.call
File "/usr/local/lib/python3.7/dist-packages/web3/_utils/transactions.py", line 114, in fill_transaction_defaults
default_val = default_getter(web3, transaction)
File "/usr/local/lib/python3.7/dist-packages/web3/_utils/transactions.py", line 64, in
web3.eth.max_priority_fee + (2 * web3.eth.get_block('latest')['baseFeePerGas'])
File "/usr/local/lib/python3.7/dist-packages/web3/eth.py", line 654, in max_priority_fee
return self._max_priority_fee()
File "/usr/local/lib/python3.7/dist-packages/web3/module.py", line 60, in caller
null_result_formatters)
File "/usr/local/lib/python3.7/dist-packages/web3/manager.py", line 197, in request_blocking
response = self._make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/manager.py", line 150, in _make_request
return request_func(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/formatting.py", line 94, in middleware
response = make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/gas_price_strategy.py", line 90, in middleware
return make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/formatting.py", line 94, in middleware
response = make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/attrdict.py", line 33, in middleware
response = make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/formatting.py", line 94, in middleware
response = make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/formatting.py", line 94, in middleware
response = make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/formatting.py", line 94, in middleware
response = make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/buffered_gas_estimate.py", line 40, in middleware
return make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/formatting.py", line 94, in middleware
response = make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/middleware/exception_retry_request.py", line 114, in middleware
return make_request(method, params)
File "/usr/local/lib/python3.7/dist-packages/web3/providers/rpc.py", line 91, in make_request
**self.get_request_kwargs()
File "/usr/local/lib/python3.7/dist-packages/web3/_utils/request.py", line 103, in make_post_request
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://opt-mainnet.g.alchemy.com/v2/sxxxxxxxxxxxxxxxx3-

@crypto-chen
Copy link

I have the same problem as you

@Alkhara
Copy link

Alkhara commented Apr 1, 2023

Is there a way to force a legacy tx for networks like this @shanefontaine / @ErikBjare ?

@ErikBjare
Copy link
Member

@Alkhara I'm not 100% certain, but it's possible you can work around this by providing a custom gas price strategy, since it's the automatic/default gas pricing strategy that fails (see the Web3py docs for how to do that).

Not sure you can force it to do a legacy tx that way, but otherwise you'll prob have to edit the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants