Skip to content

refactor: replace full-node flag with explicit node-mode config#5431

Open
martinconic wants to merge 6 commits into
masterfrom
refactor/node-mode-config
Open

refactor: replace full-node flag with explicit node-mode config#5431
martinconic wants to merge 6 commits into
masterfrom
refactor/node-mode-config

Conversation

@martinconic
Copy link
Copy Markdown
Contributor

@martinconic martinconic commented Apr 9, 2026

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Fixes #5172. The previous approach to node mode was implicit and
inconsistent: the mode was inferred from a combination of --full-node
(bool) and whether blockchain-rpc-endpoint was non-empty, which
diverged from the documented definition of modes and allowed silent
misconfigurations.

This PR introduces a single explicit --node-mode option with three
valid values: full, light, and ultra-light.

Key changes:

  • NodeMode string type added to pkg/node with constants FullMode,
    LightMode, UltraLightMode; replaces FullNodeMode bool in Options
  • --node-mode flag added; --full-node deprecated with a warning
    pointing to --node-mode=full
  • resolveNodeMode() in start.go enforces mode requirements at startup:
    Mode Requires
    full swap-enable: true + blockchain-rpc-endpoint
    light blockchain-rpc-endpoint
    ultra-light swap-enable must be false
  • isChainEnabled rewritten: no longer infers chain state from the RPC
    endpoint string — now reads directly from NodeMode
  • storage-incentives-enable default corrected to false (full node only)
  • chequebook-enable default corrected to false (requires swap-enable)
  • All packaging yamls (bee.yaml, scoop, homebrew-amd64, homebrew-arm64)
    restructured into labelled mode-based sections

Test plan

  • Start with node-mode: ultra-light and no RPC — node starts cleanly
  • Start with node-mode: light, no RPC — rejected with clear error
  • Start with node-mode: light + RPC — node starts in light mode
  • Start with node-mode: full, no RPC — rejected with clear error
  • Start with node-mode: full + RPC + swap-enable: false — rejected
  • Start with node-mode: full + RPC + swap-enable: true — full node
  • Start with legacy full-node: true — deprecation warning, behaves as node-mode: full
  • Start with node-mode: ultra-light + swap-enable: true — rejected

AI Disclosure

  • This PR contains code that has been generated by an LLM.
  • I have reviewed the AI generated code thoroughly.
  • I possess the technical expertise to responsibly review the code generated in this PR.

@martinconic martinconic added this to the 2026 milestone Apr 9, 2026
@martinconic martinconic added enhancement enhancement of existing functionality user-experience issue affecting user experience labels Apr 9, 2026
@martinconic martinconic self-assigned this Apr 9, 2026
@martinconic
Copy link
Copy Markdown
Contributor Author

Beekeeper changes are also needed

Comment thread .github/workflows/beekeeper.yml
@acud
Copy link
Copy Markdown
Contributor

acud commented Apr 16, 2026

needs a rebase

@martinconic martinconic force-pushed the refactor/node-mode-config branch from b374fd7 to b58c43a Compare April 16, 2026 09:12
Copy link
Copy Markdown
Contributor

@akrem-chabchoub akrem-chabchoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @martinconic, Glad to see this change, It will simplify and enhance the UX 🚀

Comment thread cmd/bee/cmd/cmd.go
@Cafe137
Copy link
Copy Markdown

Cafe137 commented Apr 23, 2026

What's the actual difference between swap-enable and chequebook-enable? Do we really need both?

@martinconic
Copy link
Copy Markdown
Contributor Author

What's the actual difference between swap-enable and chequebook-enable? Do we really need both?

The actual semantics are:

  • swap-enable = "participate in the swap settlement protocol at all" (peer cheque protocol + factory + cashout).
  • chequebook-enable = "I have funded my own chequebook and want to pay peers with cheques."

Functionally yes, we need them both, because swap=on, chequebook=off (receive-only / cash-out-only) is a genuine state. It's useful for: a node booting before its chequebook is funded, an operator who wants to earn from serving content without depositing collateral yet, and any deferred-funding workflow.

Resolves a conflict in pkg/node/node.go where master (#5460) added a
startup block-height verification guard for the postage listener, while
this branch replaced the o.FullNodeMode bool with o.NodeMode == FullMode.

Resolution keeps master's new guard and applies the NodeMode predicate
to the subsequent batch-service start branch.
Copy link
Copy Markdown
Contributor

@akrem-chabchoub akrem-chabchoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just there are some git conflicts

@martinconic
Copy link
Copy Markdown
Contributor Author

Just there are some git conflicts

New things were merged until my last commit, so yes, will address the merge conflicts.

Resolved packaging yaml conflicts (bee, scoop, homebrew-amd64,
homebrew-arm64): kept the mode-based section layout from this branch and
added the new 'use-simd-hashing' option from master. The p2p-wss,
nat-wss, autotls, and withdrawal-addresses-whitelist options master
appended already exist in the reorganized Network/Payments sections, so
master's duplicates were dropped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement enhancement of existing functionality user-experience issue affecting user experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate and refactor Bee node modes in node.go

5 participants