The fail of outofgas transactions is too high. How to avoid it?

In the past, there would only be an occasional failed outofgas transaction out of about 10 transactions. Now at least 5 out of 10 transactions are failed outofgas transactions. This is a terrible experience.
We use TypeScript SDK, which is “fuels”: “^0.93.0”,
How to solve this problem?
To test this problem, you can play our game at the link: https://app.constellation.fun
However, there will be more failed transactions and the experience is not particularly good.

Hi @Clara ,

Can you include the results of your fuelup show, and any relevant code either as a gist, repo that is giving these errors and the errors themselves, if you can also provide the contract addresses/relevant transaction IDs that succeeded, that would be ideal.

cc @Nazeeh21 for followup.

2 Likes

Hi @Clara sorry to hear this has been your experience.

In addition to what @nick has asked for to help us solve your issues, here are some recommended resources on gas price and dependency estimation in the TS SDK.

You may want to explore doing batchTransfers , Multi Contract calls and Custom Transactions as well to ensure you better structure your transactions.

Hello @maschad
Thank you for your reply. I understand. When calling a contract, we need to manually set the maximum gasLimit, including Call and Transaction. These can be calculated through gas evaluation, and then we set a larger value, so that it can be guaranteed that the transaction won’t fail due to outofgas, right?

Hi @Clara

That’s correct, but it’s important to note that the call gasLimit parameter sets the maximum gas allowed for the actual contract call, whereas the Transaction gasLimit (see Transaction Parameters) sets the maximum gas allowed for the entire transaction and constrains the gasLimit for the call.

If the call gasLimit is set to a value greater than the available transaction gas, then the entire available transaction gas will be allocated for the contract call execution.

If you don’t set the gasLimit for the Call, the Transaction gasLimit will be applied.

You can read more here

Thanks @maschad
We have modified the code related to the front-end call contract and set the gasLimit corresponding to different transaction contract calls. Currently, all contract function calls will no longer cause outofgas failed transactions.
But sometimes the error message “connector not available” still occurs.
We use TS SDK
“fuels”: “^0.93.0”,
I see that the current version has been updated to 0.94.4. Will updating to the latest version solve this problem?
However, the latest version has been updated a lot. We found that the data format returned by reading the contract has changed. If it is the Option data format, it is wrapped in Some when returned, or None is returned, which is quite troublesome to modify.

Hi @Clara I’m glad you have been able to resolve the gas related issues.

We have received reports of connector availability issues in the past, I believe upgrading to the latest SDK will be of benefit as we introduced a synchronous way to instantiate the connectors which you can read more about here

You can read the migration guide for breaking changes introduced in 0.94.0 here

If you have any issues feel free to open a new issue on our repo.

OK, thank you @maschad
We will use the latest version of TS SDK when the next version of the game adds functions such as invitations, communities, and community battles.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.