Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying to a cleared local hardhat node should ignore previous deployment #650

Closed
kanej opened this issue Dec 11, 2023 · 1 comment · Fixed by #653
Closed

Deploying to a cleared local hardhat node should ignore previous deployment #650

kanej opened this issue Dec 11, 2023 · 1 comment · Fixed by #653
Assignees
Labels
status:needs-decision We need to make a decision about this type:improvement An enhancement to an existing feature

Comments

@kanej
Copy link
Member

kanej commented Dec 11, 2023

Ignition treats deploying to a local Hardhat network node (chainId: 31337) like other networks. It creates deployment files under the ./ignition/deployments folder.

However, if the Hardhat node is stopped and restarted, then the deployment state will need to be wiped to allow for a redeployment of the module.

It would be better if, when deploying against a network with chainId 31337, Ignition automatically detects that the network node has restarted since the previous run. If the network node has restarted, the deployment should be reset with a complete wipe of the previous deployment state.

A potential approach

Pull the Hardhat node instance id if the network has chainId 31337:

const metadata = await network.provider.send("hardhat_metadata");
const instanceId = metadata.instanceId; // random identifier of the session

Then to record that instance id against the deployment initialize message to the journal

export interface DeploymentInitializeMessage {
  type: JournalMessageType.DEPLOYMENT_INITIALIZE;
  chainId: number;
  instanceId?: number;
}

On a rerun of the deployment, Ignition should compare the instance ids, if they differ, the deployment state should be cleared.

@kanej kanej changed the title Deploy to a cleared local hardhat node should ignore previous deployment Deploying to a cleared local hardhat node should ignore previous deployment Dec 11, 2023
@kanej kanej added status:needs-decision We need to make a decision about this type:improvement An enhancement to an existing feature and removed status:triaging labels Dec 11, 2023
@alcuadrado
Copy link
Member

This is a great idea!

@kanej kanej moved this to Todo in Hardhat Ignition Dec 12, 2023
@zoeyTM zoeyTM moved this from Todo to In Progress in Hardhat Ignition Dec 12, 2023
@zoeyTM zoeyTM self-assigned this Dec 12, 2023
@zoeyTM zoeyTM moved this from In Progress to In Review in Hardhat Ignition Dec 13, 2023
@github-project-automation github-project-automation bot moved this from In Review to Done in Hardhat Ignition Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs-decision We need to make a decision about this type:improvement An enhancement to an existing feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants