NomicFoundation / hardhat-ignition

Hardhat Ignition is a declarative deployment system that enables you to deploy your smart contracts without navigating the mechanics of the deployment process.
https://hardhat.org/ignition
MIT License
107 stars 25 forks source link

Futures timed out with transactions unconfirmed after maximum fee bumps #735

Closed racket2000 closed 6 months ago

racket2000 commented 6 months ago

I am receiving this error message when I try to deploy my contract on Polygon Mainnet: Futures timed out with transactions unconfirmed after maximum fee bumps

However, after several minutes, the contract ends up being deployed. I determined this by looking up my Account address which is used for deployment on PolygonScan.

I would like to print out the Contract Address in the Console, as it is a part of a developer tutorial.

Is there anyway to override the maximum gas fee that is used for contract deployment? I saw associated issues regarding this, but I am not sure if a fix has been implemented yet.

kanej commented 6 months ago

Hey @racket2000, if you rerun the deployment without changes and using the same deployment id (the default of chain-<chainId> will be used if none was specified), then Ignition should detect that the transactions it sent eventually succeeded and print out the address as part of the final result.

The deployed addresses, after the second run, should be stored under ./ignition/deployments/<deployment_id>/deployed_addresses.json.

racket2000 commented 6 months ago

Hello, thank you very much for getting back with me.

When I rerun the deployment, I receive an error: ProviderError: INTERNAL_ERROR: nonce too low

However, the contract has been published accordingly to Polygon Scan

I am not too sure how to solve this, it seems to be getting this error from my blockchain node provider.

kanej commented 6 months ago

nonce too low is not coming from an internal Ignition check.

It suggests Ignition is trying to send a transaction where the nonce has already been used and confirmed - which would be an Ignition bug.

Is the deployment you are trying to run open source, to help us try and reproduce this?

racket2000 commented 6 months ago

Hello, thank you for the assistance.

My deployment is not open-sourced -- it is an extremely basic Hello World contract for reading/writing a message into a variable.

I am using the following parameters in my hardhat.config.js file:

ignition: { timeBeforeBumpingFees: 1000, maxFeeBumps: 100, blockPollingInterval: 20000 },

I believe that the maxFeeBumps parameter may be causing the issue, since I assume it is creating multiple transactions with higher fees under the hood.

When I did not include these parameters, the contract would fail to deploy due to a low-estimated gas fee. (The default settings have not worked for deploying on Polygon Mainnet.) It took a contract multiple hours to end up being deployed on the network when I did not specify the above parameters.

kanej commented 6 months ago

Hey @racket2000, so there are two issues here:

  1. Ignition's gas fees calculation is off for Polygon - we have a fix in PR review currently: https://github.com/NomicFoundation/hardhat-ignition/pull/740
  2. Setting a high maxFeeBumps on polygon leads to nonce too low error for a hello world contract

We will investigate 2 based on your reproduction steps.

humblemodulo commented 6 months ago

Not to pile on, but having similar issues with Polygon (mainnet) network. It simply refuses to deploy contracts. I'm guessing my issue is cursorily related to these as well:

https://github.com/NomicFoundation/hardhat-ignition/issues/738 https://github.com/NomicFoundation/hardhat-ignition/issues/724

For the record, I can deploy to BSC, Base, ETH (I'm guessing all L1s?) just fine. However, when it comes to Polygon specifically it is horribly inconsistent.

In the context of Polygon, I've tried multiple RPCs from:

- Chainlist (public)
- Tenderly
- GetBlock
- Moralis
- Quicknode
- Alchemy
- Infura

Also, for the record, I've tried old school hre.viem.deployContract, and receive errors as well. So, my guess is it goes to some core HH feature rather than simply Ignition.

I've attached a trimmed version of my Ignition output.

Anyway, just a bit more info.

trimmed-ignition-output.txt

kanej commented 6 months ago

Not to pile on, but having similar issues with Polygon (mainnet) network. It simply refuses to deploy contracts. I'm guessing my issue is cursorily related to these as well:

738 #724

For the record, I can deploy to BSC, Base, ETH (I'm guessing all L1s?) just fine. However, when it comes to Polygon specifically it is horribly inconsistent.

In the context of Polygon, I've tried multiple RPCs from:

- Chainlist (public)
- Tenderly
- GetBlock
- Moralis
- Quicknode
- Alchemy
- Infura

Also, for the record, I've tried old school hre.viem.deployContract, and receive errors as well. So, my guess is it goes to some core HH feature rather than simply Ignition.

I've attached a trimmed version of my Ignition output.

Anyway, just a bit more info.

trimmed-ignition-output.txt

Thanks for the information and Ignition output.

For polygon specifically, the gas fee estimation heuristic that gets used in both Hardhat and Ignition is giving poor results (Polygon is just too different). Until we understand Polygon gas fee calculations better we are going to revert to pre-1559 transactions on Polygon, which is giving us far more predictable results in manual testing.

You can follow along with that PR here: https://github.com/NomicFoundation/hardhat-ignition/pull/740, it will be shipped in the next release.

zoeyTM commented 6 months ago

I've investigated this issue, but I've been unable to reproduce this on the newest Ignition release (0.15.2). There may be an underlying bug still, but since the case to trigger it is an edge case under normal circumstances (transactions taking extreme amounts of time to confirm repeatedly), I'm going to close this issue for now.

This specific case was fixed as a result of us fixing Polygon transactions in general in release 0.15.2. If the bug pops up again, we can reopen and reevaluate.