Replies: 3 comments 2 replies
|
Have been using As with the great adoption of terraform for IaC, I desperately miss it for contract deployment. I already thought about implementing a terraform plugin myself lately for this. Working with insane spaghetti deploy scripts, I'm quite confident that terraform is not overkill. Luckily https://learn.hashicorp.com/tutorials/terraform/provider-use |
|
We have released |
|
Declarative IaC for contract deployment is a gap that's been annoying for a while. The current A few patterns that have helped in practice: // deployment/DeployAll.s.sol
contract DeployAll is Script {
function run() external {
DeployConfig memory cfg = loadConfig(vm.envString("DEPLOY_ENV"));
vm.startBroadcast(cfg.deployer);
// Idempotent: check if already deployed
address proxy = cfg.registry.get("MyContract");
if (proxy == address(0)) {
MyContract impl = new MyContract();
proxy = deployProxy(impl, cfg.admin);
cfg.registry.set("MyContract", proxy);
} else {
// Upgrade if needed
upgradeIfNeeded(proxy, cfg);
}
vm.stopBroadcast();
}
}The registry pattern (storing deployed addresses per environment) solves a lot of the state tracking problem. Combined with What's still missing is dependency ordering — if Contract B depends on Contract A's address, you have to manage that sequencing manually. Terraform-style dependency graphs would be ideal here. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Let's spec out a
dapp deploytool. Here are notes from @gakonst and myself.Context
Majority of smart contract deployment tools are based on procedural scripts. This mirrors old practices in compute infrastructure. Modern deployments are done via Infrastructure-as-Code (IaC) tools which allow you to define your deployment in declarative config files.
Goals
Goal of this project is to create a declarative IaC deployment tool for smart contracts that allows for consistent deployments. User should be able to describe the desired state of the deployment in a config file, and the tool should bring the current deployment to the desired state.
Existing solutions
dapp create
hardhat-deploy
Mars
Requirements:
Questions:
All reactions