Skip to content

Migrate forc-node from the sway repo#130

Merged
JoshuaBatty merged 16 commits intomainfrom
josh/forc-node
Jan 6, 2026
Merged

Migrate forc-node from the sway repo#130
JoshuaBatty merged 16 commits intomainfrom
josh/forc-node

Conversation

@JoshuaBatty
Copy link
Copy Markdown
Member

Summary

Migrates forc-node from the sway repository into the forc monorepo, continuing the toolchain consolidation effort from sway-rfcs#49.

Changes

New Workspace Member

  • forc-node - CLI tool for bootstrapping Fuel nodes
    • Uses path dependency for forc-tracing (within monorepo)
    • Uses crates.io forc-util for CLI utilities
    • Depends on fuel-core for node functionality

New Workspace Dependencies

  • fuel-core, fuel-core-chain-config, fuel-crypto
  • dialoguer, libc, portpicker, reqwest, semver, sha1, wiremock

Post-merge Tasks

  • Cut release: forc-node-0.71.0
  • Update fuelup to fetch forc-node from this repo
  • Update fuel.nix with version routing for forc-node
  • Update sway-nightly-binaries to build forc-node from here
  • Remove forc-node from sway repo

Related

kayagokalp and others added 16 commits February 15, 2025 12:34
## Description

Moves dev dependencies to the workspace Cargo.toml for consistent
versions in tests.

Inspired by FuelLabs/sway#6955

## 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.
## Description


## Checklist

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

Descriptions are required for crates.io published packages.

## 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.
## Description
closes #7193.

There was a simple bug in the mainnet setup we were still fetching
testnet configuration. Which caused some syncing issues.
## Description

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

## Checklist

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

---------

Co-authored-by: z <zees-dev@users.noreply.github.com>
Co-authored-by: zees-dev <63374656+zees-dev@users.noreply.github.com>
Co-authored-by: JoshuaBatty <joshpbatty@gmail.com>
Co-authored-by: IGI-111 <igi-111@protonmail.com>
## Description

Adds a check to try and set the `NOFILE` limit on Unix-based systems.
This is important for RocksDB, since we generally exceed the default
maximum number of allowed file descriptors allowed by the OS.

The idea is to attempt to raise that limit to a reasonable number, and
throw an error if we are unable to (likely due to user permission
issues).

## 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.
## Description

This PR improves the readability of `format!`, `write!`, etc. macros by
rolling out the Clippy fixes for the `uninlined_format_args` lint.
`cargo clippy` started showing this lint after locally switching to
Cargo v1.88.0.

Additionally, the PR:
- replaces a few occurrences of
`io::Error::new(std::io::ErrorKind::Other, <msg>)` with
`io::Error::other(<msg>)`.
- replaces a single occurrence of `if params.iter().any(|&p| p ==
"all")` with `if params.contains(&"all")`.

## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [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.
## Description

This PR fundamentally refactors the `forc-node` plugin architecture by
embedding the Fuel Core node directly as an in-process library rather
than spawning it as a subprocess.
This architectural change modernizes the forc-node plugin and lays the
groundwork for advanced local development features.

## 🔄 Changes Overview

### Core Architectural Changes
- **In-Process Execution**: Fuel Core now runs within the same process
as the plugin, eliminating subprocess management overhead
- **Direct Integration**: Replaced subprocess spawning with direct
library calls to fuel-core
- **Unified Logging**: Consolidated logging and error handling across
all execution modes
- **Improved Configuration**: Enhanced configuration display and
management for better debugging

### Dependency Updates
- Added direct fuel-core dependencies
- Added fuel-core-chain-config for configuration management
- Integrated tracing and tracing-subscriber for improved logging
- Updated Cargo.lock with necessary transitive dependencies

## 💡 Motivation

### Current Limitations
- Subprocess management adds complexity and potential failure points
- Limited ability to extend node functionality
- Difficult to implement advanced features like state forking (planned
feature)

### Benefits of This Change
1. **Performance**: Eliminates IPC overhead and reduces startup time
2. **Reliability**: Direct function calls are more reliable than
subprocess communication
3. **Extensibility**: Easier to add advanced features in future PRs

