mirror of
https://github.com/FuelLabs/sway.git
synced 2025-12-23 10:11:56 +00:00
1425 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5030b17a66 | update tests | ||
|
|
e40705a945 | fix runtime memory layout of string arrays | ||
|
|
84d73ce112 | update tests | ||
|
|
a9f9835243 | update tests | ||
|
|
89c1b12b11 | update tests | ||
|
|
a8293d99b9 | fix tests | ||
|
|
88a494c0a5 | fix runtime memory layout of string arrays | ||
|
|
6cc563d763
|
Trivial fns allowing control if a type is trivially encoded/decoded (#7501)
Some checks are pending
CI / check-dependency-version-formats (push) Waiting to run
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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 / publish-sway-lib-std (push) Blocked by required conditions
CI / Build and upload forc binaries to release (push) Blocked by required conditions
CI / Build and test various forc tools (push) Blocked by required conditions
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 / build-forc-test-project (push) Waiting to run
CI / cargo-build-workspace (push) Waiting to run
CI / cargo-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (push) Waiting to run
CI / cargo-run-e2e-test-release (push) Blocked by required conditions
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
CI / forc-pkg-fuels-deps-check (push) Waiting to run
github pages / deploy (push) Waiting to run
## Description
Continuation of https://github.com/FuelLabs/sway/pull/7488.
This PR introduces the option for each type to control its own
`is_trivial`.
Primitive data types have direct implementation (only decoding bool is
false, as we need to guarantee its value is zero or one).
Structs, tuples, arrays etc... are trivial if their runtime
representation and "inner types" allow for trivial encoding or decoding.
Enums are more complicated as we need to control that the enum tag is
valid; they are not trivial.
String arrays are not trivially encoded/decoded for backwards
compatibility with "encoding v0" that needs padding in some cases.
Some tests are showing a small regression (6 gas), which comes from the
introduced "if" not being optimised away. I want to solve this in
another PR, where the "if" condition will come from a const, and IR
generation will guarantee that only one branch will ever be emitted.
## Snapshot "echo"
Small QOL of snapshot was introduced with the "echo" command. It just
prints the message directly, wrapping on 80 chars. The idea is to
explain what the snapshot is trying to test.
## 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).
- [ ] I have requested a review from the relevant team or maintainers.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Add per-type trivial encode/decode flags and use raw_ptr fast paths in
ABI (encode/decode) with supporting changes to codec, String/Vec, and
tests.
>
> - **std/codec**:
> - Introduce `AbiEncode::is_encode_trivial` and
`AbiDecode::is_decode_trivial`; add helpers
`is_encode_trivial/is_decode_trivial`.
> - Switch `encode`/`abi_decode` to branch on triviality; add
`decode_from_raw_ptr` and raw-ptr-based `decode_*` helpers.
> - Make `BufferReader` parameter accessors return `raw_ptr`; minor
refactors to use raw ptr copies.
> - Implement triviality for primitives, arrays/tuples (conditional),
`str[strN]` non-trivial, enums non-trivial.
> - **std/string & std/vec**: implement trivial encode/decode markers
(non-trivial) and adapt codec impls.
> - **Tests/fixtures**:
> - Update snapshots (IR/ASM/bytecode/gas), JSON ABI offsets,
contract/predicate IDs, and logging expectations to match new encoding
paths.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
|
||
|
|
b4fa78d60a
|
Trait coherence: disallow inherent impls on external types (#7385)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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 and test various forc tools (push) Blocked by required conditions
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 / cargo-build-workspace (push) Waiting to run
CI / cargo-clippy (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
github pages / deploy (push) Waiting to run
CI / publish-sway-lib-std (push) Blocked by required conditions
CI / Build and upload forc binaries to release (push) Blocked by required conditions
CI / build-forc-test-project (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
This improves the trait coherence checks for impl self case, and polishes a bit of the wording on the existing diagnostics. We now enforce package-level check in impl-self type checking, which means we now reject inherent impls for external nominal types (struct/enum). There is still is a specialized whitelist for `StorageKey` so current code that uses this pattern keeps working. ## 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). - [ ] 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. |
||
|
|
4a44a36718
|
Enable references tests and adjust them for zero sized unit type (#7513)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR enables `language/references` and `stdlib` tests that were disabled because of the #6898. It also adjusts the `language/references` tests to the change introduced in #7509, which changes unit to be a zero-sized type. ## 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). - [ ] 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. |
||
|
|
3f3fa379d0
|
Enable const generics as true by default (#7512)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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 / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
## Description The final step before closing https://github.com/FuelLabs/sway/issues/6860. The `const_generics` feature flag will be fully removed in a separate PR. ## 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: Igor Rončević <ironcev@hotmail.com> |
||
|
|
5e179b304e
|
Fix size of ZSTs (#7509)
Some checks failed
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description This PR will improve https://github.com/FuelLabs/sway/pull/7501 by fixing the size of `()`, which affects enums with all variants as `unit`. With units occupying one byte, their runtime memory representation ends up being different from their encoding representation, which avoids trivial encode/decode optimisation of some types. Another benefit of this PR is that we do not need to generate anything for `store` of zero bytes. Unfortunately, we cannot remove the `load` instruction, as registers will be uninitialized on their first usage. For that, we simply emit a `MOVI`, zeroing the register. I cannot think of a case where this change is a problem. We never promised any specific value for ZST, so zero seems a good candidate. A new test was created to facilitate checking of types sizes, layouts and whether they can be trivially encoded/decoded or not. Especially because this PR is changing the layout of types. <img width="1629" height="799" alt="image" src="https://github.com/user-attachments/assets/608c8094-55d3-44e1-8827-420a3249690a" /> In theory, this change will affect storage. But in reality, it is highly unlikely that `unit` was being used directly on types being stored. The only use case would be enums, but enums were not changed, as they were already being treated differently. ## 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. |
||
|
|
c3e5ea7436
|
Forbid const generics log (#7510)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description Continuation of https://github.com/FuelLabs/sway/pull/7494. ## 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). - [ ] 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. |
||
|
|
dc81a4063d
|
Forbid types with const generics on configurables (#7494)
Some checks failed
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description
This PR is continuation of https://github.com/FuelLabs/sway/pull/7483.
## 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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Blocks types with const generics in configurables and ABI method
args/returns via new `TypeId::has_const_generics`, and adds tests to
enforce errors.
>
> - **Type system**:
> - Add `TypeId::has_const_generics(engines)` to detect const generics
in nested types (`sway-core/src/type_system/id.rs`).
> - **Compiler/semantics**:
> - Enforce no const generics in configurables via
`TyConfigurableDecl::forbid_const_generics()` and invoke during type
check (`semantic_analysis/.../configurable.rs`, `.../declaration.rs`).
> - Enforce no const generics in ABI method parameters/returns using
`TypeId::has_const_generics` and remove ad-hoc checker
(`language/ty/declaration/abi.rs`).
> - **Tests**:
> - Extend `should_fail/unsupported_const_generics` to cover
configurables and ABI cases; update snapshot (`test/.../stdout.snap`).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
|
||
|
|
c73137d717
|
Optionally remove test gas limit in forc test (#7495)
Some checks failed
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (push) Has been cancelled
CI / build-forc-test-project (push) Has been cancelled
CI / build-mdbook (push) Has been cancelled
CI / build-forc-doc-sway-lib-std (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / notify-slack-on-failure (push) Has been cancelled
CI / Build and test various forc tools (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description This PR adds `--no-gas-limit` CLI option to `forc test`. The option increases tx gas limit in `forc test` to `u64::MAX`, essentially removing it. The motivation for the change was the need to benchmark heavy gas consuming algorithms. E.g., a brute force prime factorization of the number 9223372021822390277 took 21_474_836_627 gas units. The new `TestGasLimit` enum provides a `Limit(limit)` variant which is currently unused, but added for future extensions, if we want to limit the test gas to a particular value. ## 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. |
||
|
|
ec51769132
|
Introduce alloc intrinsic to avoid using asm (#7499)
Some checks failed
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-toml-fmt-check (push) Has been cancelled
CI / cargo-fmt-check (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
CI / cargo-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (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 / Build and test various forc tools (push) Has been cancelled
Improvement chart: https://github.com/FuelLabs/sway/pull/7499#issuecomment-3574549744 --------- Co-authored-by: Igor Rončević <ironcev@hotmail.com> |
||
|
|
0682209578
|
Deterministic printing of IR values (#7490)
Some checks failed
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / cargo-toml-fmt-check (push) Has been cancelled
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
Closes #4517
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> IR printer now generates deterministic value IDs; tests and IR harness
updated to match new naming and ensure stable round-trips.
>
> - **IR Printer**:
> - Deterministic value naming via stable keys (`v{:?}` from
`value.0.data()`); added `slotmap::Key` import.
> - **Tests/Fixtures**:
> - Switch FileCheck regex to `VAL=v\d+v\d+` and update expectations
across IR tests/snapshots to new value IDs.
> - Tweak const-folding tests to expect `const ...` lines without
temporary names.
> - **IR Test Harness**:
> - Update default regex definitions; verify determinism by
parsing/printing twice and comparing outputs.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
|
||
|
|
78aa952535
|
Trivially encoded types (#7488)
Some checks are pending
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / verifications-complete (push) Blocked by required conditions
CI / check-dependency-version-formats (push) Waiting to run
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description
This PR will slice https://github.com/FuelLabs/sway/pull/7419 into
multiple PRS, being the first one.
To start optimising encoding/decoding we will introduce the concept of
"trivially encoded/decoded types". A type is trivially encoded or
decoded if the encoding memory representation is the same as the runtime
memory representation.
PR #7419 introduced an intrinsic that would return a `bool` if both
representations match. For this PR I decided to expose these memory
representations directly. For that we have two new intrinsics:
`__runtime_mem_id` and `__encoding_mem_id`.
I am not 100% sure if they are going to be useful in other scenarios,
but given that the optimiser is able to optimise them away, I think
exposing them like this is better than what #7419 does.
These `ids` are opaque numbers that do not convey anything about the
type or their representation. They can only be compared for equality,
and when a type does not have an encoding representation the intrinsic
returns zero.
With this in mind, the `encode` function now checks if a type is
"trivially encoded" or not. If it is, we just allocate and memcopy its
bytes. As this function should not return an aliased pointer.
On top of that, we also have an `encode_and_return` function that avoids
creating tuples and other stuff, given that the optimiser still
generates some `mem_copy`s in these cases.
A simple example of the benefit is the test `main_args_empty`, where the
binary size went from 96 bytes to 64 bytes.
Before
```
script {
pub entry fn __entry() -> __ptr slice, !3 {
local mut slice __aggr_memcpy_0
local { u64, u64 } __anon_0
local slice __ret_value
entry():
v0 = get_local __ptr slice, __ret_value
v1 = call main_0(), !6
v2 = get_local __ptr { u64, u64 }, __anon_0, !7
v3 = const u64 0
v4 = get_elem_ptr v2, __ptr u64, v3, !7
v5 = const u64 0, !8
store v5 to v4, !7
v6 = const u64 1
v7 = get_elem_ptr v2, __ptr u64, v6, !7
v8 = const u64 0, !9
store v8 to v7, !7
v9 = asm(s: v2) -> __ptr slice s {
}
v10 = get_local __ptr slice, __aggr_memcpy_0
mem_copy_val v10, v9
mem_copy_val v0, v10
ret __ptr slice v0
}
entry_orig fn main_0() -> (), !13 {
entry():
v0 = const unit ()
ret () v0
}
}
;; ASM: Final program
;; Program kind: Script
.program:
move $$tmp $pc
jmpf $zero i4
DATA_SECTION_OFFSET[0..32]
DATA_SECTION_OFFSET[32..64]
CONFIGURABLES_OFFSET[0..32]
CONFIGURABLES_OFFSET[32..64]
lw $$ds $$tmp i1
add $$ds $$ds $$tmp
cfei i0 ; allocate stack space for globals
move $$locbase $sp ; save locals base register for function __entry
cfei i48 ; allocate 48 bytes for locals and 0 slots for call arguments
addi $r0 $$locbase i32 ; get offset to local __ptr slice
jal $$reta $pc i9 ; [call]: call main_0
addi $r1 $$locbase i16 ; get offset to local __ptr { u64, u64 }
sw $$locbase $zero i2 ; store word
sw $$locbase $zero i3 ; store word
mcpi $$locbase $r1 i16 ; copy memory
mcpi $r0 $$locbase i16 ; copy memory
lw $r1 $r0 i1 ; load size of returned slice
lw $r0 $r0 i0 ; load pointer to returned slice
retd $r0 $r1
pshh i524288 ; save registers 40..64
move $$locbase $sp ; save locals base register for function main_0
poph i524288 ; restore registers 40..64
jal $zero $$reta i0 ; return from call
.data:
```
After
```
script {
pub entry fn __entry() -> __ptr never, !3 {
entry():
v0 = call main_0(), !6
v1 = const u64 0, !7
v2 = const u64 0, !8
retd v1 v2, !9
}
entry_orig fn main_0() -> (), !13 {
entry():
v0 = const unit ()
ret () v0
}
}
;; ASM: Final program
;; Program kind: Script
.program:
move $$tmp $pc
jmpf $zero i4
DATA_SECTION_OFFSET[0..32]
DATA_SECTION_OFFSET[32..64]
CONFIGURABLES_OFFSET[0..32]
CONFIGURABLES_OFFSET[32..64]
lw $$ds $$tmp i1
add $$ds $$ds $$tmp
cfei i0 ; allocate stack space for globals
move $$locbase $sp ; save locals base register for function __entry
jal $$reta $pc i2 ; [call]: call main_0
retd $zero $zero
pshh i524288 ; save registers 40..64
move $$locbase $sp ; save locals base register for function main_0
poph i524288 ; restore registers 40..64
jal $zero $$reta i0 ; return from call
.data:
```
Next PR will introduce this concept into the `AbiEncode` trait, allowing
the type itself to control if it wants to be trivially encoded or not.
# Missing optimizations
If we look at the test `main_args_various_types`, after the `main` is
called we see that IR is still not optimal.
```
v37 = get_local __ptr { u64 }, __ret_val1
v38 = call main_19(v36, v37)
v39 = get_local __ptr { u64 }, _result, !58 <- not needed
mem_copy_val v39, v37 <- not needed
v40 = get_local __ptr { u64 }, _result, !59 <- not needed
v41 = get_local __ptr { u64 }, item_, !62 <- not needed
mem_copy_val v41, v40 <- not needed
v42 = get_local __ptr { u64 }, item_, !64 <- not needed
v43 = const u64 8
retd v42 v43, !66
```
Ideally, IR would be
```
v37 = get_local __ptr { u64 }, __ret_val1
v38 = call main_19(v36, v37)
v39 = const u64 8
retd v37 v39, !66
```
## Gas Usage Diff
| Test | Before | After | Percentage |
| ---- | -----: | ----: | ---------: |
| should_fail/arith_overflow/u16_add_overflow (test.toml) | 44 | 43 |
2.27% |
| should_fail/arith_overflow/u16_mul_overflow (test.toml) | 45 | 44 |
2.22% |
| should_fail/arith_overflow/u16_sub_underflow (test.toml) | 23 | 22 |
4.35% |
| should_fail/arith_overflow/u32_add_overflow (test.toml) | 44 | 43 |
2.27% |
| should_fail/arith_overflow/u32_mul_overflow (test.toml) | 45 | 44 |
2.22% |
| should_fail/arith_overflow/u32_sub_underflow (test.toml) | 23 | 22 |
4.35% |
| should_fail/arith_overflow/u64_add_overflow (test.toml) | 17 | 15 |
11.76% |
| should_fail/arith_overflow/u64_mul_overflow (test.toml) | 18 | 16 |
11.11% |
| should_fail/arith_overflow/u64_sub_underflow (test.toml) | 16 | 14 |
12.50% |
| should_fail/arith_overflow/u8_add_overflow (test.toml) | 38 | 36 |
5.26% |
| should_fail/arith_overflow/u8_mul_overflow (test.toml) | 39 | 37 |
5.13% |
| should_fail/arith_overflow/u8_sub_underflow (test.toml) | 17 | 15 |
11.76% |
| should_fail/vec_set_index_out_of_bounds (test.toml) | 182 | 179 |
1.65% |
| should_fail/vec_swap_param1_out_of_bounds (test.toml) | 237 | 234 |
1.27% |
| should_fail/vec_swap_param2_out_of_bounds (test.toml) | 241 | 238 |
1.24% |
| should_pass/blanket_impl (test.toml) | 142 | 51 | 64.08% |
| should_pass/blanket_impl_u16 (test.toml) | 142 | 51 | 64.08% |
| should_pass/break_in_non_statement_positions (test.toml) | 142 | 51 |
64.08% |
| should_pass/conditional_compilation/run (test.toml) | 142 | 51 |
64.08% |
| should_pass/continue_in_non_statement_positions (test.toml) | 1226 |
1135 | 7.42% |
| should_pass/empty_fields_in_storage_struct
(test.toml)::test_read_write_bytes | 11204 | 10275 | 8.29% |
| should_pass/empty_fields_in_storage_struct
(test.toml)::test_read_write_map | 7865 | 7107 | 9.64% |
| should_pass/empty_fields_in_storage_struct
(test.toml)::test_read_write_vec | 11474 | 10125 | 11.76% |
| should_pass/forc/dependency_package_field (test.toml) | 137 | 46 |
66.42% |
| should_pass/language/abort_control_flow_good (test.toml) | 29 | 27 |
6.90% |
| should_pass/language/addrof_intrinsic (test.toml) | 609 | 595 | 2.30%
|
| should_pass/language/aliased_imports (test.toml) | 144 | 53 | 63.19% |
| should_pass/language/args_on_stack (test.toml) | 5037 | 4946 | 1.81% |
| should_pass/language/array/array_basics (test.toml) | 478 | 387 |
19.04% |
| should_pass/language/array/array_generics (test.toml) | 146 | 55 |
62.33% |
| should_pass/language/asm_expr_basic (test.toml) | 163 | 135 | 17.18% |
| should_pass/language/associated_const_abi (test.toml)::test | 4546 |
4096 | 9.90% |
| should_pass/language/associated_const_abi_multiple (test.toml)::test |
1510 | 1360 | 9.93% |
| should_pass/language/associated_const_impl (test.toml) | 143 | 115 |
19.58% |
| should_pass/language/associated_const_impl_local_same_name (test.toml)
| 143 | 115 | 19.58% |
| should_pass/language/associated_const_impl_self (test.toml) | 166 |
138 | 16.87% |
| should_pass/language/associated_const_in_decls_of_other_constants
(test.toml)::test | 529 | 452 | 14.56% |
| should_pass/language/associated_const_trait_impl_method (test.toml) |
143 | 115 | 19.58% |
| should_pass/language/associated_const_trait_method (test.toml) | 143 |
115 | 19.58% |
| should_pass/language/associated_type_and_associated_const (test.toml)
| 143 | 115 | 19.58% |
| should_pass/language/associated_type_ascription (test.toml) | 143 |
115 | 19.58% |
| should_pass/language/associated_type_container (test.toml) | 602 | 560
| 6.98% |
| should_pass/language/associated_type_container_in_library (test.toml)
| 602 | 560 | 6.98% |
| should_pass/language/associated_type_fully_qualified (test.toml) | 195
| 152 | 22.05% |
| should_pass/language/associated_type_iterator (test.toml) | 620 | 578
| 6.77% |
| should_pass/language/associated_type_method (test.toml) | 143 | 115 |
19.58% |
| should_pass/language/associated_type_parameter (test.toml) | 143 | 115
| 19.58% |
| should_pass/language/b256_bad_jumps (test.toml) | 137 | 46 | 66.42% |
| should_pass/language/b256_bitwise_ops (test.toml) | 1503 | 1412 |
6.05% |
| should_pass/language/b256_ops (test.toml) | 1314 | 1223 | 6.93% |
| should_pass/language/basic_func_decl (test.toml) | 136 | 45 | 66.91% |
| should_pass/language/binary_and_hex_literals (test.toml) | 136 | 45 |
66.91% |
| should_pass/language/binop_intrinsics (test.toml) | 142 | 51 | 64.08%
|
| should_pass/language/bitwise_not (test.toml) | 136 | 45 | 66.91% |
| should_pass/language/blanket_trait (test.toml) | 136 | 45 | 66.91% |
| should_pass/language/bool_and_or (test.toml) | 142 | 51 | 64.08% |
| should_pass/language/break_and_continue (test.toml) | 1098 | 1007 |
8.29% |
| should_pass/language/builtin_type_method_call (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/chained_if_let (test.toml) | 166 | 75 | 54.82% |
| should_pass/language/complex_ir_cfg (test.toml) | 158 | 142 | 10.13% |
| should_pass/language/configurable_consts (test.toml) | 2520 | 2506 |
0.56% |
| should_pass/language/configurable_tests (test.toml)::t | 2805 | 2553 |
8.98% |
| should_pass/language/const_decl_and_use_in_library (test.toml) | 142 |
51 | 64.08% |
| should_pass/language/const_decl_in_library (test.toml) | 148 | 57 |
61.49% |
| should_pass/language/const_generics (test.toml) | 318 | 305 | 4.09% |
| should_pass/language/const_inits (test.toml) | 481 | 390 | 18.92% |
| should_pass/language/contract_caller_dynamic_address (test.toml) | 379
| 301 | 20.58% |
| should_pass/language/contract_ret_intrinsic (test.toml)::test | 1464 |
1314 | 10.25% |
| should_pass/language/dereferenced_projection_reassignment (test.toml)
| 238 | 124 | 47.90% |
| should_pass/language/diverging_exprs (test.toml) | 291 | 200 | 31.27%
|
| should_pass/language/dummy_method_issue (test.toml) | 134 | 120 |
10.45% |
| should_pass/language/empty_method_initializer (test.toml) | 242 | 151
| 37.60% |
| should_pass/language/enum_destructuring (test.toml) | 156 | 65 |
58.33% |
| should_pass/language/enum_if_let (test.toml) | 221 | 130 | 41.18% |
| should_pass/language/enum_if_let_large_type (test.toml) | 201 | 110 |
45.27% |
| should_pass/language/enum_in_fn_decl (test.toml) | 157 | 66 | 57.96% |
| should_pass/language/enum_init_fn_call (test.toml) | 185 | 94 | 49.19%
|
| should_pass/language/enum_instantiation (test.toml) | 660 | 569 |
13.79% |
| should_pass/language/enum_padding (test.toml) | 518 | 487 | 5.98% |
| should_pass/language/enum_type_inference (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/enum_variant_imports (test.toml) | 161 | 70 |
56.52% |
| should_pass/language/eq_and_neq (test.toml) | 675 | 584 | 13.48% |
| should_pass/language/eq_intrinsic (test.toml) | 142 | 51 | 64.08% |
| should_pass/language/far_jumps/many_blobs (test.toml) | 3670216 |
3670125 | 0.00% |
| should_pass/language/far_jumps/single_blob (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/for_loops (test.toml) | 7882 | 7791 | 1.15% |
| should_pass/language/funcs_with_generic_types (test.toml) | 136 | 45 |
66.91% |
| should_pass/language/function_return_type_unification (test.toml) |
148 | 120 | 18.92% |
| should_pass/language/generic_functions (test.toml) | 136 | 45 | 66.91%
|
| should_pass/language/generic_impl_self (test.toml) | 740 | 712 | 3.78%
|
| should_pass/language/generic_impl_self_where (test.toml) | 790 | 699 |
11.52% |
| should_pass/language/generic_inside_generic (test.toml) | 163 | 72 |
55.83% |
| should_pass/language/generic_result_method (test.toml) | 330 | 239 |
27.58% |
| should_pass/language/generic_struct (test.toml) | 136 | 45 | 66.91% |
| should_pass/language/generic_struct_instantiation (test.toml) | 137 |
46 | 66.42% |
| should_pass/language/generic_structs (test.toml) | 136 | 45 | 66.91% |
| should_pass/language/generic_trait_constraints (test.toml) | 187 | 62
| 66.84% |
| should_pass/language/generic_traits (test.toml) | 415 | 324 | 21.93% |
| should_pass/language/generic_transpose (test.toml) | 215 | 124 |
42.33% |
| should_pass/language/generic_tuple_trait (test.toml) | 174 | 83 |
52.30% |
| should_pass/language/generic_type_inference (test.toml) | 1349 | 1335
| 1.04% |
| should_pass/language/generic_where_in_impl_self (test.toml) | 201 |
110 | 45.27% |
| should_pass/language/generic_where_in_impl_self2 (test.toml) | 201 |
110 | 45.27% |
| should_pass/language/gtf_intrinsic (test.toml) | 286 | 195 | 31.82% |
| should_pass/language/if_elseif_enum (test.toml) | 388 | 360 | 7.22% |
| should_pass/language/if_implicit_unit (test.toml) | 55 | 41 | 25.45% |
| should_pass/language/if_let_no_side_effects (test.toml) | 154 | 63 |
59.09% |
| should_pass/language/impl_self_method (test.toml) | 148 | 120 | 18.92%
|
| should_pass/language/impl_self_method_order (test.toml) | 148 | 120 |
18.92% |
| should_pass/language/implicit_casting (test.toml) | 142 | 51 | 64.08%
|
| should_pass/language/implicit_return (test.toml) | 142 | 51 | 64.08% |
| should_pass/language/import_method_from_other_file (test.toml) | 155 |
64 | 58.71% |
| should_pass/language/import_star_name_clash (test.toml) | 1039 | 948 |
8.76% |
| should_pass/language/import_trailing_comma (test.toml) | 143 | 52 |
63.64% |
| should_pass/language/import_with_different_callpaths (test.toml) | 793
| 779 | 1.77% |
| should_pass/language/impure_ifs (test.toml) | 429 | 338 | 21.21% |
| should_pass/language/inline_if_expr_const (test.toml) | 55 | 41 |
25.45% |
| should_pass/language/insert_element_reg_reuse (test.toml) | 1794 |
1703 | 5.07% |
| should_pass/language/integer_type_inference (test.toml) | 547 | 533 |
2.56% |
| should_pass/language/intrinsics/dbg (test.toml) | 1193 | 1102 | 7.63%
|
| should_pass/language/intrinsics/dbg_release (test.toml) | 9785 | 9694
| 0.93% |
| should_pass/language/intrinsics/transmute (test.toml) | 402 | 388 |
3.48% |
| should_pass/language/is_prime (test.toml) | 1047 | 956 | 8.69% |
| should_pass/language/is_reference_type (test.toml) | 136 | 45 | 66.91%
|
| should_pass/language/left_to_right_func_args_evaluation (test.toml) |
149 | 58 | 61.07% |
| should_pass/language/local_impl_for_ord (test.toml) | 136 | 45 |
66.91% |
| should_pass/language/logging (test.toml) | 2126 | 1790 | 15.80% |
| should_pass/language/main_args/main_args_empty (test.encoding_v1.toml)
| 142 | 41 | 71.13% |
| should_pass/language/main_args/main_args_empty (test.toml) | 19 | 18 |
5.26% |
| should_pass/language/main_args/main_args_generics (test.toml) | 504 |
472 | 6.35% |
| should_pass/language/main_args/main_args_one_u64 (test.toml) | 163 |
63 | 61.35% |
| should_pass/language/main_args/main_args_ref (test.toml) | 172 | 72 |
58.14% |
| should_pass/language/main_args/main_args_ref_copy (test.toml) | 181 |
81 | 55.25% |
| should_pass/language/main_args/main_args_ref_ref (test.toml) | 226 |
125 | 44.69% |
| should_pass/language/main_args/main_args_two_u64 (test.toml) | 172 |
72 | 58.14% |
| should_pass/language/main_args/main_args_various_types (test.toml) |
1283 | 1130 | 11.93% |
| should_pass/language/main_returns_unit (test.toml) | 55 | 41 | 25.45%
|
| should_pass/language/many_stack_variables (test.toml) | 151 | 60 |
60.26% |
| should_pass/language/match_expressions_all (test.toml) | 3699 | 3685 |
0.38% |
| should_pass/language/match_expressions_constants (test.toml) | 377 |
263 | 30.24% |
| should_pass/language/match_expressions_empty_enums (test.toml) | 142 |
51 | 64.08% |
| should_pass/language/match_expressions_enums (test.toml) | 2019 | 1928
| 4.51% |
| should_pass/language/match_expressions_explicit_rets (test.toml) | 136
| 45 | 66.91% |
| should_pass/language/match_expressions_inside_generic_functions
(test.toml) | 170 | 79 | 53.53% |
| should_pass/language/match_expressions_mismatched (test.toml) | 154 |
63 | 59.09% |
| should_pass/language/match_expressions_nested (test.toml) | 649 | 621
| 4.31% |
| should_pass/language/match_expressions_rest (test.toml) | 777 | 686 |
11.71% |
| should_pass/language/match_expressions_simple (test.toml) | 156 | 65 |
58.33% |
| should_pass/language/match_expressions_structs (test.toml) | 151 | 60
| 60.26% |
| should_pass/language/match_expressions_with_self (test.toml) | 163 |
72 | 55.83% |
| should_pass/language/memcpy (test.toml) | 266 | 175 | 34.21% |
| should_pass/language/method_indirect_inference (test.toml) | 218 | 127
| 41.74% |
| should_pass/language/method_nested_type_args (test.toml) | 55 | 41 |
25.45% |
| should_pass/language/method_on_empty_struct (test.toml) | 137 | 46 |
66.42% |
| should_pass/language/method_on_primitives (test.toml) | 99 | 85 |
14.14% |
| should_pass/language/method_unambiguous (test.toml) | 186 | 95 |
48.92% |
| should_pass/language/modulo_uint_test (test.toml) | 136 | 45 | 66.91%
|
| should_pass/language/multi_impl_self (test.toml) | 142 | 51 | 64.08% |
| should_pass/language/multi_item_import (test.toml) | 136 | 45 | 66.91%
|
| should_pass/language/mutable_and_initd (test.toml) | 157 | 66 | 57.96%
|
| should_pass/language/mutable_arrays (test.toml) | 142 | 51 | 64.08% |
| should_pass/language/mutable_arrays_enum (test.toml) | 153 | 62 |
59.48% |
| should_pass/language/mutable_arrays_multiple_nested (test.toml) | 137
| 46 | 66.42% |
| should_pass/language/mutable_arrays_nested (test.toml) | 137 | 46 |
66.42% |
| should_pass/language/mutable_arrays_struct (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/mutable_arrays_swap (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/name_resolution_after_monomorphization
(test.toml) | 148 | 57 | 61.49% |
| should_pass/language/nested_generics (test.toml) | 136 | 45 | 66.91% |
| should_pass/language/nested_struct_destructuring (test.toml) | 137 |
46 | 66.42% |
| should_pass/language/nested_structs (test.toml) | 279 | 188 | 32.62% |
| should_pass/language/nested_while_and_if (test.toml) | 194 | 103 |
46.91% |
| should_pass/language/new_allocator_test (test.toml) | 204 | 113 |
44.61% |
| should_pass/language/non_literal_const_decl (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/numeric_constants (test.toml) | 170 | 45 | 73.53%
|
| should_pass/language/numeric_type_propagation (test.toml) | 170 | 45 |
73.53% |
| should_pass/language/op_precedence (test.toml) | 136 | 45 | 66.91% |
| should_pass/language/ops (test.toml) | 155 | 64 | 58.71% |
| should_pass/language/out_of_order_decl (test.toml) | 136 | 45 | 66.91%
|
| should_pass/language/overlapped_trait_impls (test.toml) | 276 | 185 |
32.97% |
| should_pass/language/prelude_access (test.toml) | 55 | 41 | 25.45% |
| should_pass/language/prelude_access2 (test.toml) | 55 | 41 | 25.45% |
| should_pass/language/primitive_type_argument (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/pusha_popa_multiple_defreg
(test.toml)::incorrect_pusha_popa | 451 | 409 | 9.31% |
| should_pass/language/raw_identifiers (test.error_type.toml)::test |
903 | 738 | 18.27% |
| should_pass/language/raw_identifiers (test.toml)::test | 903 | 738 |
18.27% |
| should_pass/language/raw_ptr/vec_ret (test.toml) | 637 | 605 | 5.02% |
| should_pass/language/reassignment_operators (test.toml) | 137 | 46 |
66.42% |
| should_pass/language/reassignment_rhs_lhs_evaluation_order (test.toml)
| 202 | 89 | 55.94% |
| should_pass/language/redundant_return (test.toml) | 137 | 46 | 66.42%
|
| should_pass/language/reexport/aliases (test.toml) | 301 | 210 | 30.23%
|
| should_pass/language/reexport/multiple_imports_of_same_reexport
(test.toml) | 329 | 238 | 27.66% |
| should_pass/language/reexport/reexport_paths (test.toml) | 277 | 165 |
40.43% |
| should_pass/language/reexport/shadowing_in_reexporting_module
(test.toml) | 368 | 277 | 24.73% |
| should_pass/language/reexport/simple_glob_import (test.toml) | 216 |
125 | 42.13% |
| should_pass/language/reexport/simple_item_import (test.toml) | 216 |
125 | 42.13% |
| should_pass/language/reexport/visibility (test.toml) | 216 | 125 |
42.13% |
| should_pass/language/ref_mutable_arrays (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/ref_mutable_arrays_inline (test.toml) | 142 | 51
| 64.08% |
| should_pass/language/ref_mutable_fn_args_bool (test.toml) | 136 | 45 |
66.91% |
| should_pass/language/ref_mutable_fn_args_call (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/ref_mutable_fn_args_struct (test.toml) | 142 | 51
| 64.08% |
| should_pass/language/ref_mutable_fn_args_struct_assign (test.toml) |
142 | 51 | 64.08% |
| should_pass/language/ref_mutable_fn_args_u32 (test.toml) | 148 | 120 |
18.92% |
| should_pass/language/references/dereferencing_control_flow_expressions
(test.toml) | 652 | 540 | 17.18% |
| should_pass/language/references/impl_reference_types (test.toml) |
2084 | 1902 | 8.73% |
| should_pass/language/references/mutability_of_references (test.toml) |
233 | 142 | 39.06% |
| should_pass/language/references/mutability_of_references_memcpy_bug
(test.toml)::test | 1023 | 680 | 33.53% |
|
should_pass/language/references/reassigning_via_references_in_aggregates
(test.toml) | 2435 | 2297 | 5.67% |
| should_pass/language/references/references_and_type_aliases
(test.toml) | 222 | 131 | 40.99% |
| should_pass/language/references/references_in_aggregates (test.toml) |
3010 | 2919 | 3.02% |
| should_pass/language/references/references_in_asm_blocks (test.toml) |
800 | 709 | 11.38% |
| should_pass/language/references/referencing_control_flow_expressions
(test.toml) | 841 | 750 | 10.82% |
| should_pass/language/references/referencing_function_parameters
(test.toml) | 2292 | 2201 | 3.97% |
| should_pass/language/references/referencing_function_parameters_simple
(test.toml)::test_arg_addr | 1268 | 464 | 63.41% |
| should_pass/language/references/referencing_parts_of_aggregates
(test.toml) | 2124 | 2033 | 4.28% |
| should_pass/language/references/referencing_references (test.toml) |
417 | 326 | 21.82% |
| should_pass/language/references/type_unification_of_references
(test.toml) | 539 | 448 | 16.88% |
| should_pass/language/ret_small_string (test.toml) | 169 | 138 | 18.34%
|
| should_pass/language/ret_string_in_struct (test.toml) | 185 | 153 |
17.30% |
| should_pass/language/retd_b256 (test.toml) | 188 | 74 | 60.64% |
| should_pass/language/retd_small_array (test.toml) | 196 | 164 | 16.33%
|
| should_pass/language/retd_struct (test.toml) | 362 | 331 | 8.56% |
| should_pass/language/retd_zero_len_array (test.toml) | 107 | 75 |
29.91% |
| should_pass/language/revert_in_first_if_branch (test.toml) | 28 | 25 |
10.71% |
| should_pass/language/same_const_name (test.toml) | 55 | 41 | 25.45% |
| should_pass/language/self_impl_reassignment (test.toml) | 276 | 185 |
32.97% |
| should_pass/language/shadowing/shadowed_glob_imports (test.toml) | 178
| 87 | 51.12% |
| should_pass/language/shadowing/shadowed_prelude_imports (test.toml) |
146 | 55 | 62.33% |
| should_pass/language/size_of (test.toml) | 137 | 46 | 66.42% |
| should_pass/language/slice/slice_intrinsics (test.toml) | 123848 |
104394 | 15.71% |
| should_pass/language/slice/slice_script (test.toml) | 231 | 200 |
13.42% |
| should_pass/language/storage_slot_sized
(test.toml)::test_store_something | 7736 | 4706 | 39.17% |
| should_pass/language/string_slice/string_slice_features (test.toml) |
163 | 72 | 55.83% |
| should_pass/language/string_slice/string_slice_script (test.toml) |
264 | 232 | 12.12% |
| should_pass/language/struct_destructuring (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/struct_field_access (test.toml) | 142 | 51 |
64.08% |
| should_pass/language/struct_field_reassignment (test.toml) | 137 | 46
| 66.42% |
| should_pass/language/struct_instantiation (test.toml) | 524 | 433 |
17.37% |
| should_pass/language/supertraits (test.toml) | 1146 | 1055 | 7.94% |
| should_pass/language/supertraits_with_trait_methods (test.toml) | 151
| 60 | 60.26% |
| should_pass/language/totalord (test.toml) | 783 | 658 | 15.96% |
| should_pass/language/trait_constraint_param_order (test.toml) | 136 |
45 | 66.91% |
| should_pass/language/trait_generic_override (test.toml) | 136 | 45 |
66.91% |
| should_pass/language/trait_import_with_star (test.toml) | 55 | 41 |
25.45% |
| should_pass/language/trait_inference (test.toml) | 182 | 57 | 68.68% |
| should_pass/language/trait_method_ascription_disambiguate (test.toml)
| 136 | 45 | 66.91% |
| should_pass/language/trait_method_generic_qualified (test.toml) | 136
| 45 | 66.91% |
| should_pass/language/trait_method_qualified (test.toml) | 136 | 45 |
66.91% |
| should_pass/language/trait_nested (test.toml) | 189 | 64 | 66.14% |
| should_pass/language/tuple_access (test.toml) | 176 | 85 | 51.70% |
| should_pass/language/tuple_desugaring (test.toml) | 155 | 127 | 18.06%
|
| should_pass/language/tuple_field_reassignment (test.toml) | 168 | 77 |
54.17% |
| should_pass/language/tuple_in_struct (test.toml) | 199 | 108 | 45.73%
|
| should_pass/language/tuple_indexing (test.toml) | 143 | 115 | 19.58% |
| should_pass/language/tuple_single_element (test.toml) | 149 | 58 |
61.07% |
| should_pass/language/tuple_trait (test.toml) | 152 | 61 | 59.87% |
| should_pass/language/tuple_types (test.toml) | 148 | 120 | 18.92% |
| should_pass/language/type_alias (test.toml) | 1064 | 1050 | 1.32% |
| should_pass/language/type_inference_propagation_of_type_constraints
(test.toml) | 268 | 237 | 11.57% |
| should_pass/language/typeinfo_custom_callpath (test.toml) | 67 | 53 |
20.90% |
| should_pass/language/typeinfo_custom_callpath2 (test.toml) | 67 | 53 |
20.90% |
| should_pass/language/typeinfo_custom_callpath_with_import (test.toml)
| 69 | 55 | 20.29% |
| should_pass/language/u256/u256_abi (test.toml) | 392 | 164 | 58.16% |
| should_pass/language/unary_not_basic (test.toml) | 136 | 45 | 66.91% |
| should_pass/language/unary_not_basic_2 (test.toml) | 136 | 45 | 66.91%
|
| should_pass/language/unify_never (test.toml) | 142 | 51 | 64.08% |
| should_pass/language/unit_type_variants (test.toml) | 224 | 53 |
76.34% |
| should_pass/language/use_absolute_path (test.toml) | 137 | 46 | 66.42%
|
| should_pass/language/use_full_path_names (test.toml) | 143 | 115 |
19.58% |
| should_pass/language/where_clause_enums (test.toml) | 280 | 189 |
32.50% |
| should_pass/language/where_clause_functions (test.toml) | 453 | 362 |
20.09% |
| should_pass/language/where_clause_generic_traits (test.toml) | 55 | 41
| 25.45% |
| should_pass/language/where_clause_generic_tuple (test.toml) | 142 | 51
| 64.08% |
| should_pass/language/where_clause_impls (test.toml) | 158 | 67 |
57.59% |
| should_pass/language/where_clause_methods (test.toml) | 541 | 450 |
16.82% |
| should_pass/language/where_clause_structs (test.toml) | 254 | 163 |
35.83% |
| should_pass/language/where_clause_traits (test.toml) | 136 | 45 |
66.91% |
| should_pass/language/while_loops (test.toml) | 389 | 298 | 23.39% |
| should_pass/language/zero_field_types (test.toml) | 142 | 51 | 64.08%
|
| should_pass/return_in_non_statement_positions (test.toml) | 142 | 51 |
64.08% |
| should_pass/return_into (test.toml) | 412 | 321 | 22.09% |
| should_pass/stdlib/address_test (test.toml) | 1175 | 1084 | 7.74% |
| should_pass/stdlib/alloc_test (test.toml) | 265 | 174 | 34.34% |
| should_pass/stdlib/assert_eq (test.toml) | 1108 | 983 | 11.28% |
| should_pass/stdlib/assert_eq_revert (test.toml) | 303 | 152 | 49.83% |
| should_pass/stdlib/assert_ne (test.toml) | 1045 | 921 | 11.87% |
| should_pass/stdlib/assert_ne_revert (test.toml) | 302 | 151 | 50.00% |
| should_pass/stdlib/assert_test (test.toml) | 136 | 45 | 66.91% |
| should_pass/stdlib/asset_id_into_bytes (test.toml) | 173 | 82 | 52.60%
|
| should_pass/stdlib/b512_struct_alignment (test.toml) | 202 | 111 |
45.05% |
| should_pass/stdlib/b512_test (test.toml) | 996 | 905 | 9.14% |
| should_pass/stdlib/block_height (test.toml) | 149 | 58 | 61.07% |
| should_pass/stdlib/chess (test.toml) | 231 | 140 | 39.39% |
| should_pass/stdlib/contract_id_test (test.toml) | 174 | 83 | 52.30% |
| should_pass/stdlib/contract_id_type (test.toml) | 169 | 78 | 53.85% |
| should_pass/stdlib/eq_generic (test.toml) | 154 | 140 | 9.09% |
| should_pass/stdlib/ge_test (test.toml) | 136 | 45 | 66.91% |
| should_pass/stdlib/generic_empty_struct_with_constraint (test.toml) |
55 | 41 | 25.45% |
| should_pass/stdlib/identity_eq (test.toml) | 1274 | 1183 | 7.14% |
| should_pass/stdlib/if_type_revert (test.toml) | 26 | 24 | 7.69% |
| should_pass/stdlib/intrinsics (test.toml) | 136 | 45 | 66.91% |
| should_pass/stdlib/iterator (test.toml) | 984 | 859 | 12.70% |
| should_pass/stdlib/option_eq (test.toml) | 5291 | 5200 | 1.72% |
| should_pass/stdlib/raw_ptr (test.toml) | 4316 | 4225 | 2.11% |
| should_pass/stdlib/raw_slice (test.toml) | 424 | 392 | 7.55% |
| should_pass/stdlib/require (test.toml) | 182 | 165 | 9.34% |
| should_pass/stdlib/storage_vec_insert (test.toml)::test_test_function
| 2903 | 2754 | 5.13% |
| should_pass/stdlib/u128_div_test (test.toml) | 34133 | 34042 | 0.27% |
| should_pass/stdlib/u128_log_test (test.toml) | 11809 | 11718 | 0.77% |
| should_pass/stdlib/u128_mul_test (test.toml) | 453 | 362 | 20.09% |
| should_pass/stdlib/u128_root_test (test.toml) | 7634 | 7543 | 1.19% |
| should_pass/stdlib/u128_test (test.toml) | 2177 | 2086 | 4.18% |
| should_pass/stdlib/vec (test.toml) | 65253 | 65162 | 0.14% |
| should_pass/stdlib/vec_swap (test.toml) | 14862 | 14771 | 0.61% |
| should_pass/storage_element_key_modification
(test.toml)::test_storage_key_address | 943 | 863 | 8.48% |
| should_pass/storage_element_key_modification
(test.toml)::test_storage_key_modification | 465 | 385 | 17.20% |
| should_pass/storage_slot_key_calculation (test.toml)::test | 2785 |
2708 | 2.76% |
| should_pass/superabi_contract_calls (test.toml)::tests | 1310 | 1004 |
23.36% |
| should_pass/superabi_supertrait_same_methods (test.toml)::tests | 634
| 483 | 23.82% |
| should_pass/test_abis/abi_impl_methods_callable (test.toml)::tests |
599 | 449 | 25.04% |
| should_pass/test_abis/contract_abi-auto_impl (test.toml)::tests | 599
| 449 | 25.04% |
| should_pass/test_contracts/basic_storage
(test.toml)::collect_basic_storage_contract_gas_usages | 37164 | 35842 |
3.56% |
| should_pass/test_contracts/increment_contract
(test.toml)::collect_incrementor_contract_gas_usages | 2006 | 1628 |
18.84% |
| should_pass/test_contracts/return_struct
(test.toml)::collect_my_contract_gas_usages | 1076 | 1000 | 7.06% |
| should_pass/test_contracts/storage_access_contract
(test.toml)::collect_storage_access_contract_gas_usages | 49894 | 44857
| 10.10% |
| should_pass/test_contracts/storage_enum_contract
(test.toml)::collect_storage_enum_contract_gas_usages | 22372 | 22213 |
0.71% |
| should_pass/unit_tests/aggr_indexing (test.toml)::test1 | 4192 | 2082
| 50.33% |
| should_pass/unit_tests/contract-multi-contract-calls
(test.toml)::test_contract_2_call | 631 | 480 | 23.93% |
| should_pass/unit_tests/contract-multi-contract-calls
(test.toml)::test_contract_call | 634 | 483 | 23.82% |
| should_pass/unit_tests/contract-multi-contract-calls
(test.toml)::test_contract_multi_call | 1246 | 944 | 24.24% |
| should_pass/unit_tests/contract_multi_test (test.toml)::test_bar | 175
| 68 | 61.14% |
| should_pass/unit_tests/contract_multi_test (test.toml)::test_fail |
635 | 484 | 23.78% |
| should_pass/unit_tests/contract_multi_test (test.toml)::test_success |
633 | 482 | 23.85% |
| should_pass/unit_tests/contract_with_nested_libs (test.toml)::log_test
| 180 | 184 | -2.22% |
| should_pass/unit_tests/contract_with_nested_libs
(test.toml)::log_test_inner | 180 | 184 | -2.22% |
| should_pass/unit_tests/contract_with_nested_libs
(test.toml)::log_test_inner2 | 173 | 67 | 61.27% |
| should_pass/unit_tests/lib_log_decode
(test.toml)::math_u16_overflow_mul | 214 | 218 | -1.87% |
| should_pass/unit_tests/lib_log_decode
(test.toml)::math_u32_overflow_mul | 214 | 218 | -1.87% |
| should_pass/unit_tests/lib_log_decode (test.toml)::test_fn | 362 | 146
| 59.67% |
| should_pass/unit_tests/lib_multi_test (test.toml)::test_gt | 156 | 82
| 47.44% |
| should_pass/unit_tests/lib_multi_test (test.toml)::test_local | 156 |
82 | 47.44% |
| should_pass/unit_tests/nested_libs (test.toml)::log_test | 179 | 183 |
-2.23% |
| should_pass/unit_tests/nested_libs (test.toml)::log_test_inner | 179 |
183 | -2.23% |
| should_pass/unit_tests/nested_libs (test.toml)::log_test_inner2 | 172
| 66 | 61.63% |
| should_pass/unit_tests/regalloc_spill (test.toml) | 181 | 90 | 50.28%
|
| should_pass/unit_tests/script-contract-calls
(test.toml)::test_contract_call | 563 | 448 | 20.43% |
| should_pass/unit_tests/script_log_decode (test.toml)::test_fn | 294 |
146 | 50.34% |
| should_pass/unit_tests/script_with_nested_libs (test.toml)::log_test |
179 | 183 | -2.23% |
| should_pass/unit_tests/script_with_nested_libs
(test.toml)::log_test_inner | 179 | 183 | -2.23% |
| should_pass/unit_tests/script_with_nested_libs
(test.toml)::log_test_inner2 | 172 | 66 | 61.63% |
| should_pass/unit_tests/workspace_test (test.toml)::test_bar | 175 | 68
| 61.14% |
| should_pass/unit_tests/workspace_test (test.toml)::test_fail | 635 |
484 | 23.78% |
| should_pass/unit_tests/workspace_test (test.toml)::test_gt | 156 | 82
| 47.44% |
| should_pass/unit_tests/workspace_test (test.toml)::test_local | 156 |
82 | 47.44% |
| should_pass/unit_tests/workspace_test (test.toml)::test_success | 634
| 483 | 23.82% |
| | Improvements | Regressions |
| - | -: | -: |
| Count | 346 | 8 |
| Average | 34.98% | -2.14% |
| Median | 28.79% | -2.23% |
| Max | 76.34% | -2.23% |
| Min | 0.14% | -1.87% |
| Test | Before | After | Percentage |
| ---- | -----: | ----: | ---------: |
| assert_inline_tests::assert_assert_eq | 1576 | 1529 | 2.98% |
| assert_inline_tests::assert_assert_ne | 1630 | 1585 | 2.76% |
| assert_inline_tests::revert_assert_assert_eq | 1480 | 1117 | 24.53% |
| assert_inline_tests::revert_assert_assert_ne | 1488 | 1115 | 25.07% |
| asset_id_contract_tests::asset_id_default | 10994 | 10696 | 2.71% |
| bytes_inline_tests::bytes_append | 5789 | 5787 | 0.03% |
| bytes_inline_tests::bytes_split_at_twice | 1321 | 1319 | 0.15% |
| codec_implemented_tests::test_logging | 51837 | 23126 | 55.39% |
| contract_id_contract_tests::contract_id_this | 10787 | 10488 | 2.77% |
| crypto_ed25519_inline_tests::ed25519_codec | 6125 | 640 | 89.55% |
| crypto_secp256k1_inline_tests::secp256k1_codec | 6125 | 640 | 89.55% |
| crypto_secp256r1_inline_tests::secp256r1_codec | 6125 | 640 | 89.55% |
| crypto_signature_inline_tests::signature_as_ed25519 | 6840 | 6841 |
-0.01% |
| crypto_signature_inline_tests::signature_as_secp256r1 | 6836 | 6837 |
-0.01% |
| crypto_signature_inline_tests::signature_codec | 7748 | 654 | 91.56% |
| crypto_signature_inline_tests::signature_verify | 43208 | 43205 |
0.01% |
| hash_inline_tests::hash_address | 7223 | 7211 | 0.17% |
| hash_inline_tests::hash_asset_id | 7223 | 7211 | 0.17% |
| hash_inline_tests::hash_b256 | 7171 | 7159 | 0.17% |
| hash_inline_tests::hash_call_params | 6930 | 6924 | 0.09% |
| hash_inline_tests::hash_contract_id | 7223 | 7211 | 0.17% |
| hash_inline_tests::hash_evm_address | 7407 | 7395 | 0.16% |
| hash_inline_tests::hash_identity | 17767 | 17743 | 0.14% |
| hash_inline_tests::hash_point2d | 9311 | 9305 | 0.06% |
| hash_inline_tests::hash_signature | 20238 | 20220 | 0.09% |
| hash_inline_tests::hash_str | 10508 | 10505 | 0.03% |
| hash_inline_tests::hash_tuple_4 | 8499 | 8497 | 0.02% |
| hash_inline_tests::hash_u128 | 5160 | 5154 | 0.12% |
| hash_inline_tests::hash_user_defined_type | 42799 | 42787 | 0.03% |
| storage_vec_iter_tests::empty_vec_next_returns_none | 50784 | 50644 |
0.28% |
| storage_vec_iter_tests::storage_vec_field_for_loop_iteration | 1574940
| 1573470 | 0.09% |
| storage_vec_iter_tests::storage_vec_field_nested_for_loop_iteration |
11570183 | 11559644 | 0.09% |
| storage_vec_iter_tests::vec_with_elements_for_loop_iteration |
24015966 | 24011576 | 0.02% |
| storage_vec_iter_tests::vec_with_elements_next_returns_element |
24016001 | 24011606 | 0.02% |
| u128_inline_tests::parity_u128_log_with_ruint | 1851450 | 1850539 |
0.05% |
| u128_inline_tests::revert_u128_zero_root | 232 | 230 | 0.86% |
| u128_inline_tests::revert_u128_zero_root_overflow_disabled | 238 | 236
| 0.84% |
| u128_inline_tests::u128_log | 24393 | 24391 | 0.01% |
| u128_inline_tests::u128_pow | 8902 | 8900 | 0.02% |
| u128_inline_tests::u128_root | 13907 | 13872 | 0.25% |
| u128_inline_tests::u128_zero_root_unsafe_math | 452 | 450 | 0.44% |
| | Improvements | Regressions |
| - | -: | -: |
| Count | 39 | 2 |
| Average | 12.33% | -0.01% |
| Median | 0.17% | -0.01% |
| Max | 91.56% | -0.01% |
| Min | 0.01% | -0.01% |
## 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)
- [ ] 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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Introduce `__runtime_mem_id`/`__encoding_mem_id` intrinsics and use
them to trivially encode/return values, updating ABI entry to `never`,
improving gas/binary size, and adjusting docs, IR, and tests.
>
> - **Core/Compiler**:
> - Add intrinsics `__runtime_mem_id<T>() -> u64` and
`__encoding_mem_id<T>() -> u64` (AST, semantic, IR gen, const-eval).
> - Implement memory-representation modeling and ID hashing
(`get_memory_representation`, `get_memory_id`,
`get_encoding_representation`/`id`).
> - Update ABI entry generation to return `never` and use direct `retd`.
> - Extend IR parser/types with `never`.
> - **Std Library (`codec.sw`)**:
> - `encode<T>`: detect trivially-encodable types (matching IDs) and
`memcpy` bytes; otherwise fallback to normal encoding.
> - Add `encode_and_return<T>() -> !` using `__contract_ret` for fast
returns.
> - **Docs**:
> - Document `__transmute`, `__runtime_mem_id`, and `__encoding_mem_id`
in the Sway book; include constraints/semantics.
> - **Tests/Fixtures**:
> - Update many snapshots, gas/bytecode expectations, raw log
PCs/pointers, and release flags.
> - Refresh expected contract IDs in require-deployment tests.
> - Notable size/gas reductions across numerous tests; `main_args_empty`
shrinks (e.g., 96→64 B) and many gas wins.
> - **Misc**:
> - Minor utilities (e.g., const-generic length literal extraction) and
effect tracking for new intrinsics.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
|
||
|
|
fb10b2fcb1
|
Forbid const generics on abis (#7483)
Some checks failed
CI / forc-unit-tests (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-toml-fmt-check (push) Has been cancelled
CI / cargo-fmt-check (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-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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description
This PR forbids "const generics" on `abi`s. The reason is that to
correctly support it, we will need to introduce changes to the ABI json.
This will be reserved to the future.
## 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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is
generating a summary for commit
|
||
|
|
886becbca0
|
Add a new memcpy propagation pass (#7443)
Some checks failed
CI / cargo-fmt-check (push) Has been cancelled
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (push) Has been cancelled
CI / pre-publish-check (push) Has been cancelled
github pages / deploy (push) Has been cancelled
CI / Build and test various forc tools (push) Has been cancelled
CI / publish-sway-lib-std (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 / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description For the Sway code in #7344, the IR after #7381 and after this PR is shown here: <details> <summary> After #7381, before this PR </summary> ``` fn wrapper_1(__ret_value: __ptr { b256 }) -> (), !17 { local { u64, ( () | { b256 } ) } __matched_value_4 local { u64, ( () | { b256 } ) } __ret_val local { u64, ( () | { b256 } ) } self_ entry(__ret_value: __ptr { b256 }): v0 = get_local __ptr { u64, ( () | { b256 } ) }, __ret_val v1 = call return_option_5(v0) v2 = get_local __ptr { u64, ( () | { b256 } ) }, self_, !20 mem_copy_val v2, v0 v3 = get_local __ptr { u64, ( () | { b256 } ) }, self_, !23 v4 = get_local __ptr { u64, ( () | { b256 } ) }, __matched_value_4, !25 mem_copy_val v4, v3 v5 = get_local __ptr { u64, ( () | { b256 } ) }, self_ v6 = const u64 0 v7 = get_elem_ptr v5, __ptr u64, v6 v8 = load v7, !20 v9 = const u64 1, !22 v10 = cmp eq v8 v9, !28 cbr v10, unwrap_2_block0(), unwrap_2_block1(), !29 unwrap_2_block0(): v11 = get_local __ptr { u64, ( () | { b256 } ) }, __matched_value_4, !30 v12 = const u64 1 v13 = const u64 1 v14 = get_elem_ptr v11, __ptr { b256 }, v12, v13, !20 mem_copy_val __ret_value, v14 v15 = const unit () ret () v15 unwrap_2_block1(): v16 = const u64 0, !31 revert v16, !36 } fn return_option_5(__ret_value: __ptr { u64, ( () | { b256 } ) }) -> (), !39 { local { u64, ( () | { b256 } ) } __anon_0 entry(__ret_value: __ptr { u64, ( () | { b256 } ) }): v0 = get_local __ptr { u64, ( () | { b256 } ) }, __anon_0, !40 v1 = const u64 0 v2 = get_elem_ptr v0, __ptr u64, v1, !40 v3 = const u64 0, !40 store v3 to v2, !40 mem_copy_val __ret_value, v0 v4 = const unit () ret () v4 } ``` </details> <details> <summary> After this PR </summary> ``` fn wrapper_1(__ret_value: __ptr { b256 }) -> (), !17 { local { u64, ( () | { b256 } ) } __matched_value_4 entry(__ret_value: __ptr { b256 }): v0 = get_local __ptr { u64, ( () | { b256 } ) }, __matched_value_4 v1 = call return_option_5(v0) v2 = get_local __ptr { u64, ( () | { b256 } ) }, __matched_value_4 v3 = const u64 0 v4 = get_elem_ptr v2, __ptr u64, v3 v5 = load v4, !20 v6 = const u64 1, !22 v7 = cmp eq v5 v6, !25 cbr v7, unwrap_2_block0(), unwrap_2_block1(), !26 unwrap_2_block0(): v8 = get_local __ptr { u64, ( () | { b256 } ) }, __matched_value_4, !27 v9 = const u64 1 v10 = const u64 1 v11 = get_elem_ptr v8, __ptr { b256 }, v9, v10, !20 mem_copy_val __ret_value, v11 v12 = const unit () ret () v12 unwrap_2_block1(): v13 = const u64 0, !28 revert v13, !33 } fn return_option_5(__ret_value: __ptr { u64, ( () | { b256 } ) }) -> (), !36 { entry(__ret_value: __ptr { u64, ( () | { b256 } ) }): v0 = const u64 0 v1 = get_elem_ptr __ret_value, __ptr u64, v0, !37 v2 = const u64 0, !37 store v2 to v1, !37 v3 = const unit () ret () v3 } ``` </details> `wrapper_1`, which had 3 `memcpy`s now has 1, and `return_option_5` which had one, now has none. Closes #7344. |
||
|
|
6b26e50f09
|
Update to latest fuels-rs dependency (#7468)
Some checks failed
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (push) Has been cancelled
CI / build-mdbook (push) Has been cancelled
CI / build-forc-doc-sway-lib-std (push) Has been cancelled
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / pre-publish-check (push) Has been cancelled
github pages / deploy (push) Has been cancelled
CI / build-forc-test-project (push) Has been cancelled
CI / cargo-build-workspace (push) Has been cancelled
CI / cargo-toml-fmt-check (push) Has been cancelled
CI / cargo-fmt-check (push) Has been cancelled
CI / cargo-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (push) Has been cancelled
CI / Build and test various forc tools (push) Has been cancelled
CI / cargo-unused-deps-check (push) Has been cancelled
CI / cargo-clippy (push) Has been cancelled
CI / verifications-complete (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / cargo-run-e2e-test (push) Has been cancelled
CI / cargo-run-e2e-test-release (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
## Description Update to latest `fuels-rs` dependency. ## 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). - [ ] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Upgrade to latest Fuel/fuels versions and refactor code/tests to new APIs (IDs, receipts, storage, wallet, node owner). > > - **Dependencies**: > - Bump `fuel-core` to `0.47.x`, `fuel-{vm,tx,types,asm,crypto}` to `0.65`, and `fuels{,-core,-accounts}` to `0.76`; update `fuel-core-*` crates across workspace and SDK harness. > - **Core/API migrations**: > - Use `Contract::id(..)` associated function (replaces instance method); update contract ID calculations in `forc-pkg`, `forc-client` deploy, and `forc-test`. > - Adjust receipts handling to `Arc<Vec<_>>` and convert as needed; update parsing/printing of `Receipt::LogData`/`ReturnData` to new byte accessors. > - Update `ContractsStateData` construction and storage conversions in VM trace storage. > - Refactor wallet account collection/types and secret key conversion in tx utils. > - Switch `forc-node` coin owner to `Owner` enum; update logging and tests. > - **Tests**: > - Adapt E2E and client tests to new receipt/data APIs and predicate fee assertions; update SDK harness deps and context tests (ContractIdExt import). > - **Misc**: > - Update workspace `Cargo.toml` and `test/src/sdk-harness/Cargo.toml`; extend `.typos.toml` ignores/excludes. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d0541bd2ec806d10743310573edde8c85364b4ff. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> |
||
|
|
0e71b18885
|
Add relative jump instructions to asm blocks (#7485)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR adds relative FuelVM jump instructions `jmpb`, `jmpf`, `jnzb`, `jnzf`, `jneb`, `jnef`, as well as `jal` to `asm` blocks. This is done for completeness (other jump instructions are already available in `asm`) but most of all to be able to experiment with optimizations by creating non-restricted, manually defined code in `asm` within Sway programs. Note that for this kind of experimenting, it is necessary to comment out the emitting of the `CompileError::DisallowedControlFlowInstruction` in `sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs`, because control flow instructions are not allowed in the `asm`. ## 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) - [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. |
||
|
|
990a84093a
|
Add event support via #[event] and #[indexed] attributes (#7158)
Some checks are pending
CI / pre-publish-check (push) Waiting to run
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
CI / cargo-unused-deps-check (push) Waiting to run
CI / notify-slack-on-failure (push) Blocked by required conditions
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
This PR adds two new attributes: `#[event]` and `#[indexed]`.
The `#[event]` attribute marks a struct or enum as an event that can be
emitted by a contract.
The `#[indexed]` attribute can be applied to fields within structs that
are attributed with `#[event]`. This is particularly useful for event
structs, allowing for efficient filtering and searching of emitted
events based on the values of these fields.
When using this attribute, the indexed fields must be applied
sequentially to the initial set of fields in a struct.
This attribute can only be applied to fields whose type is an exact size
ABI type. The exact size ABI types include:
- `bool`
- `u8`, `u16`, `u32`, `u64`, `u256`
- `numeric`
- `b256`
- `str[N]`
- Tuples containing only exact size types
- Structs containing only exact size types
- Arrays of exact size types with a literal length
- Type aliases to exact size types
Additionally it causes the event types to be included in the JSON ABI
representation for the contract and emits an `offset` for indexed
fields.
```sway
#[event]
struct MyEventStruct {
#[indexed]
id: u64,
sender: Identity,
}
```
|
||
|
|
0316a50dd5
|
Coins analysis for const generics (#7473)
## Description This PR continue https://github.com/FuelLabs/sway/pull/7391. First, it removes some easy `todo!()` around `ParsedDeclId`. It seems only `fn` or `struct` are using those. But I decided to implement them anyway to keep the code uniform. We may be able to simplify this, I think. Second, it implements coin analysis for const generics. Unfortunately, the analysis runs on the `fn` declaration and not on the materialised version. So even calling a function with `0` generates the error. ## 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). - [ ] 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. |
||
|
|
90c8ed2569
|
Reduce storage API byte allocation (#7430)
## Description Legacy functionality from the storage API now allocates more memory than required for the read and write functions. This allocation has been reduced to the correct amounts. Reduces unnecessary byte allocation by 8x. ## 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. --------- Co-authored-by: Igor Rončević <ironcev@hotmail.com> |
||
|
|
bfbe49010b
|
Optimize slot_calculator for bytecode size and gas usage (#7481)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR optimizes `std::storage_api::slot_calculator` for bytecode size and gas usage by: - skipping calling it if the value fits the slot and the offset is zero, - replacing `match` on a boolean value with `if`. This removes the trailing `else` branch which is present in the desugared `match` expression. - avoiding expensive `.as_u256()` calls and `u256` arithmetic when adding a `u64` to `u256`. ## Performance gains ### Comparing 'e2e-gas-usages': | Test | Before | After | Percentage | |------|-------:|------:|-----------:| | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_bytes | 17533 | 16705 | 4.72% | | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_map | 13986 | 13526 | 3.29% | | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_vec | 29288 | 28187 | 3.76% | | should_pass/language/storage_slot_sized (test.toml)::test_store_something | 10982 | 10247 | 6.69% | | should_pass/stdlib/storage_vec_insert (test.toml)::test_test_function | 3831 | 3102 | 19.03% | | should_pass/test_contracts/basic_storage (test.toml)::collect_basic_storage_contract_gas_usages | 47557 | 42427 | 10.79% | | should_pass/test_contracts/increment_contract (test.toml)::collect_incrementor_contract_gas_usages | 2792 | 2517 | 9.85% | | should_pass/test_contracts/storage_access_contract (test.toml)::collect_storage_access_contract_gas_usages | 162131 | 157884 | 2.62% | | should_pass/test_contracts/storage_enum_contract (test.toml)::collect_storage_enum_contract_gas_usages | 31466 | 23060 | 26.71% | ### Comparing 'e2e-bytecode-sizes': | Test | Before | After | Percentage | |------|-------:|------:|-----------:| | should_pass/empty_fields_in_storage_struct (test.toml) | 11784 | 11616 | 1.43% | | should_pass/language/fallback_only (test.toml) | 1904 | 1552 | 18.49% | | should_pass/language/generics_in_contract (test.toml) | 2336 | 2112 | 9.59% | | should_pass/language/storage_slot_sized (test.toml) | 4864 | 4608 | 5.26% | | should_pass/static_analysis/cei_pattern_violation (test.toml) | 1472 | 1248 | 15.22% | | should_pass/static_analysis/cei_pattern_violation_in_codeblocks_other_than_in_functions (test.toml) | 1704 | 1488 | 12.68% | | should_pass/static_analysis/cei_pattern_violation_in_func_app-1 (test.toml) | 1696 | 1472 | 13.21% | | should_pass/static_analysis/cei_pattern_violation_in_func_app-2 (test.toml) | 1696 | 1472 | 13.21% | | should_pass/static_analysis/cei_pattern_violation_in_func_app-3 (test.toml) | 1696 | 1472 | 13.21% | | should_pass/static_analysis/cei_pattern_violation_in_if_statement-1 (test.toml) | 1720 | 1496 | 13.02% | | should_pass/static_analysis/cei_pattern_violation_in_if_statement-2 (test.toml) | 1696 | 1472 | 13.21% | | should_pass/static_analysis/cei_pattern_violation_in_intrinsic_call (test.toml) | 1696 | 1472 | 13.21% | | should_pass/static_analysis/cei_pattern_violation_in_match_statement-1 (test.toml) | 2200 | 1984 | 9.82% | | should_pass/static_analysis/cei_pattern_violation_in_standalone_function (test.toml) | 1472 | 1248 | 15.22% | | should_pass/static_analysis/cei_pattern_violation_in_struct (test.toml) | 1720 | 1504 | 12.56% | | should_pass/static_analysis/cei_pattern_violation_in_tuple (test.toml) | 1720 | 1504 | 12.56% | | should_pass/static_analysis/cei_pattern_violation_in_while_loop-1 (test.toml) | 1696 | 1472 | 13.21% | | should_pass/static_analysis/cei_pattern_violation_in_while_loop-2 (test.toml) | 1704 | 1480 | 13.15% | | should_pass/static_analysis/cei_pattern_violation_in_while_loop-3 (test.toml) | 1696 | 1472 | 13.21% | | should_pass/static_analysis/cei_pattern_violation_in_while_loop-4 (test.toml) | 1704 | 1480 | 13.15% | | should_pass/static_analysis/cei_pattern_violation_more_complex_logic (test.toml) | 12928 | 12552 | 2.91% | | should_pass/static_analysis/cei_pattern_violation_storage_map_and_vec (test.toml) | 4752 | 4584 | 3.54% | | should_pass/static_analysis/cei_pattern_violation_storage_struct_read (test.toml) | 1720 | 1504 | 12.56% | | should_pass/static_analysis/cei_pattern_violation_storage_var_read (test.toml) | 2072 | 1856 | 10.42% | | should_pass/static_analysis/cei_pattern_violation_storage_var_update (test.toml) | 1608 | 1392 | 13.43% | | should_pass/stdlib/storage_vec_insert (test.toml) | 3264 | 3096 | 5.15% | | should_pass/storage_into (test.toml) | 1688 | 1472 | 12.80% | | should_pass/supertraits_for_abis_ownable (test.toml) | 3440 | 2920 | 15.12% | | should_pass/test_contracts/basic_storage (test.toml) | 29288 | 28184 | 3.77% | | should_pass/test_contracts/increment_contract (test.toml) | 2848 | 2680 | 5.90% | | should_pass/test_contracts/storage_access_contract (test.toml) | 24160 | 23336 | 3.41% | | should_pass/test_contracts/storage_enum_contract (test.toml) | 13440 | 12952 | 3.63% | | should_pass/test_contracts/storage_namespace (test.toml) | 28376 | 27296 | 3.81% | ### Comparing 'in-language-gas-usages': | Test | Before | After | Percentage | |------|-------:|------:|-----------:| | storage_vec_iter_tests::empty_vec_next_returns_none | 55456 | 52550 | 5.24% | | storage_vec_iter_tests::storage_vec_field_for_loop_iteration | 1619781 | 1584251 | 2.19% | | storage_vec_iter_tests::storage_vec_field_nested_for_loop_iteration | 11924960 | 11630896 | 2.47% | | storage_vec_iter_tests::vec_with_elements_for_loop_iteration | 24591048 | 24107244 | 1.97% | | storage_vec_iter_tests::vec_with_elements_next_returns_element | 24586261 | 24104972 | 1.96% | ## 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. |
||
|
|
6bca1885f9
|
Improve method selector on contracts (#7458)
Some checks are pending
CI / forc-unit-tests (push) Waiting to run
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR continues the optimisation of contract calls on top of https://github.com/FuelLabs/sway/pull/7455. Now the contract method selector is optimised. Ideally, the method selection would just be a `match` and we would let the compiler generate the best code. But we are not there yet. So, for now, we are going to first test the called method length. And based on its length we are going to check the whole string. Something like: ```sway if called_method.len() == 5 { if called_method == "abcde" { ... } if called_method == "fghij" { ... } } if called_method.len() == 10 { if called_method == "..." { .... } } ``` This alone reduces gas a lot. To understand why `match_expressions_all` gas usage is much worse see below. | Test | Before | After | Percentage | |------|--------|-------|------------| | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_bytes | 17533 | 12080 | 31.10% | | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_map | 13986 | 8502 | 39.21% | | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_vec | 29288 | 12797 | 56.31% | | should_pass/language/associated_const_abi (test.toml)::test | 7817 | 4547 | 41.83% | | should_pass/language/associated_const_abi_multiple (test.toml)::test | 2097 | 1511 | 27.94% | | should_pass/language/associated_const_in_decls_of_other_constants (test.toml)::test | 709 | 537 | 24.26% | | should_pass/language/contract_ret_intrinsic (test.toml)::test | 1809 | 1465 | 19.02% | | should_pass/language/match_expressions_all (test.toml) | 764 | 3708 | -385.34% | | should_pass/language/pusha_popa_multiple_defreg (test.toml)::incorrect_pusha_popa | 624 | 451 | 27.72% | | should_pass/language/raw_identifiers (test.error_type.toml)::test | 1075 | 903 | 16.00% | | should_pass/language/raw_identifiers (test.toml)::test | 1075 | 903 | 16.00% | | should_pass/language/references/mutability_of_references_memcpy_bug (test.toml)::test | 1203 | 1031 | 14.30% | | should_pass/language/slice/slice_contract (test.toml)::test_success | 1145 | 920 | 19.65% | | should_pass/language/string_slice/string_slice_contract (test.toml)::test_success | 1322 | 1079 | 18.38% | | should_pass/stdlib/storage_vec_insert (test.toml)::test_test_function | 3831 | 3669 | 4.23% | | should_pass/storage_element_key_modification (test.toml)::test_storage_key_address | 1138 | 943 | 17.14% | | should_pass/storage_element_key_modification (test.toml)::test_storage_key_modification | 757 | 465 | 38.57% | | should_pass/storage_slot_key_calculation (test.toml)::test | 2979 | 2785 | 6.51% | | should_pass/superabi_contract_calls (test.toml)::tests | 1812 | 1310 | 27.70% | | should_pass/superabi_supertrait_external_call (test.toml) | 95 | 76 | 20.00% | | should_pass/superabi_supertrait_same_methods (test.toml)::tests | 936 | 634 | 32.26% | | should_pass/test_abis/abi_impl_methods_callable (test.toml)::tests | 772 | 599 | 22.41% | | should_pass/test_abis/contract_abi-auto_impl (test.toml)::tests | 772 | 599 | 22.41% | | should_pass/unit_tests/aggr_indexing (test.toml)::test1 | 5443 | 4282 | 21.33% | | should_pass/unit_tests/contract-multi-contract-calls (test.toml)::test_contract_2_call | 804 | 631 | 21.52% | | should_pass/unit_tests/contract-multi-contract-calls (test.toml)::test_contract_call | 807 | 634 | 21.44% | | should_pass/unit_tests/contract-multi-contract-calls (test.toml)::test_contract_multi_call | 1592 | 1246 | 21.73% | | should_pass/unit_tests/contract_multi_test (test.toml)::test_fail | 808 | 635 | 21.41% | | should_pass/unit_tests/contract_multi_test (test.toml)::test_success | 806 | 633 | 21.46% | | should_pass/unit_tests/script-contract-calls (test.toml)::test_contract_call | 736 | 563 | 23.51% | | should_pass/unit_tests/workspace_test (test.toml)::test_fail | 808 | 635 | 21.41% | | should_pass/unit_tests/workspace_test (test.toml)::test_success | 807 | 634 | 21.44% | # Radix Trie This PR also turns off the radix trie optimisation at `sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/typed_match_expression.rs`. I am not 100% sure of its correctness and heuristics. We need a better way to decide when not to use it. One of the examples where the generated code is worse is when all strings are very similar. For example: `get_a` , `get_b`. The generated trie will first test its length. Both have length 5. Not much was gained. Then it tests if for `get_`, which makes sense as it is the common substring. And the last step will test for `a` or `b`. The issue is that all branches and jumps of the last step are not worthy to test just one character. Is probably cheaper to just test the whole string for each option. In the end, we need a better heuristic to determine when to use this optimisation. ## 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). - [ ] I have requested a review from the relevant team or maintainers. --------- Co-authored-by: Joshua Batty <joshpbatty@gmail.com> |
||
|
|
e6f2ac87cf
|
Add perf-diff-stats just recipe (#7480)
## Description This PR adds the `perf-diff-stats` recipe to the `justfile`. The recipe calculates a simple statistics of performance improvements and regressions obtained from the `perf-diff` recipe. The statistics contains the _count_, _average_, _median_, _max_, and _min_ of improvements and regressions and can be used to easily communicate performance differences gained in a PR. E.g.: | | Improvements | Regressions | | - | -: | -: | | Count | 3 | 4 | | Average | 8.13% | -2.21% | | Median | 7.05% | -1.07% | | Max | 12.86% | -6.12% | | Min | 4.47% | -0.59% | ## Checklist - [ ] 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). - [ ] 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. |
||
|
|
be2d6ae666
|
Do not read from state when writing aligned, slot sized values (#7470)
Some checks failed
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
|
||
|
|
d6b9a876eb
|
Fix default --gas-costs option to be built-in (#7475)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR fixes bug introduced in #7471, where the `built-in` was not properly treated as a default options, and `GasCostsValues::default()` were still used. ## 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). - [ ] 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. |
||
|
|
03deb8f75c
|
Collect more storage access performance data from tests (#7476)
## Description As we continue to optimize storage access, it becomes important to have more performance data to measure improvements. This PR adapts E2E `test_contract` tests that use storage, by adding unit tests that collect gas usage data. ## 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. |
||
|
|
01fc314744
|
Add --gas-costs option to forc-test and E2E test runner (#7471)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR adds `--gas-costs` option to `forc-test` and E2E test runner. The option enables providing realistic gas costs to use for gas measurements during executions of tests and/or scripts. The gas costs can be provided from the following sources: - `built-in` Default value. It is hardcode in `forc test` based on the mainnet gas costs at the time of `forc` release. - `mainnet` Fetches the current gas costs from the mainnet using GraphQL. - `testnet` Fetches the current gas costs from the testnet using GraphQL. - `<FILE>` Reads the gas costs from a local JSON file. This PR implements only the `built-in` source and the remaining will be done in a follow up PR that will address #7472. The reason for adding gas costs is that both `forc test` and E2E test runner currently use `GasCosts::default()` when initializing the `Interpreter`. This can lead to very misleading gas cost interpretations. E.g, the default costs of `cfei`, `aloc`, `srwq`, and `swwq` are: ```console cfei: DependentCost::LightOperation { base: 2, units_per_gas: 214, }, aloc: DependentCost::LightOperation { base: 2, units_per_gas: 214, }, srwq: DependentCost::LightOperation { base: 47, units_per_gas: 5, }, swwq: DependentCost::LightOperation { base: 44, units_per_gas: 5, }, ``` Their on-chain costs, taken from the [Chain configuration repository](https://github.com/FuelLabs/chain-configuration/blob/master/upgradelog/ignition/consensus_parameters/6.json), are: ```console "cfei": { "LightOperation": { "base": 2, "units_per_gas": 562 } }, "aloc": { "LightOperation": { "base": 3, "units_per_gas": 562 } }, "srwq": { "HeavyOperation": { "base": 311, "gas_per_unit": 312 } }, "swwq": { "HeavyOperation": { "base": 7838, "gas_per_unit": 8156 } }, ``` The difference between the real on-chain cost and default parameters are significant, especially for `srwq` and `swwq`. In a general case, this difference can make gas usages printed by `forc test` or fetched by E2E `--perf` option very misleading, especially when used to benchmark performance. With the `--gas-costs` option we by default get the realistic, mainnet based built-in cost, and can even specify particular costs we want to have. ## 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) - [ ] 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. |
||
|
|
f92c3f249b
|
SROA: Do not generate GEPs when direct address is available (#7457)
Some checks failed
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
Fixes #7433 |
||
|
|
00b9d02477
|
Improve Contract Call by not encoding method name (#7455)
Some checks failed
CI / check-forc-manifest-version (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (push) Has been cancelled
github pages / deploy (push) Has been cancelled
CI / cargo-unused-deps-check (push) Has been cancelled
CI / pre-publish-check (push) Has been cancelled
CI / Build and test various forc tools (push) Has been cancelled
CI / verifications-complete (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / cargo-run-e2e-test (push) Has been cancelled
CI / cargo-run-e2e-test-release (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
## Description This is an optimisation of contract calls on top of https://github.com/FuelLabs/sway/pull/7440. The old version would pass a string with the method name and encode it, which is `<LEN><BYTES`. Now the compiler generates these bytes directly, avoiding encoding the method name in the first place. For that this PR creats the concept of `Literal::Binary` that does not exist in the language, yet. Would be something like `b""` in Rust. ## Improvements | Test | Before | After | Percentage | |------|--------|-------|------------| | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_bytes | 19298 | 17533 | 9.15% | | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_map | 14971 | 13986 | 6.58% | | should_pass/empty_fields_in_storage_struct (test.toml)::test_read_write_vec | 31061 | 29288 | 5.71% | | should_pass/language/associated_const_abi (test.toml)::test | 8789 | 7817 | 11.06% | | should_pass/language/associated_const_abi_multiple (test.toml)::test | 2421 | 2097 | 13.38% | | should_pass/language/associated_const_in_decls_of_other_constants (test.toml)::test | 870 | 709 | 18.51% | | should_pass/language/contract_caller_dynamic_address (test.toml) | 540 | 379 | 29.81% | | should_pass/language/contract_ret_intrinsic (test.toml)::test | 2133 | 1809 | 15.19% | | should_pass/language/pusha_popa_multiple_defreg (test.toml)::incorrect_pusha_popa | 819 | 624 | 23.81% | | should_pass/language/raw_identifiers (test.error_type.toml)::test | 1236 | 1075 | 13.03% | | should_pass/language/raw_identifiers (test.toml)::test | 1236 | 1075 | 13.03% | | should_pass/language/references/mutability_of_references_memcpy_bug (test.toml)::test | 1364 | 1203 | 11.80% | | should_pass/language/slice/slice_contract (test.toml)::test_success | 1338 | 1145 | 14.42% | | should_pass/language/string_slice/string_slice_contract (test.toml)::test_success | 1515 | 1322 | 12.74% | | should_pass/stdlib/storage_vec_insert (test.toml)::test_test_function | 3992 | 3831 | 4.03% | | should_pass/storage_element_key_modification (test.toml)::test_storage_key_address | 1300 | 1138 | 12.46% | | should_pass/storage_element_key_modification (test.toml)::test_storage_key_modification | 919 | 757 | 17.63% | | should_pass/storage_slot_key_calculation (test.toml)::test | 3140 | 2979 | 5.13% | | should_pass/superabi_contract_calls (test.toml)::tests | 2136 | 1812 | 15.17% | | should_pass/superabi_supertrait_same_methods (test.toml)::tests | 1097 | 936 | 14.68% | | should_pass/test_abis/abi_impl_methods_callable (test.toml)::tests | 933 | 772 | 17.26% | | should_pass/test_abis/contract_abi-auto_impl (test.toml)::tests | 933 | 772 | 17.26% | | should_pass/unit_tests/aggr_indexing (test.toml)::test1 | 6007 | 5443 | 9.39% | | should_pass/unit_tests/contract-multi-contract-calls (test.toml)::test_contract_2_call | 966 | 804 | 16.77% | | should_pass/unit_tests/contract-multi-contract-calls (test.toml)::test_contract_call | 969 | 807 | 16.72% | | should_pass/unit_tests/contract-multi-contract-calls (test.toml)::test_contract_multi_call | 1916 | 1592 | 16.91% | | should_pass/unit_tests/contract_multi_test (test.toml)::test_fail | 970 | 808 | 16.70% | | should_pass/unit_tests/contract_multi_test (test.toml)::test_success | 968 | 806 | 16.74% | | should_pass/unit_tests/script-contract-calls (test.toml)::test_contract_call | 931 | 736 | 20.95% | | should_pass/unit_tests/workspace_test (test.toml)::test_fail | 970 | 808 | 16.70% | | should_pass/unit_tests/workspace_test (test.toml)::test_success | 969 | 807 | 16.72% | ## Failed Test Only now I realized that the test for array of size zero `[u64; 0]` is not working. As this is not a useful case, I will solve it in another PR. ## 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. |
||
|
|
fc2aed7934
|
Fix build warnings in in-language tests (#7464)
Some checks failed
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-toml-fmt-check (push) Has been cancelled
CI / cargo-fmt-check (push) Has been cancelled
CI / cargo-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description This PR fixes warnings emitted in `in-language` tests and sets the `--error-on-warnings` flag when running those tests on CI. This removes unnecessary output, e.g., when extracting performance data (gas usages and bytecode sizes) from the output of the `forc test` runs. Removal of warnings revealed additional DCA issues that are marked as `TODO-DCA` in code and linked to #7462. ## 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). - [ ] 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. |
||
|
|
e4cabdd135
|
Fix "Transaction collided" issue when running run_on_node tests (#7461)
Some checks failed
CI / get-fuel-core-version (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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 / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (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 / forc-run-benchmarks (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / cargo-test-lib-std (push) Has been cancelled
CI / forc-unit-tests (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 / Build and upload forc binaries to release (push) Has been cancelled
CI / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
## Description
This PR fixes non-deterministic "Transaction collided" error when
running `run_on_node` tests in parallel:
```console
{
kind: Other,
error: "Response errors;
Transaction collided: Transaction with the same UTXO
(id: 00000000000000000000000000000000000000000000000000000000000000010000)
already exists and is more worth it"
}
```
The root-cause was using the same wallet to sign all transactions which
could sometimes end up in race conditions on the node. The PR now uses
five different wallets available on `fuel-core` local test instance and
executes tests in parallel over those five wallets, ensuring only
different wallets are used in parallel.
## 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)
- [ ] 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.
|
||
|
|
46e83a6fbe
|
Add --perf option to test to collect and diff performance data (#7459)
Some checks are pending
CI / build-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
CI / check-sdk-harness-test-suite-compatibility (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (push) Waiting to run
CI / cargo-run-e2e-test (push) Blocked by required conditions
CI / cargo-test-lib-std (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (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-clippy (push) Waiting to run
CI / cargo-run-e2e-test-release (push) Blocked by required conditions
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR: - Adds `--perf` and `--perf-only` options to `test` to collect gas usages and bytecode sizes, and to run only the tests that actually produce those performance data, respectively. - Adds `[performance]` recipes to `justfile` that fully automate a workflow for collecting and comparing performance data of the compiler output. `--perf` flag instructs `test` to collect performance data from tests of categories `compile`, `run`, and `unit_tests_pass`. Collected gas usages and bytecode sizes are written to files named `<timestamp>-<category>-<build profile>-<branch>.csv`. E.g.: `1020165605-e2e-bytecode-sizes-release-master.csv`. When running tests in parallel (default option), performance data of each individual `test --exact <test_toml_path>` process is written to a piped stdout in JSON format. The main `test` process collects those JSON outputs from all spanned processes. The usual workflow of collecting and comparing performance data between the `master` and feature branch is supported by the following `just` recipes: ```console [performance] perf-e2e filter='' # collect gas usages and bytecode sizes from E2E tests [alias: pe2e] perf-in-lang filter='' # collect gas usages from in-language tests [alias: pil] perf-all filter='' # collect gas usages and bytecode sizes from all tests (E2E and in-language) [alias: pa] perf-diff before after format='md' # generate performance diff between two CSV files [alias: pd] perf-diff-latest format='md' # generate performance diffs between the latest two CSV files per testing category [alias: pdl] perf-snapshot-historical path open='' # collect historic gas usages from a snapshot test that has a `forc test` output [alias: psh] perf-list # list all performance files (*gas-usages-*.* and *bytecode-sizes-*.*) [alias: pl] perf-remove # remove all performance files (*gas-usages-*.* and *bytecode-sizes-*.*) [alias: pr] ``` To obtain the performance comparison it is enough to run: ```console just pa // `just perf-all`. On `master` to get the baseline. just pa // `just perf-all`. On the feature branch to get the improved data. just pdl // `just perf-diff-latest`. To get the diff of the last two collected performance data sets. ``` The `just` recipes should be executed from the root of the Sway repository. Aside from `--perf` writing to predefined files, all other parts of the workflow are `just` recipes and can potentially be tailored to any other workflow. Adding support for collecting gas usages and bytecode sizes from other tests like (snapshot, in-language, SDK harness) will be added in follow up PRs. ## 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) - [ ] 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. |
||
|
|
4e16bedab2
|
Improve Contract Call by not encoding fuelvm protocol args (#7447)
Some checks are pending
CI / forc-fmt-check-panic (push) Waiting to run
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (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-sway-lib-std (push) Waiting to run
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 / Build and test various forc tools (push) Blocked by required conditions
CI / cargo-unused-deps-check (push) Waiting to run
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-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / cargo-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / notify-slack-on-failure (push) Blocked by required conditions
## Description This is an optimization of contract calls on top of https://github.com/FuelLabs/sway/pull/7440. ```csv const_of_contract_call::cost_of_in_array_0,1976,1285 const_of_contract_call::cost_of_in_array_1,3164,1779 const_of_contract_call::cost_of_in_array_16,5096,4753 const_of_contract_call::cost_of_in_array_32,8421,8079 const_of_contract_call::cost_of_in_array_64,60382,14545 const_of_contract_call::cost_of_in_array_8,4724,4382 const_of_contract_call::cost_of_in_b256,2491,2147 const_of_contract_call::cost_of_in_bool,2627,2279 const_of_contract_call::cost_of_in_str_0,3043,2697 const_of_contract_call::cost_of_in_str_1,3345,2998 const_of_contract_call::cost_of_in_str_16,3374,3030 const_of_contract_call::cost_of_in_str_32,3572,3227 const_of_contract_call::cost_of_in_str_8,3768,3421 const_of_contract_call::cost_of_in_tuple_0,3822,3479 const_of_contract_call::cost_of_in_tuple_1,4392,4050 const_of_contract_call::cost_of_in_tuple_2,4761,4418 const_of_contract_call::cost_of_in_tuple_3,5104,4761 const_of_contract_call::cost_of_in_tuple_4,5468,5126 const_of_contract_call::cost_of_in_u16,4493,4141 const_of_contract_call::cost_of_in_u256,4777,4433 const_of_contract_call::cost_of_in_u32,4926,4582 const_of_contract_call::cost_of_in_u64,4934,4589 const_of_contract_call::cost_of_in_u8,4874,4526 const_of_contract_call::in_enum_u64,3186,2843 const_of_contract_call::in_enum_u64_u64,3061,2718 const_of_contract_call::in_enum_u64_u64_u64,3173,2830 const_of_contract_call::in_struct_u64,3635,3293 const_of_contract_call::in_struct_u64_u64,3897,3554 const_of_contract_call::in_struct_u64_u64_u64,4156,3813 const_of_contract_call::isolated_cost_of_in_array_0,956,956 const_of_contract_call::isolated_cost_of_in_array_1,1515,1185 const_of_contract_call::isolated_cost_of_in_array_16,3955,3266 const_of_contract_call::isolated_cost_of_in_array_32,6544,5471 const_of_contract_call::isolated_cost_of_in_array_64,9914,9914 const_of_contract_call::isolated_cost_of_in_array_8,3225,2728 const_of_contract_call::isolated_cost_of_in_b256,1462,1120 const_of_contract_call::isolated_cost_of_in_bool,1358,1047 const_of_contract_call::isolated_cost_of_in_str_0,1451,1140 const_of_contract_call::isolated_cost_of_in_str_1,1547,1237 const_of_contract_call::isolated_cost_of_in_str_16,1552,1241 const_of_contract_call::isolated_cost_of_in_str_32,1553,1242 const_of_contract_call::isolated_cost_of_in_str_8,1551,1241 const_of_contract_call::isolated_cost_of_in_tuple_0,820,820 const_of_contract_call::isolated_cost_of_in_tuple_1,1412,1090 const_of_contract_call::isolated_cost_of_in_tuple_2,1615,1304 const_of_contract_call::isolated_cost_of_in_tuple_3,1766,1455 const_of_contract_call::isolated_cost_of_in_tuple_4,1916,1605 const_of_contract_call::isolated_cost_of_in_u16,1428,1117 const_of_contract_call::isolated_cost_of_in_u256,1431,1120 const_of_contract_call::isolated_cost_of_in_u32,1554,1243 const_of_contract_call::isolated_cost_of_in_u64,1336,1025 const_of_contract_call::isolated_cost_of_in_u8,1352,1041 ``` ## 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). - [ ] 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. |
||
|
|
5896b4cac2
|
Cost of contract calls snapshot tests (#7440)
Some checks failed
CI / check-dependency-version-formats (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / Build and upload forc binaries to release (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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
## Description This PR is a prequel for https://github.com/FuelLabs/sway/pull/7419. It will set the baseline, which future PRs need to improve. Apart from that it also: 1 - Fix a problem with `SubtsType` for `TyConstantDecl`; 2 - Introduce a new way to write snapshot tests. Now the test source code can have "blocks" ``` /* START BOOL */ fn in_bool(v: bool) -> bool; /* END BOOL */ ``` These blocks can be manipulated from inside the `snapshot.toml`. In this case, the `toml` is: ``` cmds = [ "forc test --path {root} --release --experimental const_generics", { repeat = "for-each-block", cmds = [ "forc test --path {root} --release --experimental const_generics" ] } ] ``` Which repeats the inner `forc test` for each block, removing all others. That allows me to check the cost of the contract method selection algorithm for each contract method. For example, `cost_of_in_array_64` with all other contract methods costs `60382`, but alone it only costs `58218`, which means that around 2000 was "wasted" in the contract method selection. ## 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. - [ ] 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. |
||
|
|
97efa221f0
|
Excute E2E tests in parallel (#7456)
Some checks failed
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description This PR implements parallel execution of E2E tests by using the approach similar to one introduced by @JoshuaBatty for running LSP garbage collection tests in parallel. The approach is based on: - `test` binary getting an additional `--exact` option used by the parallel runner to run exactly one test passed as an argument to `--exact`. The argument is the full path to the test's `toml` file. - parallel runner that uses `rayon` and `std::process::Command` to span `test --exact <test toml path>` processes in parallel. The original command line argument passed to `test` get forwarded to `test --exact` only if they are applicable while running tests in parallel. On my laptop with 20 cores, **the execution time of the complete E2E test suite reduces from reproducible 10:48 minutes to reproducible 1:47 minutes**. Parallel execution is set to be the default one. Sequential execution can still be used via `--sequential` or `-s` flag: `cargo run -- -s` or `test -s`. Similar to parallel garbage collection tests, the parallel execution of E2E tests shows `stderr` output of the executed tests, but not the `stdout`. Being non-deterministic, the position of displayed errors will not come immediately after or before the failing test display, but will always be easy to relate to a concrete failing test. In practice, this will be perfectly enough for troubleshooting failing tests. If all the output is needed during troubleshooting, failing tests can always be executed sequentially, by using the `--sequential` or `-s` flag. Additionally the PR: - adds `no_output` flag to `BuildOpts` to instructs `forc-pkg` not to output build artifacts like bytecode, ABI JSON, or storage slots JSON. This improves test execution speed in general because it skips writing to disc artifacts that are anyhow not used in tests. Also, it simplifies parallelization, because in case of tests with several `test.<feature>.toml` files, we don't need to worry about racing conditions when writing output files. If needed for troubleshooting, output can still be optionally generated in tests by passing the newly added `--write-output` CLI flag to the `test` binary. This flag is ignored when running tests in parallel. A support for the `no_output` option is not added neither to `forc` CLI, nor to CLI of any other tools like, e.g., `forc deploy`. If it proves useful to those tools, we can always easily add it to their CLIs. - fixes #7449 by annotating the `test` binary `main` function with `#[tokio::main(flavor = "current_thread")]`. - renames `exclude_std` CLI option to `no_std_only` to follow the `_only` pattern in naming filters in `FilterConfig` that filter out only the tests with a certain property. Implementing parallel execution for snapshot and IR tests (if required) will be done in followup PRs. ## 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) - [ ] 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. |
||
|
|
1da5e662e8
|
Compile runtime backtracing to ASM and compile-time to ABI JSON (#7387)
Some checks are pending
CI / check-dependency-version-formats (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
CI / check-forc-manifest-version (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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 / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / cargo-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR implements the compilation of the ABI backtracking, as described in the [ABI Backtracking RFC](https://github.com/FuelLabs/sway-rfcs/blob/ironcev/abi-backtracing/rfcs/0016-abi-backtracing.md). The PR closes two remaining implementation steps listed in the #7276: - Compile runtime backtracing to ASM and compile-time to ABI JSON - Support backtracing in forc test ### Changes in the ABI JSON and IR Compilation #### `panickingCalls` section in the ABI JSON Each panicking call is identified by a unique number and provided in the new `panickingCalls` section in the ABI JSON. E.g., for this panicking call in a module `some_module` of a package `some_package`: ```sway fn some_function() { let _ = this_function_might_panic(42); } ``` the following ABI JSON entry is created: ```json "panickingCalls": { "1": { "pos": { "function": "some_package::some_module::some_function", "pkg": "some_package@0.1.0", "file": "src/some_module.sw", "line": 4, "column": 8 }, "function": "some_other_package::module::this_function_might_panic" }, } ``` #### Encoding error code and backtrace in a `panic` revert code The generation of the `panic` revert code is changed. A `panic` revert code now encodes: - the information that the revert is generated by a `panic` expression, - the actual error code that can be located in the `errorCodes` section of the ABI JSON, - up to five panicking call IDs, encoded in the order of calling, that can be located in the `panickingCalls` section of the ABI JSON. The encoding of the `u64` revert code works as following: ```console 1_pppppppp_CCCCCCCCCCC_CCCCCCCCCCC_CCCCCCCCCCC_CCCCCCCCCCC_CCCCCCCCCCC ``` - The leading `1` denotes a revert code generated by a `panic` expression. Arbitrary user-defined revert codes will must have the starting bit set to `0` or in other words be less then or equal to `9223372036854775807₁₀ = 7FFFFFFFFFFFFFFF₁₆`. - The `pppppppp` denotes the error code in the `errorCodes` section of the ABI JSON, that identifies the actual `panic` location. - Each `CCCCCCCCCCC` section denotes a panicking call code in the `panickingCalls` section of the ABI JSON. The calls represent the callstack, where the right-most code is the code of the immediate function call in which the `panic` occurs. If all `C`s a zero it means no-call. This will happen if the actual call-depth is less then five calls. #### Calculating backtrace Ever non-entry function that can panic gets an additional function argument: `__backtrace: u64`. The `__backtrace` to pass to a panicking call is calculated at runtime by left-shift the existing `__backtrace` provided by the caller function and append/bitwise OR the unique panicking call ID of the exact panicking call. The ID of that exact panicking call is a compile-time, compiler-generated constant as explained above. The detailed mechanism with examples is provided in the "Runtime execution and bytecode and gas overhead" chapter of the [ABI Backtracking RFC](https://github.com/FuelLabs/sway-rfcs/blob/ironcev/abi-backtracing/rfcs/0016-abi-backtracing.md). ## Additional Changes The `panickingCalls` section of the ABI JSON can differ between `debug` and `release` builds which required adding support for different ABI JSON oracle files in test that `validate_abi`. The requirement to display a fully qualified function name in the panicking call and the backtrace resulted in adding flexibility to displaying functions and types in general. Adjusting affected tests was used as opportunity to remove unnecessary dependencies to the `std` and reduced `std` libraries in a large number of tests. Also, a cleanup is done in some parts of the code, like, e.g., removing code duplications. The PR implements these additional changes: - Implements `TyFunctionDisplay` and `TypeInfoDisplay` for configurable displaying of functions and types. Replacing current various custom implementations of displaying with these two types, mostly in error messages, will be done in separate PRs, with low priority. Also, display might be improved in some edge cases. There are TODOs left in code for such, and improvements will be done in separate PRs, with lower priority. - Displays full type names in warnings and errors, where expected. The PR intentionally temporarily switches to full type names in all errors and warnings by making that a default behavior in `impl DisplayWithEngines for TypeInfo`. This is done so that we can easily spot errors and warnings that should use specific `TyFunctionDisplay` and `TypeInfoDisplay` (tests will break) and adapt those in the follow up PR that will address #7389. That follow up PR will also address usages of type names in LSP. - Implements expressive diagnostics for `CompileError::MethodNotFound` and utilize `TyFunctionDisplay` for displaying all matching candidates. - Implements `Value::new_u64_constant` and removing duplicated code for a common scenario of creating an IR Constant of type `u64`. - Removes several unnecessary `clone()`s and `String` allocations. - Renames fields postfixed with `typeid` to follow more general naming convention for `TypeId` fields and parameters. - Removes unnecessary dependencies to `std` or reduced `std` libraries in tests. - Adds support for different `json_abi_oracle` files for `debug` and `release` build profiles. The `panickingCalls` part of the ABI JSON can vary depending on the build profile. A test that verifies ABI JSON now *must provide* expected oracles for both build profiles, unless a profile is unsupported via `unsupported_profiles` test option. An alternative was considered, to allow just a single oracle file if both `debug` and `release` oracles are the same. The reasoning for having two as mandatory even in that case was to gain more explicit test setup. We can change this upon feedback if needed. The oracles have a suffix of either `.debug.json` or `.release.json` and the name part is, as before, one of the following: - `json_abi_oracle` for obsolete old encoding, - `json_abi_oracle.<experimental feature>` for experimental features, - `json_abi_oracle_new_encoding` for new encoding without other experimental features. - Fixes #7386. - Fixes #7388. ## 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. |
||
|
|
5256cd17aa
|
Revert feat: introduce fuel-telemetry macros (#7295) (#7451)
## Description Ran git revert to revert telemetry changes causing #7449 #7450 |
||
|
|
19495ef491
|
Bump fuel-core v0.46.0 (#7445)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
CI / check-dependency-version-formats (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description Current latest supported mainnet/testnet version of fuel-core is `v0.46.0`; update sway accordingly. ## 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: z <zees-dev@users.noreply.github.com> |
||
|
|
ca9672684a
|
Remove workarounds based on asm blocks from std::hash (#7446)
Some checks failed
CI / forc-unit-tests (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (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-toml-fmt-check (push) Has been cancelled
CI / cargo-fmt-check (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-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 / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
## Description This PR removes workarounds based on `asm` blocks used in the `std::hash` module to obtain an address of a copy-type. Those workarounds are replaced with `__addr_of` which since #7255 supports taking addresses of copy-types. ## 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). - [ ] 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. |
||
|
|
74bab180db
|
Bump to 0.70.0 (#7438)
Some checks failed
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (push) Has been cancelled
CI / build-mdbook (push) Has been cancelled
CI / build-forc-doc-sway-lib-std (push) Has been cancelled
CI / cargo-unused-deps-check (push) Has been cancelled
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (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-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (push) Has been cancelled
CI / pre-publish-check (push) Has been cancelled
github pages / deploy (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / Build and test various forc tools (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 / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
Co-authored-by: Igor Rončević <ironcev@hotmail.com> |
||
|
|
8e44f53775
|
Stabilize new_hashing (#7437)
Some checks are pending
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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 and test various forc tools (push) Blocked by required conditions
CI / cargo-unused-deps-check (push) Waiting to run
CI / notify-slack-on-failure (push) Blocked by required conditions
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / verifications-complete (push) Blocked by required conditions
CI / check-dependency-version-formats (push) Waiting to run
CI / build-forc-test-project (push) Waiting to run
CI / cargo-build-workspace (push) Waiting to run
CI / cargo-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / publish-sway-lib-std (push) Blocked by required conditions
CI / Build and upload forc binaries to release (push) Blocked by required conditions
CI / forc-pkg-fuels-deps-check (push) Waiting to run
github pages / deploy (push) Waiting to run
Enable `new_hashing` feature by default whilst still retaining the logic for the old behavior to be removed at a later date. Advances #7256 --------- Co-authored-by: Igor Rončević <ironcev@hotmail.com> |
||
|
|
35757b6a58
|
feat: introduce fuel-telemetry macros (#7295)
## Description
# Add telemetry opt-out support to forc-tracing
This adds `fuel-telemetry` to `forc-tracing` with **opt-out
functionality** for upstream tools like fuelup.
## Usage
First, add it to the `forc-tracing` dependency:
```toml
[dependencies]
forc-tracing = { version = "0.47", features = ["telemetry"] }
```
Then use the `telemetry::*` glob, followed by the usual `tracing`
macros, but with a `_telemetry` postfix:
```rust
use forc_tracing::{
init_tracing_subscriber, println_green, println_red, println_yellow, telemetry::*,
};
fn main() {
init_tracing_subscriber(Default::default());
println_red("Stop");
println_yellow("Slow down");
println_green("Go");
error_telemetry!("Error message for InfluxDB");
warn_telemetry!("Warn message for InfluxDB");
info_telemetry!("Info message for InfluxDB");
debug_telemetry!("Debug message for InfluxDB");
trace_telemetry!("Trace message for InfluxDB");
}
```
This will output the following (note `DEBUG` and `TRACE` messages are
filtered out because of `RUST_LOG=info`):
```bash
> RUST_LOG=info ./target/debug/example
Stop
Slow down
Go
```
We can then peek into telemetry files like the following:
```bash
> cat ~/.fuelup/tmp/*.telemetry.* | while read line; do echo "$line" | base64 -d; echo; done
2025-03-06T19:53:24.923452000Z ERROR aarch64-apple-darwin:Darwin:23.6.0 forc-tracing:0.66.8:src/main.rs 0e3480f5-faab-48b8-a935-21ce90a6f028 auto: Error message for InfluxDB
2025-03-06T19:53:24.925348000Z WARN aarch64-apple-darwin:Darwin:23.6.0 forc-tracing:0.66.8:src/main.rs 0e3480f5-faab-48b8-a935-21ce90a6f028 auto: Warn message for InfluxDB
2025-03-06T19:53:24.925434000Z INFO aarch64-apple-darwin:Darwin:23.6.0 forc-tracing:0.66.8:src/main.rs 0e3480f5-faab-48b8-a935-21ce90a6f028 auto: Info message for InfluxDB
2025-03-06T19:53:31.335690000Z INFO aarch64-apple-darwin:Darwin:23.6.0 systeminfo_watcher:0.1.0:src/systeminfo_watcher.rs ec63b355-7862-47db-9ae3-de0cfcc094c8 poll_systeminfo: cpu_arch="arm64" cpu_brand="Apple M2 Pro" cpu_count=10 global_cpu_usage=15.85 total_memory=34359738368 free_memory=23388143616 free_memory_percentage=0.68 os_long_name="macOS 14.6.1 Sonoma" kernel_version="23.6.0" uptime=2482559 vm="" ci="" load_average_1m=4.52 load_average_5m=4.17 load_average_15m=3.86
```
## New: Telemetry Opt-Out Support
This PR also adds opt-out functionality for telemetry, allowing upstream
tools like fuelup to disable telemetry collection:
**Changes:**
- Added `--disable-telemetry` CLI flag to main forc binary
- Added `FORC_DISABLE_TELEMETRY` environment variable support
- Updated all telemetry macros to respect the disable flag
- Added `init_telemetry()` function for proper initialization
**Opt-out Usage:**
```bash
# Disable via CLI flag
forc --disable-telemetry build
# Disable via environment variable
FORC_DISABLE_TELEMETRY=1 forc build
# For upstream tools like fuelup
export FORC_DISABLE_TELEMETRY=1
fuelup toolchain install latest
```
**Code example with opt-out:**
```rust
use forc_tracing::{init_telemetry, init_tracing_subscriber, TracingSubscriberOptions};
fn main() {
let options = TracingSubscriberOptions {
disable_telemetry: Some(true),
..Default::default()
};
init_tracing_subscriber(options.clone());
init_telemetry(&options);
// Telemetry macros will now be no-ops when disabled
error_telemetry!("This won't be sent to telemetry if disabled");
}
```
The implementation ensures telemetry is opt-out by default but can be
easily disabled through either CLI flags or environment variables,
making it suitable for upstream tool integration.
|
||
|
|
14bb898f3b
|
chore: bumpt rust version to 1.90 (#7427)
## Description Bumping the rust version to 1.90 and fixing the clippy lints along the way |
||
|
|
4927805e4b
|
Symptom-fix associated const shadowing itself (#7429)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
## Description This PR temporarily **symptom-fixes** #7396 in order to unlock further steps in optimizing ABI encoding and decoding. The PR simply allows shadowing of consts in trait impls. The actual fix will be done by fixing #7428. ## 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. |
||
|
|
091ea05cc6
|
Allow trait impls to inherit default associated constants (#7409)
Some checks are pending
CI / check-forc-manifest-version (push) Waiting to run
CI / get-fuel-core-version (push) Waiting to run
CI / build-sway-lib-std (push) Waiting to run
CI / build-sway-examples (push) Waiting to run
CI / build-reference-examples (push) Waiting to run
CI / forc-fmt-check-sway-lib-std (push) Waiting to run
CI / forc-fmt-check-sway-examples (push) Waiting to run
CI / forc-fmt-check-panic (push) Waiting to run
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-clippy (push) Waiting to run
CI / cargo-toml-fmt-check (push) Waiting to run
CI / cargo-fmt-check (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-test-lib-std (push) Waiting to run
CI / forc-run-benchmarks (push) Waiting to run
CI / forc-unit-tests (push) Waiting to run
CI / forc-pkg-fuels-deps-check (push) Waiting to run
CI / Build and test various forc tools (push) Blocked by required conditions
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
Inherit and register trait constants with default values so empty impls no longer fail with the missing-constant check. Closes https://github.com/FuelLabs/sway/issues/7393. ## 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). - [ ] 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. |