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

Add EIP-1559 support #44

Merged
merged 8 commits into from Mar 30, 2022
Merged

Conversation

lekhovitsky
Copy link
Contributor

@lekhovitsky lekhovitsky commented Dec 13, 2021

In this PR:

  • Modify Flashbots.sign_bundle to work with type 1 and 2 transactions (as described in EIP-2178)
  • Implement parsing of signed transactions to correctly handle nonces and more-or-less match the js library behavior
  • Add minimal working example of post-London flashbots usage
  • Bump web3py dependency to 5.22 and project version to 1.0.1
  • Some, generally unnecessary, code style refinements

@oraclown
Copy link

Hey, thanks for adding this. Getting an error when trying to test using the Georli testnet relay:

user:~/web3-flashbots$ poetry run python examples/eip1559.py
Using python3 (3.9.7)
Sender account balance: 6.23970569 ETH
Receiver account balance: 0 ETH
Traceback (most recent call last):
  File "examples/eip1559.py", line 88, in <module>
    main()
  File "examples/eip1559.py", line 71, in main
    results.append(w3.flashbots.send_bundle(bundle, target_block_number=target_block))
  File "/home/user/.cache/pypoetry/virtualenvs/flashbots-hW9zp6-l-py3.9/lib/python3.8/site-packages/web3/module.py", line 57, in caller
    result = w3.manager.request_blocking(method_str,
  File "/home/user/.cache/pypoetry/virtualenvs/flashbots-hW9zp6-l-py3.9/lib/python3.8/site-packages/web3/manager.py", line 197, in request_blocking
    response = self._make_request(method, params)
  File "/home/user/.cache/pypoetry/virtualenvs/flashbots-hW9zp6-l-py3.9/lib/python3.8/site-packages/web3/manager.py", line 150, in _make_request
    return request_func(method, params)
  File "/home/user/web3-flashbots/flashbots/middleware.py", line 33, in middleware
    return flashbots_provider.make_request(method, params)
  File "/home/user/web3-flashbots/flashbots/provider.py", line 52, in make_request
    raw_response = make_post_request(
  File "/home/user/.cache/pypoetry/virtualenvs/flashbots-hW9zp6-l-py3.9/lib/python3.8/site-packages/web3/_utils/request.py", line 49, in make_post_request
    response.raise_for_status()
  File "/home/user/.cache/pypoetry/virtualenvs/flashbots-hW9zp6-l-py3.9/lib/python3.8/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://relay-goerli.flashbots.net/

@lekhovitsky
Copy link
Contributor Author

Hi, @oraclown! I wasn't able to reproduce the error — for me the example works on Goerli after changing PROVIDER and FLASHBOTS_HTTP_PROVIDER_URI to their testnet counterparts, and chainId from 1 to 5.

Could it be something with versions in your environment? (Say, .../lib/python3.8/... in the provided traceback)

@oraclown
Copy link

Hi, @oraclown! I wasn't able to reproduce the error — for me the example works on Goerli after changing PROVIDER and FLASHBOTS_HTTP_PROVIDER_URI to their testnet counterparts, and chainId from 1 to 5.

Could it be something with versions in your environment? (Say, .../lib/python3.8/... in the provided traceback)

Thanks for the response. Good point about the environment, I'll try to clean it up.

Just to make sure are your env variables like so:
PROVIDER=https://goerli.infura.io/v3/**********
FLASHBOTS_HTTP_PROVIDER_URI=https://relay-goerli.flashbots.net
?

@lekhovitsky
Copy link
Contributor Author

Just to make sure are your env variables like so:
PROVIDER=https://goerli.infura.io/v3/**********
FLASHBOTS_HTTP_PROVIDER_URI=https://relay-goerli.flashbots.net
?

Yes.

@oraclown
Copy link

Hi, @oraclown! I wasn't able to reproduce the error — for me the example works on Goerli after changing PROVIDER and FLASHBOTS_HTTP_PROVIDER_URI to their testnet counterparts, and chainId from 1 to 5.

Could it be something with versions in your environment? (Say, .../lib/python3.8/... in the provided traceback)

You were right about env issues. It's working now. Thanks again for making this PR!

@epheph epheph requested a review from N0K0 December 16, 2021 17:45
Copy link

@oraclown oraclown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice updates

@zeroXbrock zeroXbrock merged commit 614db5c into flashbots:master Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants