-
Notifications
You must be signed in to change notification settings - Fork 795
fix(providers): Propogate gas limit with access list #901
Conversation
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.
nice work - are you sure it's correctly implemented? the test seems to indicate otherwise?
|
||
assert_eq!(tx.from(), provider.from.as_ref()); | ||
assert!(tx.to().is_none()); | ||
assert_eq!(tx.gas(), Some(&gas)); |
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.
If this worked correctly, wouldn't this be gas_with_al
?
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.
See below, but my thought is that in this case we want the access list because it saves us gas, but we want to leave the gas limit untouched because we don't want to override any values set upstream.
Yeah, the code is a bit convoluted in the interesting of minimizing rpc calls. Not resetting the gas even if we include the access list is actually the big change I was going for, as this means you can't manually set the gas limit when the estimated gas with an access list is inacurrate. For clarity, here are some of the properties I was going for. Whether these properties are actually desirable is worth a discussion.
|
I think this is reasonable. Ideally we should split out the filling operations out in their separate functions on a builder to give the maximum composability. If the user doesn't care to customise / override any of the behaviour, we go with what makes most sense for generic cases in
I agree, this shouldn't be ignored, leave it up to the user to deal with it. estimateGas failure saves many failed txs imo. I might also add that maybe try estimating gas with |
I like the idea of separate fill methods. I think propogating failure of Also a great point about setting transaction values before estimating gas. We should probably do the same with gas price. |
Thinking about this more, an important property That probably means not calling |
@wolflo what do you suggest as next steps to getting this PR over the line? I think we def want to remove recovering from eth_estimateGas |
@gakonst Currently it only recovers from failure of
I see some advantages to maintaining the behavior in one or both of these cases:
I'm happy to update to whatever behavior sounds most intuitive, though. Other than that, I will do a pass and make sure we fill as much info as we can before estimating gas. The separate |
Updates Provider::fill_transaction() to fill the gas price of a transaction before filling the gas limit. There are cases where the gas used by a transaction may be dependent on the gas price. For example, the following contract bytecode branches based on the result of the GASPRICE opcode: GASPRICE PUSH1 0xff GT PUSH1 {label} JUMPI
@gakonst This should be ready to merge, with the caveat that the behavior around |
Hey sorry missed the message above (please ping me if you see me being non-responsive!). To get this over the line I'd really want us to make transactions return an error if eth_estimateGas fails, as mentioned above Motivation being: I've never needed to send a failing transaction and EIP-2930-only transactions are few enough that shouldn't create a behavior change requirement |
@gakonst Updated to propogate any failure of But, it still doesn't call Edit: Also worth noting that we still swallow failures of |
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.
SGTM. Nice work. Let's hope this fixes ppl's issues!
Motivation
Previously,
Provider
'sfill_transaction()
would override the gas price set by the caller if using an access list changed the gas estimate. This led to transactions consistently running out of gas with no way to increase the gas limit.Solution
Update the transaction gas limit only if the caller did not set it. If including an access list will decrease the gas limit, we use the access list but leave the caller-supplied gas limit.
This may lead to over-estimating the gas limit, but it should never cause a transaction that would have otherwise succeeded to run out of gas, because we only include the access list if:
eth_estimateGas
fails and the caller has not specified a gas limitPR Checklist