FuelLabs / FuelLabs/forc

Consider adding a way to run scripts with`forc deploy`

Open
#163 3 comments 0 reactions 0 assignees View on GitHub
enhancement forc forc-client
Dominant language
Rust
Stars
0
Forks
0
Avg merge
1d 22h
Merged PRs (30d)
3

Description

I believe that `forc deploy` is the only way to deploy a sway contract.(oh, also by using the SDK :) )
Given the absence of constructors, the use of some form of initializer function is going to be common.
A known issue on ethereum when upgrading contracts is that sometimes the new contract is not initialized.

I propose adding a way to run a Sway script/scripts as part of the deployment process.
This could either be a cli options, ie `--scripts=[script_1, script_2, scripts_3]` or a new `[scripts]` field in the forc manifest.

This would allow `forc deploy` to deploy a group of contracts and set them up by calling the init function immediately.
Ideally, this whole process would be atomic and idempotent. That said, I don't know that this is 100% possible as deployment can't be done from a sway script.

Inspired by the `hardhat-deploy` plugin. It lets you add `tags` and `dependencies` to deployment/setup scripts, which lets you define the sequence in which scripts must be run. When deploying your dApp to a network, you just run the `deploy` command and everything gets deployed and initialized for you, but any scripts which have already been run against the current network won't run again. This would need to be enforced by the tooling or it would be a duplicate tx and therefore fail to run.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by examining the existing `forc deploy` command and how the `forc` manifest represents deployment configuration. Compare the proposed CLI option and `[scripts]` manifest field, including script ordering, dependencies, idempotency, and atomicity. Done means a decided design and an implemented deployment flow that can run initialization scripts reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.