refactor: forc-node as lib (#7353)
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-fmt-check (push) Has been cancelled
CI / cargo-test-sway-lsp (push) Has been cancelled
CI / cargo-test-forc (push) Has been cancelled
CI / cargo-test-workspace (push) Has been cancelled
CI / verifications-complete (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
Codspeed Benchmarks / benchmarks (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 / cargo-run-e2e-test (push) Has been cancelled
CI / cargo-run-e2e-test-release (push) Has been cancelled
CI / cargo-test-forc-debug (push) Has been cancelled
CI / cargo-test-forc-client (push) Has been cancelled
CI / cargo-test-forc-mcp (push) Has been cancelled
CI / cargo-test-forc-node (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled

## 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>
This commit is contained in:
zees-dev 2025-09-04 17:02:26 +12:00 committed by GitHub
parent 6d47ca562e
commit 1f9880f60d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 3707 additions and 307 deletions

View file

@ -232,6 +232,7 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
- uses: buildjet/cache@v3
with:
path: |
@ -339,6 +340,7 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "buildjet"
@ -356,6 +358,7 @@ jobs:
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "buildjet"
@ -745,6 +748,7 @@ jobs:
with:
# `cargo-udeps` requires nightly to run
toolchain: ${{ env.NIGHTLY_RUST_VERSION }}
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "buildjet"