Skip to content

feat: add --version / -V flag to stacks-node#12

Open
huth-stacks wants to merge 205 commits into
fork/node-ops-stabilizefrom
fork/pr-version-flag
Open

feat: add --version / -V flag to stacks-node#12
huth-stacks wants to merge 205 commits into
fork/node-ops-stabilizefrom
fork/pr-version-flag

Conversation

@huth-stacks

Copy link
Copy Markdown
Owner

Summary

  • Adds standard --version and -V flags to the stacks-node binary
  • Prints version string and exits, matching convention of most CLI tools
  • The version subcommand already exists; this adds the flag form

Changes

  • stacks-node/src/main.rs: 6 lines added (check for flag before subcommand parsing)

Test plan

  • stacks-node --version prints version and exits
  • stacks-node -V prints version and exits
  • stacks-node version still works (backwards compatible)
  • stacks-node start --config ... still works

🤖 Generated with Claude Code

brice-stacks and others added 30 commits February 10, 2026 15:32
- `Originator` mode: `deny` mode for origin account, `allow` mode for
  others
- `MaySend` condition code for NFTs: the asset may be sent, but it
  doesn't have to be
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
…ck if is for a post condition aborted transaction

Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
`supports_sip040_post_conditions` is more clear and future-safe.
Modify tests to ensure they always pass through this function, just like
in real world execution.
… into chore/stop-emitting-failed-transaction-events
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
aaronb-stacks and others added 29 commits March 24, 2026 20:46
This reduces the scope of the change.
…d-const-callable

Feat/improved const callable
Release binaries ship at ~130MB due to included debug info.
Adding strip = true reduces binary size to ~17MB without
affecting runtime behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The systemd unit had Restart=no, meaning any crash left the node
permanently down until manual intervention. Changing to on-failure
with a 30s delay enables automatic recovery while avoiding tight
restart loops from configuration errors (exit code 0).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Dockerfile had no health check, preventing container orchestrators
from detecting an unresponsive node. Adds curl-based check against
/v2/info endpoint with 30s interval. Installs curl in the slim image
since it's not present by default.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The event dispatcher panicked on invalid observer URLs and had no
retry limit, allowing a misconfigured observer to halt block
processing indefinitely.

Changes:
- Replace panic on URL parse failure with error return
- Replace expect on missing host with error return
- Replace panic on HTTP request encoding with error return
- Add max retry limit (25 attempts) to prevent infinite loops

A misconfigured observer URL now logs an error and returns
EventDispatcherError instead of crashing the node.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DNS resolution failures at startup caused the node to panic, which
is a race condition in Docker environments where DNS may not be
ready when the container starts. Now logs an error and skips the
unresolvable bootstrap node, allowing the node to start and discover
peers through other mechanisms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The add_deny_node function used chained unwrap() calls on DNS
resolution, which panics if the deny node hostname can't be
resolved. Now logs an error and skips the node, matching the
bootstrap node fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Five P2P message validation functions used assert!() on peer-supplied
payload_len values, allowing any unauthenticated peer to crash a node
by sending a message with a small payload_len (GitHub stacks-network#6978).

Replaced assert!() with proper error returns (net_error::DeserializeError)
in: validate_blocks_push, validate_microblocks_push,
validate_transaction_push, validate_stackerdb_push, and
validate_nakamoto_block_push.

Added tests for each function verifying that crafted short payloads
return errors instead of panicking.

Co-Authored-By: OpenAI Codex (GPT-5.4 xhigh) <noreply@openai.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The retry limit fix (cc7ae26) introduced a data loss regression:
when max retries were exhausted, the event was still deleted from
the DB, permanently losing it. Now keeps the event in the DB when
delivery fails so retry_pending_payloads can pick it up on restart.
Events are only deleted after successful delivery or when
disable_retries is true (fire-and-forget mode).

Also fixes stale comment that claimed make_http_request retries
until successful, which is no longer true.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change error!() calls in bootstrap/deny node resolution to use
structured key-value fields instead of format-string interpolation,
matching stacks-core logging conventions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Having debug = true with strip = true wastes compile time generating
debug info that gets immediately stripped. Set debug = false to skip
the generation entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Runs on every push to fork/** branches:
- Format check (cargo fmt-stacks --check)
- Clippy (cargo clippy-stacks + cargo clippy-stackslib)
- Release build with binary size report
- Quick tests via nextest (excluding slow stacks-node integration tests)

Keeps the fork honest on every push without the full upstream CI weight.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The general sqlite_open() function set WAL and synchronous pragmas
but no mmap_size, cache_size, or wal_autocheckpoint. This meant
sortition, chainstate, mempool, cost estimate, burnchain, and signer
databases all ran with SQLite defaults (2MB cache, no mmap,
autocheckpoint every 1000 pages).

Changes:
- Add mmap_size=256MB to all databases via sqlite_open()
- Add cache_size=32MB to all databases via sqlite_open()
- Add wal_autocheckpoint=500 for more frequent WAL checkpointing
- Increase MARF-specific mmap from 256MB to 1GB (state trie
  lookups benefit from a larger memory-mapped window)

These are standard SQLite tuning parameters. mmap uses virtual
address space (not physical RAM). cache_size is 32MB per connection.
More frequent checkpointing prevents the WAL file from growing
to GB+ during heavy block processing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The retry-on-startup path for pending event payloads used
unwrap_or_else(panic!) for URL parsing of both the stored payload
URL and the observer endpoint URL. A corrupt or changed URL in the
pending payloads DB would crash the node on restart.

Now logs an error and skips invalid payloads (deleting them from DB)
or skips observers with unparseable endpoints. Matches the error
handling pattern already applied to the main dispatch path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When no registered observer matches a pending payload (either because
the observer was removed from config or its endpoint URL is malformed),
the payload was being deleted from the DB. This silently loses events.

Now keeps unmatched payloads in the DB for retry on next restart,
when the observer may be reconfigured correctly. This matches the
retry-limit behavior where exhausted retries also preserve events.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test suite has ~9900 tests which exceeded the 30-minute timeout
on GitHub Actions runners. Increasing to 60 minutes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The node previously had only two effective log levels: default (info)
and debug (all 8,018 call sites fire, producing ~500GB/hour of logs).
This made debugging specific subsystems impractical.

Adds STACKS_LOG env var for per-component filtering:
  STACKS_LOG=net=debug,clarity=info,miner=warn

Components match as substrings against module_path!() values.
The "default" component sets the fallback level. Longest match wins.

Backwards compatible: BLOCKSTACK_DEBUG=1 and STACKS_LOG_DEBUG=1
still enable all debug logging. When STACKS_LOG is not set, behavior
is identical to before.

Implementation: macro-level guard check using module_path!() with
lazy_static component filter map. Zero overhead for filtered messages
(string formatting is skipped entirely).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The node had no disk space awareness — when the disk fills, SQLite
databases silently corrupt. Adds a check every 60 seconds in the
relayer thread that:
- Warns at <20GB free
- Logs critical error at <5GB free
- Initiates graceful shutdown at <1GB free (prevents corruption)

Uses df command for simplicity (no new crate dependencies).
Only runs on Linux; silently skips on other platforms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The node binary only supported `stacks-node version` as a subcommand.
Adds standard --version and -V flags that print the version string
and exit, matching the convention used by most CLI tools.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@huth-stacks huth-stacks force-pushed the fork/pr-version-flag branch from 74161a8 to affd4bf Compare March 29, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.