## 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>
Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
Co-authored-by: kaya <20915464+kayagokalp@users.noreply.github.com>
## Description

This PR adds support for directly funding accounts when starting a local
Fuel node with `forc-node`, eliminating the need to manually edit
chainspec files - via specifying `--account` parameter.

## Changes

- Added `--account` flag to `forc-node local` command that supports
multiple funding formats:
  - `<account-id>` - funds account with base asset and default amount
- `<account-id>:<asset-id>` - funds account with specified asset and
default amount
- `<account-id>:<asset-id>:<amount>` - funds account with specified
asset and amount

## Usage Examples

```bash
# Fund single account with default asset and amount
forc-node local \
  --account 0x54944e5b8189827e470e5a8bacfc6c3667397dc4e1eef7ef3519d16d6d6c6610

# Fund account with custom asset
forc-node local \
  --account 0x54944e5b8189827e470e5a8bacfc6c3667397dc4e1eef7ef3519d16d6d6c6610:0x0000000000000000000000000000000000000000000000000000000000000002

# Fund account with custom asset and amount
forc-node local \
  --account 0x54944e5b8189827e470e5a8bacfc6c3667397dc4e1eef7ef3519d16d6d6c6610:0x0000000000000000000000000000000000000000000000000000000000000002:1000000

# Fund multiple accounts
forc-node local \
  --account 0x54944e5b8189827e470e5a8bacfc6c3667397dc4e1eef7ef3519d16d6d6c6610 \
  --account 0xe10f526b192593793b7a1559a391445faba82a1d669e3eb2dcd17f9c121b24b1
```

## CLI output

<img width="1304" height="254" alt="Screenshot 2025-09-10 at 11 15
41 AM"
src="https://github.com/user-attachments/assets/add420e5-a64e-4c82-8605-99aeba7e878a"
/>

- 5 Initial/funded accounts are provided by forc-node (default 5)
- Additional accounts are user provided (optional)
  - These are introduced in this PR

## Implementation Details

- Default amount uses `TESTNET_INITIAL_BALANCE` constant when not
specified
- Default asset uses the chain's base asset ID when not specified

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

## 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.
- [ ] 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: z <zees-dev@users.noreply.github.com>
## Description

This PR adds expressive diagnostics for the `UnusedReturnValue` warning
that explains how to intentionally ignore a returned value by using `let
_ = ...`.

The reason for adding the diagnostics was an observed confusion among
novice Sway developers in the particular case of using `__dbg` intrinsic
as a statement:

```sway
__dbg("some debug message");
```

It was unclear to developers why this usage generates the warning, and
also how to remove it.

Additionally, the PR fixes some `uninlined_format_args` Clippy warnings.

## 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.
## Description

Bumping the rust version to 1.90 and fixing the clippy lints along the
way
## Description

- Reconfigure the `forc-node` crate to drop the `wasm-executor` feature
- disable fuel-core `default features`; explicit feature-set declaration
 - `forc-node` `local` CLI configurable args:
   - DB backend
   - debug mode
   - historical execution
   - PoA trigger directly
- Adjust the local-node test harness to cover the newly surfaced CLI
knobs.
- Remove the `wasm32-unknown-unknown` build target from CI and GitHub
Pages workflows.
- Regenerate Cargo.lock after the dependency and feature changes.

## 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>
## 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 -->
git-subtree-dir: forc-node
git-subtree-mainline: c10463b
git-subtree-split: 10d536b
@fuel-cla-bot
Copy link
Copy Markdown

fuel-cla-bot bot commented Jan 5, 2026

Thanks for the contribution! Before we can merge this, we need @IGI-111 to sign the Fuel Labs Contributor License Agreement.

@cursor
Copy link
Copy Markdown

cursor bot commented Jan 5, 2026

PR Summary

