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

`Future` after `IgnitionModule` #812

Open alcuadrado opened 1 month ago

alcuadrado commented 1 month ago

Describe the feature

Problem

In some situations, a user needs to express that a Future should only be executed after an IgnitionModule has been executed.

We have already covered this for one case, where the Future depends on a ContractFuture exported by the IgnitionModule, as the Future implicitly depends on the entire IgnitionModule (what we jokingly call The Malaga rule).

There are cases where no ContractFuture is exported from the IgnitionModule, and you still need to be able to express this. Right now, this leads to a workaround where a ContractFuture is unnecessarily defined and exported, as shown by The Graph's module definitions.

Solution

We could have an explicit way to express "after module".

A possible syntax could be something like:

const MyModule = require("./module.js");

// ...
const foo = m.contract("Foo", [], {after: [MyModule]});

This could be quickly done by adding all the futures as dependencies of foo, but it is probably worth making it a first-class citizen to be able to properly communicate and display it in the visualize task.

For future reference

I already validated this with the team at The Graph here.

Search terms

modules

vessenes commented 1 month ago

Interesting timing. I was just wishing for this. Here's my use case in case you care about user stories:

I am deploying a fairly large set of contracts and data in a test environment with automining. There are 622 transactions in my deploy.

Some of my contracts rely on blockchain timing; automining increments the clock a little, and my local hardhat node ends up 10 minutes or so ahead of wall time. This causes terrible problems during testing, so I'd like to be able to set the time on the chain manually after we're all done with our deploy.

zoeyTM commented 4 weeks ago

Hi @vessenes , I don't think the problem you're describing is impacted by this issue actually. I'd look through the Hardhat Network docs and see if anything there might help you. Specifically, either evm_increasetime or evm_setnextblocktimestamp I think might help you.