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

Remove default gasPrice when 1559 params present #2092

Merged
merged 2 commits into from
Aug 2, 2021

Conversation

fselmo
Copy link
Collaborator

@fselmo fselmo commented Jul 29, 2021

What was wrong?

  • sign_and_send_raw_middleware was broken for EIP-1559 transactions since it made use of fill_transaction_defaults() and this was always adding a gasPrice if none was present. This would cause both legacy and 1559 params to be present leading to errors.

How was it fixed?

  • For code making use of fill_transaction_defaults(), removed the default value for gasPrice when 1559 parameters are present. This keeps things backwards compatible and also provides support for 1559 for the signing middleware.
  • fill_transaction_defaults() also defaults the transaction type to '0x2' when 1559 params are present as this implies a 1559-style transaction. This is important because transaction signing (done via eth-account) relies on the type for validating 1559 transactions. We don't require the type for send_transaction so this makes the user experience smoother when using this middleware since they may already be used to sending transactions without providing a type.

Todo:

Cute Animal Picture

11

@fselmo fselmo force-pushed the remove-default-gas-price branch from 135b8b9 to c4aed54 Compare July 29, 2021 21:47
@@ -277,7 +280,6 @@ def test_signed_transaction(

if isinstance(expected, type) and issubclass(expected, Exception):
with pytest.raises(expected):
start_balance = w3.eth.get_balance(_transaction.get('from', w3.eth.accounts[0]))
Copy link
Collaborator Author

@fselmo fselmo Jul 29, 2021

Choose a reason for hiding this comment

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

This is just cleanup. This line was not used anywhere.

@fselmo fselmo force-pushed the remove-default-gas-price branch 14 times, most recently from f611e2e to f36066b Compare July 30, 2021 22:18
@fselmo fselmo changed the title [WIP] Remove default gasPrice from transactions.py Remove default gasPrice when 1559 params present Jul 30, 2021
@fselmo fselmo requested a review from kclowes July 30, 2021 22:28
@fselmo fselmo force-pushed the remove-default-gas-price branch 2 times, most recently from 055c052 to e85eb62 Compare August 2, 2021 15:40
Copy link
Collaborator

@kclowes kclowes left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for the fix! :shipit:

@fselmo fselmo force-pushed the remove-default-gas-price branch from e85eb62 to 2d334a1 Compare August 2, 2021 16:53
Do not set a default 'gasPrice' if 1559 params are present and default to transaction 'type' of '0x2' if 1559 params are present.
@fselmo fselmo force-pushed the remove-default-gas-price branch from 2d334a1 to fe489a5 Compare August 2, 2021 17:16
@fselmo fselmo force-pushed the remove-default-gas-price branch from fe489a5 to abdc653 Compare August 2, 2021 17:20
@fselmo fselmo merged commit 810b590 into ethereum:master Aug 2, 2021
@fselmo fselmo deleted the remove-default-gas-price branch August 2, 2021 17:31
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.

2 participants