Commit graph

525 commits

Author SHA1 Message Date
Mohammad Fawaz
598bbf6785
Bump to v0.28.0 (#3114) 2022-10-25 17:31:02 +11:00
bing
642c4b01dd
refactor(forc): extract tracing utils from forc-util into dedicated forc-tracing (#3108)
closes #3107 

For the motivation for this PR, refer to the issue linked above.

This PR extracts all `tracing` related util functions from `forc-util`
and puts them into a dedicated `forc-tracing` crate. There is a minor
code change
[here](https://github.com/FuelLabs/sway/pull/3108/files#diff-fb650e8292a5d6bc84d8a261393ff2cabe324b5162c40ee5cf23af57ff4dcf58R161-R164)
because it is the only place that `forc-explore` uses `forc-util` (so we
can eliminate the dependency entirely), but other than that this PR is
mostly just moving code around and updating deps as required for crates
dependent on the moved `tracing` utils.

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2022-10-24 11:10:21 +00:00
Sophie Dankel
6421a55229
[LSP] Replace logging with tracing (#2925)
Related https://github.com/FuelLabs/sway/issues/2286

Replacing the tower_lsp logging with calls to the `tracing` lib.

Added an option to `init_tracing_subscriber` to allow all tracing logs
to be piped through stderr instead of split between stderr/stdio.
Because the main thread in the LSP uses stdio to communicate with the
LSP client, tracing logs must go through stderr.

<img width="1018" alt="image"
src="https://user-images.githubusercontent.com/47993817/193706774-2868ee6a-f62d-4a6e-b137-4aff09214536.png">

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2022-10-24 05:34:11 +00:00
Mohammad Fawaz
40f1e79de0
Bump to v0.27.0 (#3100)
https://github.com/FuelLabs/sway/pull/2909 is technically breaking for
someone previoysly using `not()` directly, so I'm releasing `0.27.0`
instead of `0.26.1`.

Pending:
- [x] https://github.com/FuelLabs/sway/pull/3099
- [x] https://github.com/FuelLabs/sway/pull/3096
- [x] https://github.com/FuelLabs/sway/pull/3091
- [x] https://github.com/FuelLabs/sway/pull/3080
- [x] `cargo update`
2022-10-23 20:30:18 -04:00
Joshua Batty
2b63c30bea
LSP synchronize workspace (#2919)
Previously, the language server was falling out of sync with the users
current workspace edits. For example, incorrect syntax highlighting can
be seen in the below image if the user creates a new line above the
function. The syntax then takes on the previous highlighting and all
other attributes like definition locations, warnings/error locations
etc..

<img width="700" alt="Screen Shot 2022-10-12 at 12 39 47 pm"
src="https://user-images.githubusercontent.com/1289413/195230126-9942e54a-5f61-4a3f-9efa-cf1d21653615.png">

This was happening because we load the project from disk and then get
ASTs to work with from the compiler from these files. As the users
workspace does not match the files saved on disk, then incorrect `Span`s
are in the AST. To get around this, we are cloning the users workspace
into a temporary directory on initialization of the server. On each
keystroke or edit, we update the temp files and save to disk so that we
can get an accurate AST back from the compiler for the language server
to work with. The temp directory is synchronized with the users
workspace on each did_save event.

Finally, we spawn a tokio thread and use the `notify` crate to look for
changes to the projects `Forc.toml` file. We then convert any
dependencies that have a relative path to an absolute path.

closes #2847

I've added error handling now as #2968 was merged before this one was
approved.
2022-10-14 21:24:54 +11:00
Mohammad Fawaz
f05d7f6416
Bump to v0.26.0 (#3023)
Also run `cargo update`
2022-10-13 13:32:01 -04:00
Emily Herbert
0bb2b50237
Move ty definitions to the ty module. (#3024) 2022-10-13 15:28:53 +00:00
Mohammad Fawaz
f51d3f484e
Remove the --generate-logged-types flag (#2987) 2022-10-12 14:29:03 +11:00
mitchmindtree
dab1c74b2a
Remove Rust integration testing behaviour from forc test in anticipation of unit testing support (#2264)
This PR is a WIP that aims to address the first 3 steps in #1833.

This is in anticipation of using `forc test` to support unit testing
(rather than Rust integration testing) #1832.

The `forc test` command remains for now, but outputs a message
explaining that the command is now reserved for unit testing and links
to the issues above.

## TODO

- [x] Create a new `sway-test-rs` repo or similar that can be used as a
`cargo generate` template.
- [x] Update Rust integration testing docs in the Sway book to describe
how to use the `cargo generate` command to easily add Sway integration
testing to an existing Rust project.

## Follow-up

- Create a `forc-test-rs` crate that re-exports and extends `fuels` with
useful `forc` functionality for integration testing (e.g. re-exporting
`forc_pkg::build` to ensure sway code is built and available under
`out/` at the start of testing).
2022-10-10 12:27:13 +11:00
Mohammad Fawaz
dfa6224932
Bump to v0.25.2 (#2973)
Another quick release to publish
https://github.com/FuelLabs/sway/pull/2972 to unblock the SDK team.
Pending
- [x] https://github.com/FuelLabs/sway/pull/2972
2022-10-07 11:20:52 -04:00
Kaya Gökalp
c27135ffee
Refactor manifest handling around forc-pkg to accommodate workspace manifest files (#2894) 2022-10-07 11:51:53 +03:00
Emily Herbert
4740fb2f9b
Rename the Typed nodes to Ty nodes (#2954) 2022-10-07 00:50:03 +02:00
Mohammad Fawaz
cc9740bea1
Bump to v0.25.1 (#2959)
Mainly to publish https://github.com/FuelLabs/sway/pull/2947
2022-10-06 11:18:52 -04:00
Mohammad Fawaz
0f84734f6f
Bump to v0.25.0 (#2942)
- Also ran `cargo update`.

Pending:
- [x] https://github.com/FuelLabs/sway/pull/2941
- [x] https://github.com/FuelLabs/sway/pull/2940
- [x] https://github.com/FuelLabs/sway/pull/2890
2022-10-05 15:38:50 -04:00
Mohammad Fawaz
897e70b5a1
Bump to fuels v0.25.0 (#2935) 2022-10-04 21:23:41 -04:00
Sophie Dankel
e6afd8987e
Add --log-level and --silent to forc (#2870)
Closes https://github.com/FuelLabs/sway/issues/2375
https://github.com/FuelLabs/sway/issues/2362

Related https://github.com/FuelLabs/sway/pull/2798

1. adds a global `--log-level` option.

1. changes "forc completions --shell" short form from "-s" to "-S"
because "-s" is now globally the short form of "--silent"
1. similarly, changes "forc addr2line --search-dir" short from from "-s"
to "-S"
1. adds a global `--silent` option to all forc commands and renames the
old silent mode to "terse mode".

What used to be called silent mode was not really silent; it would still
output 1 line if there were warnings or errors during the build (for
example, during CI runs).
 
There is still a need for a non-global option for terse mode because the
test harness runs the build commands directly (without the CLI), so
there's no way to pass the global options into the command (for example,
`forc::test::forc_check::check` which takes a `forc::cli::CheckCommand`
argument).

I can't simply set the log level to "ERROR" for the test harness
(effectively like a terse mode) because it would be applied to all tests
running in that thread, and some of the tests depend on the INFO output
to stdout to determine if the test passed. To have separate log levels
for `ir_generation` and `e2e_vm_tests`, we'd have to separate those into
separate build steps.
2022-09-28 23:16:58 +00:00
Mohammad Fawaz
e695606d88
Bump to v0.24.5 (#2840)
Co-authored-by: Toby Hutton <toby@grusly.com>
2022-09-24 08:22:05 -04:00
Nick Furfaro
ce68e6646c
Bump sdk version in stdlib test suite (#2831) 2022-09-23 12:30:03 +10:00
Sophie Dankel
56dc0f4105
Make verbose flag a global option in forc (#2798)
Closes https://github.com/FuelLabs/sway/issues/2305

Adds the `--verbose` flag to all forc commands and makes it so
`tracing::debug` logs shows when `-v` or `--verbose` is used, and
`tracing::trace` logs show when `-vv` is used.

If both `RUST_LOG` and the verbose flag are set, the verbose flag takes
precedence.

Tested with permutations of:
```
cargo run -p forc -- clean --verbose
cargo run -p forc -- init -vv
```

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
Co-authored-by: Kaya Gökalp <kayagokalp@sabanciuniv.edu>
2022-09-22 19:10:15 +00:00
Mazdak Farrokhzad
a324023d4c
Recover on type checked AST with errors (#2724)
Works towards https://github.com/FuelLabs/sway/issues/1674.
2022-09-21 17:36:20 +02:00
Alex Hansen
c8ce718782
0.24.4 (#2794)
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
2022-09-16 08:43:02 -04:00
Mohammad Fawaz
95cd150cac
Bump to v0.24.3 (#2766)
Bump to v0.24.3
2022-09-12 11:44:19 -04:00
Mohammad Fawaz
057e83aee8
Bump to v0.24.2 (#2756)
Bump to v0.24.2

Co-authored-by: Alex Hansen <alex@alex-hansen.com>
2022-09-09 11:57:27 -04:00
Mohammad Fawaz
54e1a340e6
Bump to v0.24.1 (#2747)
Bump to 0.24.1
2022-09-07 17:40:03 -04:00
Mohammad Fawaz
0a66f0160e
Disable the generation of logged types in the JSON ABI by default (#2744)
Disable the generation of logged types in the JSON ABI by default and
hide it behind a flag
2022-09-07 11:53:51 -05:00
Mohammad Fawaz
ea4f1b7885
Bump to v0.24.0 (#2730)
* bump to v0.24.0

* Merge with master
2022-09-06 13:01:12 -04:00
Mohammad Fawaz
b696495c8f
Bump to v0.23.0 (#2703)
bump to 0.23.0

Co-authored-by: Alex Hansen <alex@alex-hansen.com>
2022-09-02 18:20:32 -04:00
Mohammad Fawaz
1473001885
Bump to fuels v0.22.0 and remove the "-flat" from the name of the JSON ABI file (#2701)
Bump to fuels 0.22.0 and remove the "-flat" from the name of the JSON ABI file
2022-09-02 12:04:54 -04:00
Mohammad Fawaz
c486eabc3e
Bump to v0.22.1 (#2685)
bump to v0.22.1
2022-08-31 22:54:46 -04:00
Mohammad Fawaz
6e1fbca21f
Bump to v0.22.0 (#2673)
* Bump to v0.22.0

* Update lock file
2022-08-31 21:49:35 -04:00
Mohammad Fawaz
889b0eeb16
Replace old JSON ABI format with the new one (#2660)
Change the default JSON ABI format
2022-09-01 11:03:10 +10:00
Nick Furfaro
11fd90a14d
Refactor std::tx to use gtf intrinsic (#2482)
* feat: add all gtf const values

* cleanup: remove offset consts and doc comments

* refactor: update tx_type()

* refactor: update tx_script_gas_price()

* refactor: update tx_script_gas_limit()

* refactor: update tx_maturity()

* refactor: remove tx_byte_price()

* refactor: update tx_script_length()

* refactor: update tx_script_data_length()

* refactor: update tx_inputs_count()

* refactor: update tx_outputs_count()

* refactor: update tx_witnesses_count()

* refactor: update tx_receipts_root()

* refactor: update tx_script_start_pointer()

* refactor: update tx_script_data_start_pointer()

* refactor: update tx_script_data()

* refactor: update tx_script_bytecode()

* refactor: update tx_input_pointer()

* refactor: update & rename tx_input_type()

* refactor: update tx_input_owner()

* cleanup" remove redundant tx_input_type() function

* refactor: update tx_predicate_data_start_pointer()

* refactor: rename get_predicate_data()

* refactor: update fn predicate_data() to be generic

* feat: add fn tx_coin_predicate_data_start_pointer()

* refactor: update tx_output_pointer()

* refactor: update tx_output_type()

* refactor: remove tx_output_type_from_pointer()

* refactor: update tx_output_amount()

* refactor: update fn tx_id()

* refactor: hardcode index 0 for tx field getters

* fix: refactor predicate_data & fix implementation

* docs: add GTF hex values to function docs

* docs: commment out consts and make into comments

* Revert "docs: commment out consts and make into comments"

This reverts commit bdca7bbf36.

* cleanup

* cleanup: consts

* feat: add witness related functions to tx

* feat: add mod inputs to std

* Docs: Add high level module docs

* refactor: remove unused imports

* refactor: move all input consts to imputs.sw

* refactor: remove input-related stuff from tx.sw

* refactor: move inputs to inputs.sw

* refactor: complete move of inputs

* reafactor: input owner functions

* refactor: move input predicate data func to inputs

* refactor: extract 2 predicate data functions

* feat: add fn input_coin_output_index

* feat: add fn input_coin_amount()

* chore: cleanup

* refactor: switch to using __gtf intrinsic

* fix: update calls to read() with turbofish

* refactor: use read() consistently

* fix: semicolon

* fixup

* refactor: make tx_gas_price() general-purpose

* refactor: use gtf for fn tx_type()

* refactor: make tx_gas_limit() general purpose

* refactor: make tx_maturity() general purpose.

* refactor: make tx_inputs_count() general purpose.

* fix: use correct type for __gtf

* refactor: fix tx_script length to return an option.

* refactor: switch tx_script_data_length() to return option

* refactor: update fn tx_outputs_count() to use gtf

* refactor: make inputs/outputs count fns general

* refactor: update fn tx_receipts_root() return type

* refactor: update fn tx_script_data_start_pointer() return type

* docs: add comments to tx_type()

* chore: cleanup

* feat: make fn tx_input_pointer() general purpose

* fix: add GTF_OUTPUT_TYPE const

* feat: refactor tx_id() to use gtf intrinsic

* feat: refactor fn tx_input_type() to use gtf

* refactor: switch fn tx_input_owner() to use gtf

* refactor: make predicate_data() use gtf intrinsic

* refactor: make tx_output_pointer() general purpose

* refactor: use gtf intrinsic in tx_output_type()

* refactor: update tx_output_amount() to use gtf

* refactor: revert rather than returning None

* feat: add fn tx_witness()

* docs: add notes

* fix: uncomment const GTF_OUTPUT_TYPE

* refactor: change tx_type to return enum

* fixup

* refactor: rename tx_witness to tx_witness_pointer

* refactor: add enum Output and modify tx_output_type

* refactor: complete tx refactor with new enum types

* refactor: update token.sw to handle enum returns from tx.sw

* refactor: update auth.sw to handle enum returns from tx.sw

* fix: update calls to read()

* fix: add get_predicate_data() back

* test: update tx_field tests

* cleanup

* refactor:start to move funcs to inputs module

* refactor: split out all inputs related things

* feat: add outputs module and refactor

* cleanup

* refactor: move & rename tx_outputs_count()

* fix: changes to fix compile errors

* fix: changes to fix compile errors

* fix: update token & auth modules

* fix: cleanup duplicate function

* fix: update read() calls with type annotations

* test: update tests to handles stdlib changes

* chore: update test/ cargo manifest & lock

* chore: update sdk-harness/ cargo manifest & tests

* chore: update forc/ cargo manifest & lock

* chore: update forc-pkg/ & sway-core/ cargo manifests & lock

* chore: update sway-types/ cargo manifest & lock

* chore: update test-sig-gen-util/ cargo manifest & lock

* chore: update fuel-core in ci.yaml

* cleanup: remove x.. opcodes from allocated_ops.rs

* fix: complete removal of X.. opcodes from allocated_ops

* chore: remove X.. opcodes from virtual_ops and mod.rs

* resolve type annotation

* refactor: remove byte_price & static_contracts

* chore: bump fuel-core to 0.10.1 in ci.yml

* fix: trying to update harness.rs in e2e tests

* chore: add builder feature to fuel-tx dep

* test: fix test harness

* style: clippy

* fix: remove X.. opcodes from op_codes.rs

* fix: remove X.. opcodes from sway-parse/op_codes

* fix: remove byte_price from parameters.rs

* chore: commit updated cargo lockfile

* fix: improve fn naming consistency

* test:  set index to 0

* chore: update lockfile

* test: fix tests to work with patched SDK

* chore: restore cargo manifest file to patchless version

* test: update auth testing contract

* test: update tx_fields tests

* chore: patch SDK with local branch

* temp: add logging to repro while-loop bug

* fixup: temp logs

* chore: bump to SDK v0.21

* test: update tests to use new wallet api

* chore: bump forc-util

* chore: fix merge-conflict in cargo.lock

* test: fix some tx_field tests

* cleanup

* test: cleanup tx_output_type test

* Remove unused deps

* Remove more unused deps

* Restore some deps

* Fix can_get_script_start_offset test

* fix get_tx_id test

* fix can_get_tx_output_type test

* Fix can_get_tx_input_coin_owner test

* Disable mint/transfer tests and hopefully resolve the unused deps issue

* Re-enable the token tests as they actually work now with a fix to token.sw

* Some clean up and removing untested functions

* Add some useful comments and return None as the owner of a message input

* remove dead constants

* fmt

* update the lock file

* Update the SDK version for forc new

* cleanup: remove logging from token.sw

* cleanup: remove stale TODO from test

* style: consolidate imports in test file

* Update comments for output_amount to point to a github issue

* Using if let instead of a match statement

* Link to github issue for testing

* Update some constants based on the old spec until the new spec is implemented

Co-authored-by: Alex Hansen <alex@alex-hansen.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: João Matos <joao@tritao.eu>
2022-08-31 12:59:45 +00:00
Mohammad Fawaz
32b5b142b5
Bump to v0.21.0 (#2651)
Bump to v0.21.0

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2022-08-29 22:02:51 -04:00
Mohammad Fawaz
59255e9783
Remove forc json-abi because it's not very useful on its own (#2580) 2022-08-19 11:03:00 +00:00
Mohammad Fawaz
6a8116fcee
Bump to v0.20.2 (#2584)
Bump to v0.20.2
2022-08-18 23:40:55 -04:00
Mohammad Fawaz
21887f4b32
Bump to v0.20.1 (#2578)
* Add forc client metadata to Cargo.toml

* bump to v0.21.1
2022-08-18 15:02:14 -07:00
Emily Herbert
fc3a05d87d
Bump to v0.20.0 (#2565)
* bump to v0.20.0

* run cargo update and update forc-client

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
2022-08-18 15:25:28 -04:00
Mohammad Fawaz
0f5d4d7292
Fixing the defaults for forc new (#2573)
Fixing the defaults for forc new
2022-08-18 16:43:49 +00:00
Kaya Gökalp
1ed1cf1fa0
Split client interaction commands into a forc-client plugin (#2440) 2022-08-18 01:46:12 +00:00
bing
73fc0b563f
Fix link to Forc reference in the repo (#2513) 2022-08-11 09:19:53 +08:00
Kaya Gökalp
2bccbd5234
refactor: move build logic to forc-pkg from forc (#2478) 2022-08-09 12:05:06 -05:00
Mohammad Fawaz
6808861389
Bump to v0.19.2 (#2481)
bump to v0.19.2
2022-08-08 15:47:20 -06:00
Nick Furfaro
3b9413f4ba
bump sdk version to v0.20 in stdlib tests and forc (#2466)
* chore: bump SDK to 19

* chore: bump SDK to 0.18

* test: update syntax to use builder pattern for contract instantiation

* fix: use StorageConfiguration::default() where needed

* style: fmt

* test: update tests to handle Beck32 changes

* test: start to swap use of &client for &provider in scripts

* chore: bump SDK to 0.19 in forc defaults.rs

* fix: add inputs for utxo validation (#2469)

* chore: update forc default.rs to use v0.20 SDK

* chore: bump SDK to v0.20

Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
2022-08-06 07:29:40 -07:00
mitchmindtree
2816c13698
Move the SWAY_GIT_TAG from forc into forc-pkg (#2448)
Move the SWAY_GIT_TAG from `forc` into `forc-pkg`

Closes #2447.

See this comment for context:
https://github.com/FuelLabs/sway/pull/2440#discussion_r936144091
2022-08-03 16:33:55 +10:00
João Matos
541adf2654
Add an option to print the typed program AST. (#2444)
This adds a new `--print-ast` option which prints the typed program AST.

You can use it via: `cargo run --bin forc -- build --print-ast --path
test > test.ast`

Spans and Idents are a bit verbose by default, which can be improved
by commenting a few lines in their Debug trait implementation.

Co-authored-by: Alex Hansen <alex@alex-hansen.com>
Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2022-08-02 14:11:04 -07:00
Mohammad Fawaz
1202e790c1
Bump to v0.19.1 (#2437)
Bump to v0.19.1
2022-08-01 11:11:46 -04:00
Kaya Gökalp
7491159983
Forc init appends to .gitignore rather than overriding it (#2406) 2022-07-28 19:38:35 -05:00
Mohammad Fawaz
5c716e1ba5
Bump to v0.19.0 (#2393)
Bump to v0.19.0
2022-07-27 20:00:33 -04:00
Mohammad Fawaz
f90b9f8d3d
Switch forc new to create a test that uses a wallet with some coins in it (#2332) 2022-07-15 00:10:32 -04:00
Mohammad Fawaz
3bd8eaf4a0
Bump to v0.18.1 (#2304)
bump to v0.18.1
2022-07-11 23:23:17 -04:00