Skip to content

Commit 347c834

Browse files
kayagokalpJoshuaBattysdankel
authored
feat: add blob deployments for scripts and predicates (#6607)
## Description This PR adds support for deploying executables, namely predicates and scripts. Before this PR executing `forc-deploy` on a script or predicate was an hard error. With this PR we are enabling the deployment of them via converting them to a loader which loads the original bytecode deployed as a blob. The loader binaries are serialized to disk under `out` folder for both predicates and scripts. For predicates we also save the root of the loader additionally. Every output related to generated `loader` is suffixed with `-loader` so that it can be distinguished easily. --------- Co-authored-by: Joshua Batty <joshpbatty@gmail.com> Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
1 parent d399580 commit 347c834

File tree

20 files changed

+1447
-304
lines changed

20 files changed

+1447
-304
lines changed

Cargo.lock

Lines changed: 49 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,24 @@ fuel-abi-types = "0.7"
8686
# Although ALL verions are "X.Y", we need the complete semver for
8787
# fuel-core-client as the GitHub Actions workflow parses this value to pull down
8888
# the correct tarball
89-
fuel-core-client = { version = "0.36.0", default-features = false }
90-
fuel-core-types = { version = "0.36", default-features = false }
89+
fuel-core-client = { version = "0.37.0", default-features = false }
90+
fuel-core-types = { version = "0.37", default-features = false }
9191

9292
# Dependencies from the `fuels-rs` repository:
93+
9394
fuels = "0.66"
9495
fuels-core = "0.66"
9596
fuels-accounts = "0.66"
9697

9798
# Dependencies from the `fuel-vm` repository:
98-
fuel-asm = "0.57"
99-
fuel-crypto = "0.57"
100-
fuel-types = "0.57"
101-
fuel-tx = "0.57"
102-
fuel-vm = "0.57"
99+
fuel-asm = "0.58"
100+
fuel-crypto = "0.58"
101+
fuel-types = "0.58"
102+
fuel-tx = "0.58"
103+
fuel-vm = "0.58"
103104

104105
# Dependencies from the `forc-wallet` repository:
105-
forc-wallet = "0.9"
106+
forc-wallet = "0.10"
106107

107108
#
108109
# External dependencies

docs/book/src/forc/plugins/forc_client/index.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,25 @@ If an `address` is present, `forc` calls into that contract to update its `targe
179179

180180
## Large Contracts
181181

182-
For contracts over 100KB, `forc-deploy` will split the contract into chunks and deploy the contract with multiple transactions using the Rust SDK's [loader contract](https://github.com/FuelLabs/fuels-rs/blob/master/docs/src/deploying/large_contracts.md) functionality. Chunks that have already been deployed will be reused on subsequent deployments.
182+
For contracts over the maximum contract size limit defined by the network, `forc-deploy` will split the contract into chunks and deploy the contract with multiple transactions using the Rust SDK's [loader contract](https://github.com/FuelLabs/fuels-rs/blob/master/docs/src/deploying/large_contracts.md) functionality. Chunks that have already been deployed will be reused on subsequent deployments.
183+
184+
## Deploying Scripts and Predicates
185+
186+
`forc deploy` now supports deploying scripts and predicates in addition to contracts. These are deployed as blobs with generated loaders for efficiency.
187+
188+
Scripts and predicates are deployed automatically when you run `forc deploy` on a project that contains them. The deployment process differs slightly from contract deployment:
189+
190+
1. For scripts and predicates, the bytecode is uploaded as a blob.
191+
2. A loader is generated that can load and execute the blob.
192+
3. The loader bytecode is saved in the project's output directory.
193+
194+
After deployment, you'll find new files in your project's output directory:
195+
196+
- For scripts: `<script_name>-loader.bin`
197+
- For predicates: `<predicate_name>-loader.bin` and `<predicate_name>-loader-root`
198+
199+
The loader files contain the bytecode necessary to load and execute your script or predicate from the deployed blob.
200+
201+
This new deployment method allows for more efficient storage and execution of scripts and predicates on the Fuel network.
202+
203+
Note: Contracts are still deployed directly, not as blobs given that the contract size is under the maximum contract size limit defined by network.

0 commit comments

Comments
 (0)