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

accounts/abi/bind: refactor transact method #23719

Merged
merged 5 commits into from Oct 13, 2021

Conversation

MariusVanDerWijden
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden commented Oct 12, 2021

This PR refactors the transact method making it easier to read and easier to reason about.
This however results in ~ 40 lines more compared to the original method.
I would still argue that it's a valid refactor as it clearly discriminates between Dynamic and Legacy transactions.

It fixes an issue where executing a transaction would overwrite the transactOpts, and adds a test for it.
Previously the gasEstimation would populate the feeCap/tipCap fields which would mean that if a second transaction would be send with the same transactionOpts, the gas estimation would not be executed anymore.

It also changes the code s.th. transact only queries the blockchain if gasPrice is not specified.
If gasPrice is set, we just construct a legacy transaction. If not we query the head if basefee is already set.

supersedes #23663
supersedes #23587
closes #23586

accounts/abi/bind/base.go Outdated Show resolved Hide resolved
@fjl fjl changed the title accounts/abi/bind: Refactor transact method accounts/abi/bind: refactor transact method Oct 12, 2021
@fjl fjl added this to the 1.10.10 milestone Oct 12, 2021
@fjl fjl merged commit 79b727b into ethereum:master Oct 13, 2021
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Oct 14, 2021
This fixes a bug where gas-related fields of the TransactOpts passed
to transaction methods would be modified, skipping gas estimation for
subsequent transactions.

Co-authored-by: Yondon Fu <yondon.fu@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
tynes added a commit to ethereum-optimism/optimism that referenced this pull request Oct 19, 2021
Bumps the go-ethereum dep to release v1.10.10
which fixes a bug with the transact opts where
it is mutated and can cause gas estimation errors.

See ethereum/go-ethereum#23719
smartcontracts pushed a commit to ethereum-optimism/optimism that referenced this pull request Nov 10, 2021
Bumps the go-ethereum dep to release v1.10.10
which fixes a bug with the transact opts where
it is mutated and can cause gas estimation errors.

See ethereum/go-ethereum#23719
@MariusVanDerWijden MariusVanDerWijden deleted the refactor-transact branch November 30, 2021 15:28
yongjun925 pushed a commit to DODOEX/go-ethereum that referenced this pull request Dec 3, 2022
This fixes a bug where gas-related fields of the TransactOpts passed
to transaction methods would be modified, skipping gas estimation for
subsequent transactions.

Co-authored-by: Yondon Fu <yondon.fu@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
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.

Remove unnecessary calls to eth_getBlockByNumber when gasPrice is set
3 participants