-
Notifications
You must be signed in to change notification settings - Fork 182
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
Make transactions compatible with Arbitrum and fix setting max gas price #2171
Make transactions compatible with Arbitrum and fix setting max gas price #2171
Conversation
GasFeeCap
in each tx to maxGasPrice
defined by the user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there may be a problem with this approach since the client
struct currently embeds each of the binding sessions. As a result, if the caller invokes a method from a binding session that isn't explicitly defined on client
, the method will be invoked on the underlying binding session that defines it [1].
For example, consider the method LivepeerTokenSession.Transfer(). At the moment, Transfer()
is not defined on client
, so a call to client.Transfer()
(such as the one here) is equivalent to client.LivepeerTokenSession.Transfer()
. With the current changes in this PR, that call should result in a nil pointer error because the TransactOpts
filed in LivepeerTokenSession
is not set.
I suggest thinking about a way to handle this case.
@yondonfu Good point! You're right that it can be very confusing because you'd always need to remember that you can only use functions that were overridden in the client. I checked and you can't configure func (c *client) setTransactOpts(opts bind.TransactOpts) {
c.transOptsMu.Lock()
c.LivepeerTokenSession.TransactOpts = opts
c.LivepeerTokenFaucetSession.TransactOpts = opts
c.ServiceRegistrySession.TransactOpts = opts
c.BondingManagerSession.TransactOpts = opts
// ...
c.transOptsMu.Unlock()
} But I think it won't work because assignment operation is not thread-safe in Go and Since I don't think you can embed structs partly in Go, then I think there is no better option than getting rid of embedding the sessions at all. It results in some boilerplate delegation functions, but at least it's pretty straightforward. I added this commit: 6cdba5e . Let me know if you see any better solution to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after resolving conflicts!
Hm don't see an immediate better solution. The extra boilerplate is not great, but can live with it for now! |
6cdba5e
to
5af4d77
Compare
I tried to test it in Arbitrum Testnet and got the following message, which I guess is a blocker for this PR.
|
7ebebca
to
31ada12
Compare
GasFeeCap
in each tx to maxGasPrice
defined by the userThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let's update the changelog entry to reflect that this PR also make updates to be compatible with Arbitrum.
ff273cc
to
71388bb
Compare
What does this pull request do? Explain your changes. (required)
Fix setting max gas price for both legacy tx and dynamic fee tx. Additionally, fix the transaction replacement for the legacy tx.
This PR uses
TransactOpts
to setGasFeeCap
. There was already another approach merged to solve this issue by modifyingTransactionManager
#2111, but it caused to stop processing streams #2152, and therefore had to be reverted #2163.Specific updates (required)
TransactOpts
to theClient
structTransactOpts
fromClient
instead of the default oneTransactOpts
inClient
transactionManager
to cover legacy txHow did you test each of these updates (required)
maxFeePerGas
set to the value defined by usermaxGasPrice
maxGasPrice
is setmaxGasPrice
is reset (set to0
), thenmaxFeePerGas
has the default value againI didn't test the transaction replacement in Arbitrum Rinkeby Testnet
Does this pull request close any open issues?
fix #2084
fix #2243
Checklist:
make
runs successfully./test.sh
pass