Replies: 2 comments
-
Importing the discussion from Slack for future reference: Sérgio Torres (torres-ssf):
This is not a bug.
We can set a default value for gasPrice as we have the minGasPrice from the node. But for gasLimit is more complicated.
Sending transactions without setting gasLimit was working before because the SDK was setting maxGasPerTX as the gasLimit when it was not defined, this results in the VM requiring transactions to carry way more funds than it needs.
This happens because the gas limit impacts the fee estimation, a higher gas limit means a higher max fee.
The only way to have a safe value to set as the gas limit is by running getTransactionCost first and then assigning the gasUsed as the gasLimit of the TransactionRequest.
I don't believe we should do this by default, always setting gasLimit as gasUsed . Maybe we can have a flag somewhere to let users specify they want to optimize the gasLimit then we can do this approach.
Dhai:
Thanks for the explanation, Sergio.
We can discuss and decide on the technical details later, but I strongly believe that we shouldn't require the user to pass in these values. I know it's a difficult task to set a good default internally like you mentioned, but I believe that's an internal problem that we should work on so that the external DX remains smooth. Most of the devs coming to Fuel will be coming from the Ethereum ecosystem, where none of the dev tools require you to pass in these values. It's optional.
Most of these devs will be new to Fuel as well, so it won't be a pleasant experience for them to have to deal with these gas values when they are still getting their feet wet with our ecosystem which is already so different.
I'm just trying to minimize the friction for the users of our SDK here. If it requires us to put in some extra work to handle this internally, I think it's worth putting in.
I can try having a go at this if you want. Thanks for the detailed explanation again, it really helps |
Beta Was this translation helpful? Give feedback.
0 replies
-
Issue here: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The SDK isn't smart enough to set sensible defaults for
txParams
.As things stand, we always have to specify
gasLimit
andgasPrice
to more or less these values in order for transactions to go through, they simply fail if these values are not set:This shouldn't be required. The SDK's internal logic should be smart enough to set sensible defaults.
Beta Was this translation helpful? Give feedback.
All reactions