Cannot deploy a contract due to insufficient fee amount

By calling deploy function on the contract instance I was getting the following error:

Provider("io error: Response errors; Validity(InsufficientFeeAmount { expected: 2000000, provided: 1962467 })")

Even after providing tx policies with large limits, it didn’t help. The error is coming from some validation logic, where rust SDK fails to correctly estimate the fee amount it needs to provide for the transaction. And this logic ignores the provided tx policies

I resolved the issue by deploying the contract using forc deploy, but this should be fixed in the SDK as well. I can provide the bin and abi files of the contract if needed. Here’s the address of the contract on testnet (deployed via forc): 0x3faf84f2188b67d18055704b9001945a871fa24f86324761f630941eb6885ba5

Hey @mpoplavkov, it seems to be related to an already open issue here. However, there is a workaround for it here that you can use and you will be unblocked by it.

That might be related indeed, but in my case - I’m trying to deploy the contract, not call its function. And as I mentioned, setting a high script gas limit doesn’t solve the issue in my case

Can you share your repo and the forc and fuelup versions you use?

active toolchain

testnet-aarch64-apple-darwin (override)
forc : 0.59.0
- forc-client
- forc-deploy : 0.59.0
- forc-run : 0.59.0
- forc-crypto : 0.59.0
- forc-debug : 0.59.0
- forc-doc : 0.59.0
- forc-explore : 0.28.1
- forc-fmt : 0.59.0
- forc-lsp : 0.59.0
- forc-tx : 0.59.0
- forc-wallet : 0.7.1
fuel-core : 0.26.0
fuel-core-keygen : 0.26.0

fuels versions

forc : 0.62.0
forc-wallet : 0.62.0

I can’t share the repo but can give you the bin and abi files, which should be enough

fuelup --version
fuelup 0.24.0

@mpoplavkov just following up here, was this issue resolved?

If it was, can you post how it was resolved?

No, it wasn’t. We’re still not able to deploy contracts using Rust SDK. We resolved it in a way that we used forc for the deployment

Even after upgrading to fuels-0.63.0 the following error persists:

Provider("io error: Response errors; InsufficientMaxFee { max_fee_from_policies: 188268, max_fee_from_gas_price: 188269 }")

Tx policies we’re using:

    TxPolicies::default()
        .with_max_fee(100_000_000)
        .with_script_gas_limit(4_000_000)
        .with_tip(1)
        .with_maturity(0)

Hey @mpoplavkov, i will look into it and get back to you soon

@Nazeeh21 any followup here?

Hey @mpoplavkov, sorry for the delay. I coordinated with the team on this.
So, the initial error was fixed by them upgrading to 0.63.0 from what I understand, and I was right to say that it is related to an open issue. the remaining problem with the InsufficientMaxFee will be fixed as part of the same issue. unfortunately, we can’t merge it right away because we need a PR to land in a release of fuel-core (that we will release it hopefully this week).
TLDR; we have to wait for this release to get the PR for that issue to be merged.
if your work is important and is being blocked by this currently, someone from the sdk can probably find a workaround for you. but I guess you’ve found it already with forc deploy.

Also, chances are you’re not applying the TxPolicies here correctly, since your error message says max_fee_from_policies: 188268, while you are setting a different amount judging from the snippet

1 Like

Hey, thanks for the response.

It’s not an issue for us since we’ve found a workaround indeed.

We’ve tried different tx policies, in the snippet above I just showed an example of policies much exceeding the required amounts.

1 Like

Thanks @mpoplavkov, I am glad it’s working for you. and yeah I did suspect tx policies as well :slight_smile: