Commit graph

209 commits

Author SHA1 Message Date
Hannes Karppila
1ac3514f50
Bump fuel deps (#7228)
## Description

Bumps fuel-vm, fuel-core fuels-rs and forc-wallet to latest versions.
Upgrades Rust to 2021 edition.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- I believe this is non-breaking from user code perspective but I'm not
too sure about that
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: z <zees-dev@users.noreply.github.com>
Co-authored-by: zees-dev <63374656+zees-dev@users.noreply.github.com>
Co-authored-by: JoshuaBatty <joshpbatty@gmail.com>
Co-authored-by: IGI-111 <igi-111@protonmail.com>
2025-06-23 13:05:53 +04:00
Igor Rončević
134916d5b4
Support ABI errors in forc test (#7224)
Some checks are pending
CI / check-sdk-harness-test-suite-compatibility (push) Waiting to run
CI / build-mdbook (push) Waiting to run
CI / build-forc-doc-sway-lib-std (push) Waiting to run
CI / build-forc-test-project (push) Waiting to run
CI / cargo-build-workspace (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / cargo-test-forc-debug (push) Blocked by required conditions
CI / cargo-test-forc-client (push) Blocked by required conditions
CI / cargo-test-forc-node (push) Blocked by required conditions
CI / cargo-test-sway-lsp (push) Waiting to run
CI / cargo-test-forc (push) Waiting to run
CI / cargo-test-workspace (push) Waiting to run
CI / cargo-unused-deps-check (push) Waiting to run
CI / notify-slack-on-failure (push) Blocked by required conditions
CI / pre-publish-check (push) Waiting to run
CI / publish (push) Blocked by required conditions
CI / publish-sway-lib-std (push) Blocked by required conditions
CI / Build and upload forc binaries to release (push) Blocked by required conditions
github pages / deploy (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
CI / cargo-run-e2e-test (push) Blocked by required conditions
CI / cargo-run-e2e-test-release (push) Blocked by required conditions
CI / cargo-run-e2e-test-evm (push) Waiting to run
CI / cargo-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
## Description

This PR adds support for ABI errors in `forc test`. If a unit test
reverts, the received revert code is inspected for known error signals
(e.g., coming from `assert`, or `require`) and for ABI errors.

Analysis of the received revert code is encapsulated within the
`forc_util::tx_utils::RevertInfo` struct implementation. This way, it
can be reused between the `forc test` and `forc call`. However, on the
long term, this abstraction should be moved to `fuel-abi-types`, because
its whole logic is ABI related, and it should also be shareable with the
Rust SDK.

The reason for temporary placing it within `forc-util` crate is to get
the support for ABI errors in `forc test` in the next Sway release,
without the need for a new `fuel-abi-types` release that triggers the
circular dependency between Sway and Rust SDK repositories.

Additionally, the PR unifies the display of test outputs - logs, debug
output, and reverts:
- for passing tests, none of the output is shown by default, unless
specified on the CLI.
- for failing tests, all the output is displayed in the "failures"
section.
- because the `__dbg` output is not a log, a dedicated `--dbgs` CLI
argument is added, for all ecal outputs.
- because the output of a revert now shows all available information and
not only the revert code, the `--revert-codes` CLI argument is renamed
to `--reverts`.

Closes #7089.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2025-06-10 06:57:07 +04:00
Sophie Dankel
0e3d949dbf
chore: move test deps to dev-dependencies (#7181)
Some checks failed
CI / forc-unit-tests (push) Has been cancelled
CI / build-mdbook (push) Has been cancelled
CI / build-forc-doc-sway-lib-std (push) Has been cancelled
CI / build-forc-test-project (push) Has been cancelled
CI / cargo-build-workspace (push) Has been cancelled
CI / cargo-clippy (push) Has been cancelled
CI / cargo-toml-fmt-check (push) Has been cancelled
CI / cargo-fmt-check (push) Has been cancelled
CI / cargo-run-e2e-test-evm (push) Has been cancelled
CI / cargo-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (push) Has been cancelled
CI / cargo-test-workspace (push) Has been cancelled
CI / cargo-test-sway-lsp (push) Has been cancelled
CI / cargo-test-forc (push) Has been cancelled
CI / cargo-unused-deps-check (push) Has been cancelled
CI / pre-publish-check (push) Has been cancelled
github pages / deploy (push) Has been cancelled
CI / verifications-complete (push) Has been cancelled
CI / cargo-run-e2e-test (push) Has been cancelled
CI / cargo-run-e2e-test-release (push) Has been cancelled
CI / cargo-test-forc-debug (push) Has been cancelled
CI / cargo-test-forc-client (push) Has been cancelled
CI / cargo-test-forc-node (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / build-publish-master-image (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / build-publish-release-image (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description

I noticed that some test dependencies were being included in builds
unnecessarily. This PR moves them to dev-dependencies.

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
2025-05-17 14:26:25 +12:00
João Matos
173b65b335
Upgrade CI and fix Clippy issues with Rust 1.86.0 (#7127)
## Description

As title says.

---------

Co-authored-by: IGI-111 <igi-111@protonmail.com>
2025-04-29 12:04:03 +00:00
Daniel Frederico Lins Leite
f607a674e3
More Sway compiler optimizations (#7093)
## Description

This PR is a prequel to https://github.com/FuelLabs/sway/pull/7015,
trying to optimize the compiler to alleviate the hit of having more
items, `impl` etc...

We have here two optimizations:
1 - We spend a lot of time counting newlines when converting byte
offsets to `LineCol`. Now, we calculate line offsets just once, and use
binary search later to find which line a byte offset is at.
2 - `QueryEngine::get_programs_cache_entry` was cloning the whole
`TyProgram`. That is why `did_change_with_caching` was always getting
worse, as the program was increasing in size. Now all compilation stages
are behind `Arc`, which makes the `clone` free.

## Analysis

Putting a `dbg!(...)` like the image below, and calling `counts`
(https://github.com/nnethercote/counts).

```
cargo bench -- traverse 2>&1 | grep "sway-types/src/span.rs:29:9" | counts
```


![image](https://github.com/user-attachments/assets/b0b97eb3-9ba6-47d1-9b63-f3ded4ef2978)

I get the following results:

```
972102 counts
(  1)   156720 (16.1%, 16.1%): [sway-types/src/span.rs:29:9] self.pos = 0
(  2)    15900 ( 1.6%, 17.8%): [sway-types/src/span.rs:29:9] self.pos = 104
(  3)    15840 ( 1.6%, 19.4%): [sway-types/src/span.rs:29:9] self.pos = 107
(  4)     2280 ( 0.2%, 19.6%): [sway-types/src/span.rs:29:9] self.pos = 19281
(  5)     2280 ( 0.2%, 19.9%): [sway-types/src/span.rs:29:9] self.pos = 19285
(  6)     2280 ( 0.2%, 20.1%): [sway-types/src/span.rs:29:9] self.pos = 19287
(  7)     2280 ( 0.2%, 20.3%): [sway-types/src/span.rs:29:9] self.pos = 19292
(  8)     2280 ( 0.2%, 20.6%): [sway-types/src/span.rs:29:9] self.pos = 19323
(  9)     2280 ( 0.2%, 20.8%): [sway-types/src/span.rs:29:9] self.pos = 19327
( 10)     2280 ( 0.2%, 21.0%): [sway-types/src/span.rs:29:9] self.pos = 19329
( 11)     2280 ( 0.2%, 21.3%): [sway-types/src/span.rs:29:9] self.pos = 19334
( 12)      870 ( 0.1%, 21.4%): [sway-types/src/span.rs:29:9] self.pos = 4285
...
```

This means that `line_col` is being called 972k times. 16% is for
position zero, which should be trivial. The rest will iterate the whole
file source code to count number of lines. Making the real complexity of
the work here something like `O(qty * self.pos)`. And some values of
`self.pos` are not trivial at all.

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
2025-04-21 12:36:15 -07:00
Joshua Batty
c1b63c87b2
chore: improve test_cleanup_stale_files test & add mark-flaky-tests crate (#7055)
## Description
adds the mark-flaky-tests crate so we can use `#[flaky]` above tests
that might fail. Also improves the `test_cleanup_stale_files` test which
was added in #6816

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2025-04-02 16:53:39 -03:00
Joshua Batty
bfb38f8581
Cleanup stale lock files in the .lsp-locks directory (#6816)
## Description
I noticed there were quite a few old stale lock files in the
`.lsp-locks` directory. We now check that the PID is active for each
file in this directory, if it's not active then it's removed.

## Checklist

- [ ] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
2025-03-27 20:07:56 +11:00
zees-dev
20973803db
forc-call logs support (#6968)
## Description
- Added support for viewing emitted logs when making a transaction using
forc-call
- Added `show_receipts` param (default-false) - so we can optionally
prnt out all receipts
- The CLI output becomes too long for a call with multiple receipts;
this is a minor UI enhancement

Addresses https://github.com/FuelLabs/sway/issues/6887

## Example usage/output

```sway
script;

struct ExampleParams {
    test_val: u32,
    test_str: str,
    test_tuple: (u32, u64),
}

fn main() -> u64 {
    log("hiiii");
    log(123);
    log(ExampleParams { test_val: 5, test_str: "hello world", test_tuple: (1,2) });
    5
}
```

<img width="986" alt="image"
src="https://github.com/user-attachments/assets/3725ff17-29c9-43d7-98cc-4cacfc213ecb"
/>

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: z <zees-dev@users.noreply.github.com>
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
Co-authored-by: kayagokalp <kayagokalp123@gmail.com>
2025-03-01 14:26:16 +13:00
Igor Rončević
7aa59f987c
Add forc-migrate tool (#6790)
## Description

This PR introduces `forc-migrate`, a Forc tool for migrating Sway
projects to the next breaking change version of Sway.

The tool addresses two points crucial for code updates caused by
breaking changes:
- it informs developers about the breaking changes and **assists in
planing and executing** the migration.
- it **automatically changes source code** where possible, reducing the
manual effort needed for code changes.

Besides adding the `forc-migrate` tool, the PR:
- extends `Diagnostic` to support migration diagnostics aside with
errors and warnings.
- changes `swayfmt` to support generating source code from arbitrary
lexed trees. The change is a minimal one done only in the parts of
`swayfmt` that are executed by migration steps written in this PR.
Adapting `swayfmt` to fully support arbitrary lexed trees will be done
in #6779.

The migration for the `references` feature, migrating `ref mut` to
`&mut`, is developed only partially, to demonstrate the development and
usage of automatic migrations that alter the original source code.

The intended usage of the tool is documented in detail in the "forc
migrate" chapter of The Sway Book: _Forc reference > Plugins >
forc_migrate_. (The generated documentation has issues that are caused
by the documentation generation bug explained in #6792. These issues
will be fixed in a separate PR that will fix it for all the plugins.)

We expect the `forc-migrate` to evolve based on the developer's
feedback. Some of the possible extensions of the tool are:
- adding additional CLI options, e.g., for executing only specific
migration steps, or ignoring them.
- passing parameters to migration steps from the CLI.
- not allowing updates by default, if the repository contains modified
or untracked files.
- migrating workspaces.
- migrating other artifacts, e.g., Forc.toml files or contract IDs.
- migrating between arbitrary versions of Sway.
- migrating SDK code.
- etc.
 
`forc-migrate` also showed a clear need for better infrastructure for
writing static analyzers and transforming Sway code. The approach used
in the implementation of this PR should be seen as a pragmatic
beginning, based on the reuse of what we currently have. Some future
options are discussed in #6836.

## Demo

### `forc migrate show`

Shows the breaking change features and related migration steps. This
command can be run anywhere and does not require a Sway project.

```
Breaking change features:
  - storage_domains    (https://github.com/FuelLabs/sway/issues/6701)
  - references         (https://github.com/FuelLabs/sway/issues/5063)

Migration steps (1 manual and 1 semiautomatic):
storage_domains
  [M] Review explicitly defined slot keys in storage declarations (`in` keywords)

references
  [S] Replace `ref mut` function parameters with `&mut`

Experimental feature flags:
- for Forc.toml:  experimental = { storage_domains = true, references = true }
- for CLI:        --experimental storage_domains,references
```

### `forc migrate check`

Performs a dry-run of the migration on a concrete Sway project. It
outputs all the occurrences in code that need to be reviewed or changed,
as well as the migration time effort:

```
info: [storage_domains] Review explicitly defined slot keys in storage declarations (`in` keywords)
  --> /home/kebradalaonda/Desktop/M Forc migrate tool/src/main.sw:19:10
   |
...
19 |     y in b256::zero(): u64 = 0,
   |          ------------
20 |     z: u64 = 0,
21 |     a in calculate_slot_address(): u64 = 0,
   |          ------------------------
22 |     b in 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20: u64 = 0,
   |          ------------------------------------------------------------------
   |
   = help: If the slot keys used in `in` keywords represent keys generated for `storage` fields
   = help: by the Sway compiler, those keys might need to be recalculated.
   = help:  
   = help: The previous formula for calculating storage field keys was: `sha256("storage.<field name>")`.
   = help: The new formula is:                                          `sha256((0u8, "storage.<field name>"))`.
   = help:  
   = help: For a detailed migration guide see: https://github.com/FuelLabs/sway/issues/6701
____

Migration effort:

storage_domains
  [M] Review explicitly defined slot keys in storage declarations (`in` keywords)
      Occurrences:     3    Migration effort (hh::mm): ~00:06

references
  [S] Replace `ref mut` function parameters with `&mut`
      Occurrences:     0    Migration effort (hh::mm): ~00:00

Total migration effort (hh::mm): ~00:06
``` 

### `forc migrate run`

Runs the migration steps and guides developers through the migration
process.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2025-01-20 13:14:20 +01:00
Sophie Dankel
3639c542f2
Add comments about bytecode test files (#6741)
## Description

Adding comments per
https://github.com/FuelLabs/sway/pull/6674#issuecomment-2485688098

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: JoshuaBatty <joshpbatty@gmail.com>
2024-11-20 15:11:55 +11:00
Sophie Dankel
6245ee6018
feat: add function for generating bytecode identifier (#6674)
## Description

Depends on https://github.com/FuelLabs/sway/pull/6522
Related https://github.com/FuelLabs/forc.pub/issues/16

Adds a function, `get_bytecode_id` that generates a sha256 hash of the
bytecode with the configurables section of the bytecode removed. This
will be used for indexing and lookups of the corresponding ABIs for
contracts, predicates, and scripts in the package registry (forc.pub).

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Vaivaswatha Nagaraj <vaivaswatha.nagaraj@fuel.sh>
Co-authored-by: IGI-111 <igi-111@protonmail.com>
Co-authored-by: Marcos Henrich <marcoshenrich@gmail.com>
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2024-11-19 08:49:41 -08:00
Kaya Gökalp
ccd86925f9
chore: remove uwuify feature (#6698) 2024-11-06 05:46:40 -08:00
Kaya Gökalp
9c4a339dff
chore: remove unmaintained ansi_term in favor of ansiterm (#6696)
## Description

related to #2601.

Removes ansi_term dependency from sway crates. To remove the dependency
completely from dep tree we need a release of sway repo to get a new
version of forc_util and use it in forc_wallet as forc_wallet is
depending on `forc-util v0.47.0` which uses `ansi_term`. Once that is
done we can close #2601
2024-11-06 01:42:25 -08:00
Kaya Gökalp
347c83473a
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>
2024-10-06 17:12:36 +11:00
Daniel Frederico Lins Leite
6ba98da794
fix code snippet for old diagnostics (#6507)
## Description

This PR solves a small bug when calculating the code snippets of some
diagnostics.


![image](https://github.com/user-attachments/assets/57c792ed-701d-4294-9a1e-bbdcbd524979)

## Checklist

- [ ] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
Co-authored-by: IGI-111 <igi-111@protonmail.com>
2024-09-29 10:49:28 +00:00
Alfie John
ab1e030f98
Move all crate dependencies to the workspace Cargo.toml (#6179) (#6563)
## Description

For #6179, PR #6501 kept bumping into errors as it was doing too many
things, so I've split that PR into multiple PRs. This is the first, and
the only thing it does is move all of the various `Cargo.toml`
dependencies into the single workspace `Cargo.toml`.

Future PRs will:
- Update dependency versions
- Update code that breaks from the version bumps

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2024-09-21 09:48:34 +10:00
Joshua Batty
cba9a005ef
chore: bump to v0.63.6 (#6556)
## Description
Bumps repo to v0.63.6

waiting on #6555
2024-09-18 12:45:46 -07:00
Kaya Gökalp
31a1d6f983
chore: bump to v0.63.5 (#6508)
## Description

Bumps repo to v0.63.5
2024-09-06 18:31:11 +00:00
IGI-111
2538442a67
Bump to v0.63.4 (#6503) 2024-09-05 20:30:44 +02:00
Joshua Batty
f55c81cce6
Bump to v0.63.3 (#6483) 2024-08-28 23:57:55 -07:00
IGI-111
a9e83955bc
Bump to v0.63.2 (#6476) 2024-08-28 23:06:10 +02:00
Kaya Gökalp
169f91ae0a
Bump version to 0.63.1 (#6438)
## Description

Bumps version to 0.63.1
2024-08-19 20:34:40 +00:00
Sophie Dankel
da9b323070
chore: bump to 0.63.0 (#6421)
## Description

To be merged after https://github.com/FuelLabs/sway/pull/6250

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Brandon Kite <brandonkite92@gmail.com>
Co-authored-by: IGI-111 <igi-111@protonmail.com>
2024-08-19 18:37:36 +02:00
Joshua Batty
893e59f632
chore: bump forc-pkg deps and fix clippy warnings (#6311)
## Description


## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
2024-07-31 03:19:23 -07:00
IGI-111
efda0397c7
Bump to v0.62.0 (#6276) 2024-07-18 09:13:09 +10:00
Sophie Dankel
e1b1c2bee7
Bump to v0.61.2 (#6213)
## Description

Includes critical fix https://github.com/FuelLabs/sway/pull/6212

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
2024-07-03 15:24:12 -07:00
Sophie Dankel
edff10d113
feat: Add helper function for consistent forc output (#6208)
## Description

Makes the indendation and formatting consistent for forc's action
messages.

### forc build

before

![image](08d8a30a-82a0-48f5-92d5-1b6c7329ae57)

after

![image](5dfd4b78-2f7c-47eb-92cf-5c3f518557ef)

### forc test

before

![image](6eb2d6fe-416b-47ee-97b2-bcd2fabee4db)

after

![image](68ee4bf3-7dba-4c26-b696-fd8d6ad50a98)

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
2024-07-03 13:32:25 +00:00
IGI-111
d86bb86369
Bump to v0.61.1 (#6207) 2024-07-02 23:03:30 +02:00
IGI-111
4b4fb53eb2
Bump to v0.61.0 (#6144) 2024-06-19 15:40:51 +04:00
Sophie Dankel
9d03fbd352
chore: Improve the error message for unresolved manifest reference (#6061)
## Description

Updates the error message to be more helpful when `forc build` is run
and the Forc.toml contains an invalid reference (i.e. bad git
branch/tag/rev). Also updates `forc-fmt` to use `println_error` for
consistent error display with the rest of forc.
2024-05-27 18:43:05 -07:00
IGI-111
2f0392ee35
Bump to v0.60.0 (#6049)
Co-authored-by: João Matos <joao@tritao.eu>
2024-05-22 19:34:47 +02:00
IGI-111
d9985d8111
Bump to v0.59.0 (#6030) 2024-05-17 11:29:22 +00:00
João Matos
221e18b8c7
Implement Display and DisplayWithEngines for some more types (#5999)
## Description

This PR implements `Display` and `DisplayWithEngines` for some more
types to help with debugging.

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2024-05-17 08:03:56 +00:00
IGI-111
3c86abb400
Update clap and deps to latest version (#5994)
## Description

Update clap and deps to latest version

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2024-05-14 15:35:01 +04:00
Kaya Gökalp
9579dd2f77
chore: bump to v0.58.0 (#6003)
## Description
Bumps sway repo to 0.58.0.
2024-05-13 16:44:55 -07:00
IGI-111
b939c0be73
Bump to v0.57.0 (#5993) 2024-05-13 08:19:45 +01:00
Sophie Dankel
f8e8d356be
ci: fixing typos programmatically (#5975)
## Description

Adds a CI check for typos and fixes all* typos in code, comments, and
docs.

*found by [typos-cli](https://github.com/crate-ci/typos)

`typos` doesn't catch everything, but it seems to work better than
codespell and cargo-spellcheck (fewer false positives).

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
2024-05-09 10:21:32 +10:00
IGI-111
4a63b41de1
Bump to v0.56.1 (#5974) 2024-05-08 22:26:41 +00:00
IGI-111
b495d0df69
Bump to v0.56.0 (#5919)
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2024-04-26 05:46:45 +04:00
Joshua Batty
60ea55e692
chore: bump to v0.55.0 (#5872)
## Description

waiting on #5871
2024-04-18 09:47:57 +02:00
IGI-111
d90cbc8419
Bump to v0.54.0 (#5853) 2024-04-13 04:03:01 +04:00
Joshua Batty
b30f0e83d3
chore: bump to v0.53.0 (#5831)
## Description
Bump repo to 0.53.0

waiting on #5813

Co-authored-by: IGI-111 <igi-111@protonmail.com>
2024-04-11 11:15:06 +00:00
Kaya Gökalp
c1ea517f05
chore: bump to v0.52.1 (#5822)
## Description

Bump repo to 0.52.1
2024-04-03 12:57:19 +04:00
IGI-111
98d8f4cadb
Bump to v0.52.0 (#5791) 2024-03-27 13:22:13 +04:00
Halimao
4d2379821e
refactor: forc init generate unexpected project_name when project dir contains dot (#5455)
## Description
Refer #5434

Found this issue when I tried to run `forc init --script` under a
directory(`/tmp/path_with_._dot`) that contains a dot ".". The value of
`project.name` in the generated file `Forc.toml` is truncated by the dot
"." as `path_with_`.

Since `project_dir` must be a directory(has checked before), we can use
`file_name` instead of `file_stem` to get the last-level dir name. Also,
I think it would be better to replace "." with "_", otherwise a
`project_name` that contains `.` would fail with validation
`validate_name(&project_name, "project name")?;`

## Screenshots

#### Before:

![image](b6073a20-81ea-45cb-9b58-842e43cb3257)

#### After:

![image](4c48fffd-8da6-473c-b738-1ab2721dd53b)


## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
2024-03-21 13:25:05 +11:00
César D. Rodas
bf8d8a4379
Continue even if the lsp cannot acquire an exclusive lock (#5740)
## Description

Before this PR the lsp will throw an error if it can't acquire a lock,
instead, log the error and continue gracefully.

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
2024-03-18 19:34:30 +00:00
César D. Rodas
c1c25014f9
Implement Pid file locking (#5676)
## Description

Fixes #5633

Added functionality to create and manage a lock file containing the
process ID (pid) of the running instance of the software. This mechanism
prevents multiple instances of the software from running simultaneously
by checking the existence and content of the lock file. If the lock file
exists and contains a valid pid, the struct will error gracefully to
avoid conflicts. If the lock file is missing or contains an invalid pid,
the struct will proceed by removing the file. This ensures that only one
instance of the software can run at a time and it avoids stale locking
to prevent future instances


## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2024-03-06 23:59:59 +00:00
IGI-111
d1e8f019c1
Revert to cc 1.0.83 and bump to 0.51.1 (#5649)
cc version 1.0.86 has a bug that blocks our cross compilation pipeline
https://github.com/rust-lang/cc-rs/issues/964
2024-02-23 08:59:26 +03:00
IGI-111
694457da6a
Bump to v0.51.0 (#5647) 2024-02-22 19:12:42 +00:00
Sophie Dankel
304317cc4a
Format release targets output (#5608)
## Description

Solves [1] and [2] of https://github.com/FuelLabs/sway/issues/5607

fuel target

![image](44e4a877-919d-4046-8095-51a5788994c8)

other targets

![image](069945a4-be75-4516-a720-a6a8e3c92b73)

## Checklist

- [x] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
2024-02-14 00:49:24 +00:00