Adds a new workspace member forc-node to bootstrap Fuel nodes with sensible defaults and config management.

  • Implements CLI (forc-node) with modes: local (embedded service), testnet, and ignition (spawn fuel-core with generated args)
  • GitHub-driven chain config sync (chain_config.rs): checks local vs remote SHA1s, prompts user, and downloads configs for Testnet/Ignition; validates presence for Local
  • Orchestration layers (testnet/op.rs, ignition/op.rs, local/mod.rs) map high-level options to fuel-core flags via RunOpts
  • Utilities: keypair generation/collection, human-readable command/config output, open file descriptor checks, and logging init
  • Workspace updates: adds forc-node crate and shared dependencies in Cargo.toml; includes focused unit tests and an ignored integration test

Written by Cursor Bugbot for commit de23c5c. This will update automatically on new commits. Configure here.

@JoshuaBatty JoshuaBatty self-assigned this Jan 5, 2026
@JoshuaBatty JoshuaBatty added forc-node Everything related to forc-node, bootstrapping a fuel-core node and removed cla:missing labels Jan 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 5, 2026

LCOV of commit de23c5c during CI #39

Summary coverage rate:
  lines......: 44.3% (1249 of 2822 lines)
  functions..: 34.0% (155 of 456 functions)
  branches...: 28.9% (63 of 218 branches)

Files changed coverage rate: n/a

@JoshuaBatty JoshuaBatty merged commit c9ee8ad into main Jan 6, 2026
13 of 15 checks passed
@JoshuaBatty JoshuaBatty deleted the josh/forc-node branch January 6, 2026 03:35
JoshuaBatty added a commit to FuelLabs/fuel.nix that referenced this pull request Jan 15, 2026
## Summary

Migrates `forc-node` package support from the `sway` repository to the
`forc` monorepo, effective from version 0.71.0 onwards.

This follows the same pattern established in #205 for `forc-crypto`.

## Changes

- **refresh-manifests.sh**: Added `pkg_forc_node` with legacy repo
routing (sway < 0.71.0, forc >= 0.71.0)
- **patches.nix**: 
  - Added `forc-node` to `forc-plugins` list for openssl dependencies
  - Added `buildAndTestSubdir` patch for forc monorepo builds
  - Added clang/rocksdb dependencies required for fuel-core bindings
- **packages.md**: Added forc-node to documentation

## Related PRs

- forc: [FuelLabs/forc#130](FuelLabs/forc#130) -
Migrate forc-node from sway repo
- fuelup:
[FuelLabs/fuelup#819](FuelLabs/fuelup#819) -
Migrate forc-node from sway to forc monorepo
- sway-nightly-binaries:
[FuelLabs/sway-nightly-binaries#81](FuelLabs/sway-nightly-binaries#81)
- Migrate forc-node nightly builds

## RFC

[FuelLabs/sway-rfcs#49](FuelLabs/sway-rfcs#49) -
Tooling Monorepo RFC

---------

Co-authored-by: GitHub Action <action@github.com>
ironcev added a commit to FuelLabs/sway that referenced this pull request Jan 16, 2026
## Summary

This PR completes the sway-side of migrating `forc-node` to the [forc
monorepo](https://github.com/FuelLabs/forc), as outlined in [RFC
#49](FuelLabs/sway-rfcs#49).

The corresponding forc repo PR:
FuelLabs/forc#130

`forc-node` has already been released from the forc repo (v0.71.2).

### Changes

- Remove `forc-node` crate from workspace
- Update CI to no longer build/test/package `forc-node` binary (it's now
built from forc repo)
- Update gh-pages workflow to install `forc-node` from forc repo for
documentation generation
- Remove unused workspace dependencies (`fuel-core`,
`fuel-core-chain-config`, `libp2p-identity`, `sha1`, `termion`)

### Distribution

Going forward, `forc-node` will be built and distributed from the forc
repo by:
- sway-nightly-binaries
- fuelup
- fuel.nix

### Documentation

Documentation for all tooling will continue to live in this repo. The
`gh-pages` workflow now pulls `forc-node` from the forc repo rather than
building it locally, so docs generation continues to work as before.

Co-authored-by: Igor Rončević <ironcev@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

forc-node Everything related to forc-node, bootstrapping a fuel-core node

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants