Commit graph

525 commits

Author SHA1 Message Date
rashad
effc60dfb7
Change verbosity from debug -> info in forc init (#2244)
Co-authored-by: Rashad Alston <rashad@Rashads-MBP.attlocal.net>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: Chris O'Brien <57543709+eureka-cpu@users.noreply.github.com>
2022-07-11 15:11:07 -07:00
Mohammad Fawaz
ada0d294a6
Bump to v0.18.0 (#2268) 2022-07-08 19:12:28 -04:00
Mohammad Fawaz
5f95c72d77
Bump to fuels 0.17.0 (#2273) 2022-07-08 21:35:56 +00:00
Mohammad Fawaz
7740b0085a
Some code golf (#2271) 2022-07-08 17:18:22 -04:00
Joshua Batty
51aabb1197
Return a CompileResult & a CompileAstResult from forc_pkg::check (#2220)
allows forc_pkg::check to return a tuple of CompileResult and CompileAstResult
2022-07-08 00:18:11 +00:00
mitchmindtree
fbeba258f5
forc-pkg: Refactor BuildPlan construction and validation to minimize fetching, improve offline support, reduce I/O, fix bugs. (#2234)
* BuildPlan generation from lock file does not break when there is a dependency removal from manifest file.

* While removing the deleted nodes handle orphaned childs

* removed debug println

* removed_deps removed from BuildPlan

* While checking from parent's manifest check for package name as well

* removed unnecessary reference

* split validate into generate_diff and validate

* apply_pkg_diff visits nodes to delete in reverse BFS order

* docs added for generate_diff

* removed unnecessary logic in apply_diff_after_lock

* doc updates

* clippy && extra dereferencing removed

* Apply suggestions from code review effor -> effort

Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>

* duplicate code removed

* change visibility of apply_pkg_diff and from_lock to private

* doc updated

* patch checks are added

* check for patches corrected

* lsp uses load_from_manifest, from_lock_file is private

* add use::collections::HashSet

* WIP Improve `BuildPlan` graph reconstruction

* Minimise I/O by replacing BuildProfile's PathMap with a ManifestMap

This commit reduces the number of times that we need to read each
dependency's manifest from file in order to reduce the amount of I/O
performed. Each dependency's manifest should now only be loaded once
during either `graph_to_manifest_map` or `fetch_graph`.

This required implementing `Clone` for `ManifestFile` to allow for
constructing the build plan in a manner that does not require consuming
the manifest file. `ManifestFile::clone` should only ever be called for
the root node.

As a side-effect, the `build` and `check` commands no longer require
loading each package's manifest as they are already provided by the
build plan. As a result both commands no longer require the sway git
tag to be passed through.

* Ensure only one edge between a package and each dependency

* Ensure lock is updated if path child dependencies change

* Address clippy nits

* Address formatting nits

* Improve accuracy of dependency removal by invalidating by edges

Previously, all dependency nodes were removed in the case that they were
invalid for any one of their parents.

This commit changes the behaviour to not remove the node, but rather
each invalid dependency *edge* instead. This means that if a node is
valid for one parent but not another, only the edge to the other parent
is removed and not the whole node itself. The node is only removed in
the case that it is invalid for all of its parents.

This is necessary for handling the case where a dependency no longer
exists in one parent's `[dependencies]` but still exists in another. The
most common case for this is `std`, as many nodes may depend on `std`
however we don't want to remove `std` and have to re-fetch it just
because one of the nodes removed their depenency on it.

* Avoid visiting a node's dependencies multiple times during validation

* Improve name and docs for BuildPlan constructors

* Remove unnecessary path root validation from Lock::to_graph.

This is checked during the `validate_graph` phase.

Also improves a bunch of comments.

Co-authored-by: kayagokalp <kaya.gokalp@fuel.sh>
Co-authored-by: Chris O'Brien <57543709+eureka-cpu@users.noreply.github.com>
Co-authored-by: Kaya Gökalp <kayagokalp@sabanciuniv.edu>
2022-07-07 09:49:58 +10:00
John Adler
9dc04fca7f
Fix and clean up forc reference docs. (#2233)
* Fix and clean up forc reference docs.

* Revert path surround change.

* Surround with backticks.
2022-07-06 00:49:00 +00:00
Toby Hutton
823707d593
Move all the sway_to_ir tests from sway_core to the integration tests. (#2211) 2022-07-04 14:27:04 +00:00
Mohammad Fawaz
b81bcd9652
Bump to v0.17.0 (#2174)
* bump to 0.17.0

* Also run cargo update
2022-07-01 15:12:20 -04:00
rashad
fd3a96f13b
Distinguish between forc init and forc new (Copy over changes from PR#1669) (#2175)
* Copy over changes from PR#1669

* Rework `forc new` in terms of `forc init`

This removes all of the duplicated logic from the `forc new` command in
favour of re-using the `forc init` op.

* Add missing doc

* Add missing comment

Co-authored-by: Rashad Alston <rashad@Rashads-MacBook-Pro.local>
Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>
Co-authored-by: Rashad Alston <rashad@Rashads-MBP.attlocal.net>
2022-07-01 10:09:07 -07:00
Braqzen
2597a02d84
Bump sway-core to use fuel-asm version 0.6 (#2193)
* Bumped to 0.6, removed CIMV, CTMV & SLDC opcodes
2022-07-01 12:30:34 +00:00
Alex Hansen
2e9c381924
Fix new clippy lints. (#2192)
appease clippy
2022-06-30 22:32:19 +01:00
João Matos
92ec0a655b
Improvements around forc plugins command (#1969)
Use the full path of the plugin when parsing it for a description.

This avoids the following panic caused by trying to exec an executable
in a sub-folder with a partial path:

```
~/dev/sway/target/debug$ forc plugins
Installed Plugins:
thread 'main' panicked at 'Could not get plugin description.: Os { code:
2, kind: NotFound, message: "No such file or directory" }',
forc/src/cli/commands/plugins.rs:43:10
stack backtrace:
   0: rust_begin_unwind
at
/rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
at
/rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
at
/rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1785:5
   3: core::result::Result<T,E>::expect
at
/rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1035:23
   4: forc::cli::commands::plugins::parse_description_for_plugin
at
/home/joao/dev/sway/forc/src/cli/commands/plugins.rs:40:16
   5: forc::cli::commands::plugins::format_print_description
at
/home/joao/dev/sway/forc/src/cli/commands/plugins.rs:81:23
   6: forc::cli::commands::plugins::print_plugin
at
/home/joao/dev/sway/forc/src/cli/commands/plugins.rs:97:5
   7: forc::cli::commands::plugins::exec
at
/home/joao/dev/sway/forc/src/cli/commands/plugins.rs:28:21
```
2022-06-29 20:02:33 +00:00
Emir
719310db43
remove fuels-abigen-macro dependency (#2007)
* add remove fuels-abigen-macro dependency

* add change dep. versions

* add fuel 0.16

* add fuel-core-lib flag

* add fuel-core-lib flag fix

* add fuel-core-lib flag fix

* add fuel-core-lib flag fix

* add fuel-core-lib flag fix

* add remove -- form forc test command

* add replace constants

* add expand CI command

* add fix tests

* add fix tests

* Update test/src/sdk-harness/Cargo.toml

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* Update test/src/sdk-harness/Cargo.toml

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* Update test/src/sdk-harness/Cargo.toml

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* add return -- cmd

* add remove fuels-abigen-macro from tests

* add remove fuel-core-lib flag

* add fuel-core-lib flag

* add reverte CI file

* add remove features

* add remove [features]

* add merge master

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-06-28 00:12:51 +00:00
Mohammad Fawaz
8421507fde
Enable storage initializers and emit a storage initialization JSON (#2078)
* Enable storage initializers and dump out a JSON file

* Move the new functions into a separate storage module

* Use StorageSlot directly from fuel-tx

* forc deploy now uses the storage slots

* add some tests

* lint, change initializers -> slots, and fixing some tests

* enhance a comment

* Revert unneeded changes to sway-types

* add a failing test

* Fix failing test

* renaming some functions

* Test the storage slots JSON in e2e tests and add forc json-storage-slots command

* ignore *_output.json

* forc documenter changes

* Remove forc json-storage-slots and stop relying on forc json-abi

* Enhance some comments

* Remove unnecessary oracle
2022-06-27 02:18:34 +00:00
Mohammad Fawaz
7920330d34
Bump to v0.16.2 (#2105)
* bump to v0.16.2

* Fix one test not pointing to local std
2022-06-24 15:02:08 -04:00
seem-less
a43aec0d3f
Adding --time-phases to forc build (#2091)
* make items under [project] ordered alphabetically in forc.toml

* issue #1893store/show bytecode hash

* formatted

* added cargo lock file

* cargo toml dependencies in alphabetical order

* hash bin of script or predicate only

* format

* generating bytecode hash only on scripts and predicates

* removed option from Compiled::tree_type

* ran clippy

* added to forc_build documentation

* made filename suffix containing bin hash a constant

* get root of predicate bytecode

* Apply suggestions from code review

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>

* if let to match on program type

* Update forc/src/cli/commands/build.rs

updating bin-root filename

Co-authored-by: mitchmindtree <mail@mitchellnordine.com>

* added benchmarks for compilation process

* use macro instead of closure for wrapping parts of compilation process

Co-authored-by: Waseem G <contact@waseem-g.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: mitchmindtree <mail@mitchellnordine.com>
Co-authored-by: Toby Hutton <toby@grusly.com>
2022-06-24 18:28:39 +10:00
mitchmindtree
91b8eee120
forc: Improve the print_*_asm CLI option docs (#2095)
Previously, these implied no bytecode was generated if the flag was not
set, however this is not the case.
2022-06-23 12:32:19 +00:00
mitchmindtree
289f30184d
Refactor forc_pkg::BuildConfig -> BuildProfile, fix CLI arg handling (#2094)
Previously, if any of the `print` args were set, the rest of the
selected build profile was ignored. This changes the behaviour so that
the command line arguments only override their associated build profile
fields.

Also renames `BuildConfig` to `BuildProfile` and moves it from
`forc_pkg::pkg` to `forc_pkg::manifest` along with the rest of the
serializable manifest types.
2022-06-23 16:28:14 +10:00
Joshua Batty
bdfb7449ca
Add forc check command (#2026)
* wip

* moving back to PC computer

* adding check function to forc pkg

* have ast returning from forc pkg

* can now successfully parse all sway examples

* fmt

* added forc check

* tidy up lsp tests

* add forc check command

* forc ops doesnt need to be public

* tidy up lsp tests

* remove non relevant code

* rebase on master

* add Cargo.lock file

* add forc check to mdbook
2022-06-21 22:15:57 -05:00
Mohammad Fawaz
dcf22453ae
Bump to v0.16.1 (#2037)
Bump to 0.16.1
2022-06-17 23:03:40 +03:00
Mohammad Fawaz
948f7aba42
Bump to v0.16.0 (#1998)
bump to 0.16.0
2022-06-16 13:30:17 -04:00
seem-less
0896721cac
Getting root hash for predicates when building (#2002)
* make items under [project] ordered alphabetically in forc.toml

* issue #1893store/show bytecode hash

* formatted

* added cargo lock file

* cargo toml dependencies in alphabetical order

* hash bin of script or predicate only

* format

* generating bytecode hash only on scripts and predicates

* removed option from Compiled::tree_type

* ran clippy

* added to forc_build documentation

* made filename suffix containing bin hash a constant

* get root of predicate bytecode

* Apply suggestions from code review

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>

* if let to match on program type

* Update forc/src/cli/commands/build.rs

updating bin-root filename

Co-authored-by: mitchmindtree <mail@mitchellnordine.com>

Co-authored-by: Waseem G <contact@waseem-g.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: mitchmindtree <mail@mitchellnordine.com>
2022-06-16 10:43:04 -04:00
rashad
00a9224833
forc run simulate txs (#1845)
* forc run simulate txs

* Update simulate opt

Co-authored-by: Rashad Alston <rashad@Rashads-MacBook-Pro.local>
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-06-16 02:09:55 +00:00
Mohammad Fawaz
ff94ce3064
Don't emit hashes for predicates (#1992)
don't emit hashes of predicates
2022-06-15 14:02:31 +00:00
seem-less
6974597fb8
Store/show bytecode hash (#1913) 2022-06-14 21:33:04 +00:00
Mohammad Fawaz
43c25665fb
bump to fuels 0.15 (#1921) 2022-06-10 04:06:41 -07:00
Mohammad Fawaz
eab07e48bc
Bump to v0.15.2 (#1920) 2022-06-09 14:37:56 -04:00
Toby Hutton
3a3ff326eb
Fix for accidentally skipping the print_intermediate_asm user config item. (#1905) 2022-06-08 06:39:16 +00:00
seem-less
f38bd95efb
make items under [project] ordered alphabetically in forc.toml (#1885)
Co-authored-by: Waseem G <contact@waseem-g.com>
2022-06-06 21:39:14 -04:00
Mohammad Fawaz
a34b4b99fc
bump to 0.15.1 (#1871) 2022-06-06 13:45:20 -04:00
Mohammad Fawaz
ee7822c411
bump to v0.15.0 (#1835) 2022-06-06 11:45:18 -04:00
Kaya Gökalp
257f1d7473
Introduce forc build [profile]s in anticipation of introduction of compiler optimisation passes (#1800)
* build profiles introduced

* CLI commands override selected build profile.

* documentation fixes & output folder name

* doc updated

* doc updated

* build-profiles -> build-profile

* Update docs/src/forc/manifest_reference.md

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* release profile is no longer silent

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-06-05 13:27:09 +03:00
JC
913afb0b68
Generate ABI JSONs for scripts (#1838)
* Use assert_matches to show errors during tests

* Generate ABI JSONs for scripts
2022-06-04 18:14:51 +03:00
Kaya Gökalp
d76dbef0dd
welcome colors back to default (#1837) 2022-06-03 15:49:11 +03:00
Kaya Gökalp
775b2c7a89
On Forc.toml change, forc should try to update only package nodes that appear in the lock::Diff (#1686) 2022-06-02 09:00:39 +03:00
Emily Herbert
2e4323e431
Remove old codegen path. Refactor files in current codegen path for readability. (#1802) 2022-06-01 21:39:06 -05:00
Mohammad Fawaz
60c626cf48
bump to 0.14.5 (#1793) 2022-06-01 16:19:51 -04:00
Mohammad Fawaz
b067a7dd64
bump to v0.14.4 (#1753) 2022-05-28 14:52:01 -04:00
Mohammad Fawaz
17f856bfa0
bump to 0.14.3 (#1749) 2022-05-28 14:07:02 -04:00
Kaya Gökalp
8c6b91fb9e
forc run output is formatted such that key! types and data fields are… (#1717)
* forc run output is formatted such that key! types and data fields are printed as hex strings

* json abis updated (needed because of preserve_order)

* Receipts are serialized as a single valid JSON, preserve_order removed

* json ABIs reverted to original
2022-05-28 00:03:46 +03:00
Emily Herbert
6fc5c69f29
v0.14.2 (#1737) 2022-05-27 14:03:29 -05:00
Alex Hansen
02ef7d10b6
v0.14.1 (#1715) 2022-05-26 22:58:56 -07:00
John Adler
953dad9cad
Bump to v0.14.0. (#1714) 2022-05-26 21:12:03 -07:00
John Adler
bb50517d9b
Bump fuels-rs init version. (#1708) 2022-05-26 23:51:53 -04:00
John Adler
609bcb42cc
Bump fuel-core to v0.8, and sub-deps. (#1683)
* Bump fuel-core to v0.8, and sub-deps.

* Fixes for new version.

* Fix u64 ops test.

* Fix u128 test.

* fix contract ids in test scripts

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
2022-05-26 11:25:39 -04:00
Mohammad Fawaz
dac1b96419
bump to v0.13.2 (#1668) 2022-05-25 18:01:21 -04:00
Braqzen
c2c952ba6c
Updated welcome message colors (#1662)
* Updated welcome message colors
2022-05-25 16:39:42 +01:00
Mohammad Fawaz
6429911e73
Adding jnzi to parse_bytecode and fixing some notes (#1654)
* adding jnzi to parse_bytecode and fixing some notes

* bump to fuel-asm 0.5
2022-05-25 10:54:03 -04:00
Alex Hansen
38a857f83c
v0.13.1 (#1651)
* v0.13.1

* update lockfile
2022-05-24 06:45:53 -07:00