You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: versioning clarity, measured performance guidance, and fail-closed publishing (#7719)
## Summary
- Clarify versioning across the README and book index: per-tag published
books, the distinction between the docs source version, the Fuelup
network channels, and the newest upstream release.
- Add measured, evidence-scoped optimization guidance: storage
read-once/write-once patterns, benchmarking the executed entrypoint with
`forc test --release --locked` and a committed `Forc.lock`, and honest
inline-assembly expectations — wins only where asm removes fixed-loop or
branch scaffolding, with an isolated typed interface and a readable Sway
oracle for differential testing.
- Add predicate security-design guidance covering the transaction
dimensions a predicate must bind (chain/domain, script, counts,
owners/recipients/assets/amounts/net gain, nonces, validity windows,
witness content).
- Align the cargo-generate Rust test templates on one `fuels` version
matched to the SDK harness, enforced by a CI check.
- Make documentation publishing fail closed: the gh-pages workflow
verifies plugin compatibility tags and only real tag pushes can move the
`latest` redirect.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01NWti3Mzc7HHsy9EspKHKof
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,21 @@ Sway is a language developed for the [Fuel](https://docs.fuel.network/docs/intro
10
10
11
11
## Documentation
12
12
13
-
For user documentation, including installing release builds, see the Sway Book: <https://fuellabs.github.io/sway/latest/>.
13
+
For user documentation, including installing release builds, see the latest released Sway Book: <https://fuellabs.github.io/sway/latest/>.
14
14
15
-
For Sway Standard library documentation, see: <https://fuellabs.github.io/sway/master/std/>
15
+
The documentation URLs describe different source versions:
16
16
17
-
Also view the technical reference for the Sway programming language: <https://fuellabs.github.io/sway/master/reference/>
17
+
-`latest` redirects to the most recently published Sway release.
18
+
-`vX.Y.Z` is documentation built from that exact Sway release tag.
19
+
-`master` is built from the default branch and may describe unreleased behavior.
20
+
21
+
These labels are Sway documentation versions. They are not Fuelup channel names and do not identify the toolchain activated on a Fuel network. Check the compiler you are running with `forc --version` and consult the [Fuelup channel documentation](https://install.fuel.network/master/concepts/channels.html) when selecting network-compatible tooling.
22
+
23
+
For Sway standard library documentation from the default branch, see <https://fuellabs.github.io/sway/master/std/>.
24
+
25
+
Also view the default-branch technical reference for the Sway programming language at <https://fuellabs.github.io/sway/master/reference/>.
26
+
27
+
The **Stable** Sway and Forc pages on `docs.fuel.network` are published by [`FuelLabs/docs-hub`](https://github.com/FuelLabs/docs-hub) from an explicitly selected Sway release. That selection can differ from both the newest upstream release and the compiler in a named Fuelup network channel.
Copy file name to clipboardExpand all lines: docs/book/src/advanced/assembly.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,12 @@ Note that in the above example:
46
46
47
47
An important note is that the `ji` and `jnei` opcodes are not available within an `asm` block. For those looking to introduce control flow to `asm` blocks, it is recommended to surround smaller chunks of `asm` with control flow (`if`, `else`, and `while`).
48
48
49
+
## Optimization Guidance
50
+
51
+
Inline assembly is not automatically cheaper than Sway. Measurements with Forc `0.71.2` found wins only when assembly removed fixed-loop or branch scaffolding; straight-line arithmetic, and assembly placed inside the original Sway loop, were gas-neutral or regressed.
52
+
53
+
Compare `forc test --release` gas and release bytecode size independently. Preserve checked-overflow behavior, zero-divisor and shift guards, evaluation order, memory effects, and reserved-register rules. Isolate a measured assembly kernel behind a small typed Sway function, and retain a readable Sway implementation as an oracle to differential-test the assembly against over boundary inputs. Revalidate assembly after every compiler or FuelVM upgrade.
54
+
49
55
## Helpful Links
50
56
51
57
For examples of assembly in action, check out the [Sway standard library](https://github.com/FuelLabs/sway/tree/master/sway-lib-std).
The compiler does not always eliminate duplicate storage operations:
35
+
36
+
- load an invariant value once before a loop and pass it to helpers;
37
+
- write only changed state and move invariant writes outside loops;
38
+
- do not reuse a cached value across an external call unless the reachable callbacks cannot mutate it;
39
+
- benchmark an ABI entry point, because helper-only gas does not price a storage path that the benchmark never executes.
40
+
32
41
## Storing Structs
33
42
34
43
To store a struct in storage, each variable must be assigned in the `storage` block. This can be either my assigning the fields individually or using a public [constructor](../basics/methods_and_associated_functions.md#constructors) that can be evaluated to a constant during compilation.
Copy file name to clipboardExpand all lines: docs/book/src/examples/sway_applications.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
The [Sway-Applications](https://github.com/FuelLabs/sway-applications) Repository contains end-to-end example applications that are written in Sway in order to demonstrate what can be built.
4
4
5
+
> **Legacy examples:** These applications are version-pinned snapshots and are not continuously updated for the current Sway release or Fuel network toolchains. Read the repository's [status and toolchain matrix](https://github.com/FuelLabs/sway-applications#project-status-and-toolchains) before using an example. Treat old syntax, dependencies, transaction construction, and security patterns as historical until revalidated.
6
+
5
7
## Asset Management
6
8
7
9
-[Airdrop](https://github.com/FuelLabs/sway-applications/tree/master/airdrop) is an asset distribution program where users are able to claim assets given a valid merkle proof.
Copy file name to clipboardExpand all lines: docs/book/src/forc/index.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
Forc stands for Fuel Orchestrator. Forc provides a variety of tools and commands for developers working with the Fuel ecosystem, such as scaffolding a new project, formatting, running scripts, deploying contracts, testing contracts, and more. If you're coming from a Rust background, forc is similar to cargo.
4
4
5
+
The core `forc` executable is released from the [`FuelLabs/sway`](https://github.com/FuelLabs/sway) repository. Some network-facing plugins, including `forc-client` and `forc-node`, are released independently from [`FuelLabs/forc`](https://github.com/FuelLabs/forc). Consequently, a Sway compiler version is not a complete plugin compatibility matrix. Check each installed executable with `<command> --version`; when its version differs from this book's release, prefer that executable's `--help` output for exact flags.
6
+
5
7
If you are new to Forc, see the [Forc Project](https://docs.fuel.network/docs/sway/introduction/forc_project/) introduction section.
6
8
7
9
For a comprehensive overview of the Forc CLI commands, see the [Commands](./commands/index.md) section.
Copy file name to clipboardExpand all lines: docs/book/src/index.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
Welcome to the Sway programming language book 🌴.
4
4
5
+
> **Documentation version:** A `vX.Y.Z` URL is built from that exact Sway release tag. The [`latest`](https://fuellabs.github.io/sway/latest/) URL redirects to the most recently published release, while [`master`](https://fuellabs.github.io/sway/master/book/) describes the default branch and may include unreleased behavior. These are documentation versions, not Fuelup channel names. Run `forc --version` to identify the compiler you are using and consult the [Fuelup channel documentation](https://install.fuel.network/master/concepts/channels.html) before choosing tooling for a network.
6
+
5
7
**Q: Hi! What is Sway?**
6
8
7
9
Sway is a domain-specific programming language for implementing smart contracts on blockchain platforms, most notably for the [Fuel Virtual Machine (Fuel VM)](https://docs.fuel.network/docs/specs/fuel-vm/).
@@ -55,7 +57,7 @@ If you don't want to install anything just yet, you can use the [Sway Playground
55
57
56
58
**Q: Where can I find example Sway code?**
57
59
58
-
You can find example applications built with Sway in the [Sway Applications repository](https://github.com/FuelLabs/sway-applications) on GitHub. You can also find projects building on Fuel in the [Fuel ecosystem home](https://app.fuel.network/ecosystem).
60
+
You can find historical example applications built with Sway in the [Sway Applications repository](https://github.com/FuelLabs/sway-applications) on GitHub. That repository contains version-pinned legacy snapshots, so check its status matrix before copying an example into a current project. You can also find projects building on Fuel in the [Fuel ecosystem home](https://app.fuel.network/ecosystem).
0 commit comments