How to set gasLimit when deploying an upgradeable contract?

I am trying to use hardhat-upgrades plugin to deploy an upgradeable contract. I think because my contract is right at the bytecode size limit, when I try to deploy it, it was failed with error: unable to estimate gas, try setting manual gas limit.

Where can I set the gas limit when deploying an upgradeable contract? I tried to set gas limit on hardhat.config.ts by setting "gas", but the error still exists. Is there a way to set the gasLimit like {gasLimit : "500000"} when calling a contract's method?

Sorry we don't have a way to set the gas limit for deployment right now.

I would've expected setting "gas" in the Hardhat config should work, but perhaps Ethers.js is ignoring that and trying to estimate it anyway.

You can subscribe to this issue for the feature:

1 Like

Is there any news there? I am trying to deploy a contract but it returns an error estimating gas and requires a gasLimit, but nothing seems to work. A gasLimit in hardhat config seems ignored, and same in upgrades.deployProxy(. I will end up rewriting the contract and making it not upgradeable if I cannot find a work around soon.
Any idea? Thanks