Skip to content

sgns::PruningConfig

Pruning policy configuration (GATE-06 policy half). More...

#include <PruneEligibility.hpp>

Public Functions

Name
PruningConfig FromJSON(const rapidjson::Value & pruning_object)
Parses and validates a "pruning" JSON object (GATE-06).

Public Attributes

Name
bool enabled
Whether pruning is enabled at all. Default false.
std::optional< uint64_t > finality_window
bool dry_run
Dry-run mode: report only, never erase (Phase 17 production mode).
uint64_t max_erases_per_cycle
uint64_t settle_seconds
std::optional< std::string > disabled_reason

Detailed Description

struct sgns::PruningConfig;

Pruning policy configuration (GATE-06 policy half).

Parsed from the "pruning" object of sgns_config.json via FromJSON by GeniusNode (17-06), which delegates every rule to this contract. Default is DISABLED — the config default is the consent gate (NodeType defaulting to Light is a role gate, never consent; Pitfall 8).

Public Functions Documentation

function FromJSON

static PruningConfig FromJSON(
    const rapidjson::Value & pruning_object
)

Parses and validates a "pruning" JSON object (GATE-06).

Parameters:

  • pruning_object The "pruning" member of sgns_config.json.

Return: The validated configuration.

Per-key type-checked reads with HasMember guards; absent members keep defaults. Fail-closed rule: enabled=true WITHOUT a finality_window > 0 forces enabled=false and sets disabled_reason to the fixed message — a positive N is required when enabled (D-02); a degenerate 0 is rejected at read time (WR-03), exactly like an absent window. A non-object value yields defaults. max_erases_per_cycle (default 100) and settle_seconds (default 60) follow the same per-key discipline: explicit positive values parse; 0 values are degenerate and rejected at read time (a 0-K cycle can never drain, a settle-less cycle can fire during initial sync), so the members keep their safe defaults; ill-typed members keep defaults too.

Public Attributes Documentation

variable enabled

bool enabled = false;

Whether pruning is enabled at all. Default false.

variable finality_window

std::optional< uint64_t > finality_window;

Finality window N (D-02): required when enabled, no default value. A spend is beyond the window when maxHeight − spend_height ≥ N.

variable dry_run

bool dry_run = false;

Dry-run mode: report only, never erase (Phase 17 production mode).

variable max_erases_per_cycle

uint64_t max_erases_per_cycle = 100;

Erase budget per cycle (D-04): at most this many eligible transactions erase per tick; the backlog self-drains across ticks. Default 100. A degenerate 0 is rejected at read time (WR-03 rule: a 0-K cycle can never drain) and the member keeps its safe default.

variable settle_seconds

uint64_t settle_seconds = 60;

Settle window in seconds (D-C2): a real cycle fires only once the tick gate has held for this long, so a cycle cannot fire during initial sync. Default 60. A degenerate 0 is rejected at read time and the member keeps its safe default.

variable disabled_reason

std::optional< std::string > disabled_reason;

Set when FromJSON had to fail-close an enabled request (missing finality_window); carries the operator-facing reason.


Updated on 2026-10-22 at 19:28:22 +0000