ReserveGrid OS v0.2.2
ReserveGrid OS v0.2.2 — Foresight
Scope
v0.2.2 introduces consensus safety primitives into the policy layer, grounded in real world mining pool failure modes observed across the last two years. Weight ratio enforcement and template staleness checks activate using fields already present in the protocol. Sigops and coinbase accounting fields land as optional forward compatible additions with observe only logging, no enforcement until 0.2.3. All new checks default to observe only mode and require explicit operator opt in for rejection. The built-in dashboard ships a consensus safety panel and collapsible aggregate reason categories. The public observe mode dashboard reaches full feature parity with the built-in dashboard, adds enforcement mode badges, mempool context, CSV/NDJSON export links, and hardens the auth bypass to localhost only.
rg-protocol consensus safety fields
New optional fields on TemplatePropose
total_sigops: Option<u32>total signature operations across all transactions in the templatecoinbase_sigops: Option<u32>signature operations attributed to the coinbase transactiontemplate_weight: Option<u64>total serialized weight reported bygetblocktemplate- All three use
#[serde(default)]for backward compatibility with older senders - No protocol version bump required
New VerdictReason variants
WeightRatioExceeded(weight_ratio_exceeded) template weight exceedssafety.max_weight_ratioof consensus maxTemplateStale(template_stale) template age exceedssafety.max_template_age_msSigopsBudgetWarning(sigops_budget_warning) observe only, total sigops approaching consensus limitCoinbaseSigopsAbnormal(coinbase_sigops_abnormal) observe only, coinbase sigops outside expected reservation rangeVerdictReason::ALLandVerdictReason::ALL_CODESupdated, length assertion bumped from 11 to 15
Template manager GBT field extraction
Sigops and weight extraction
- Parses
sigopsandweightfrom each transaction entry in the GBT response - Sums total sigops across all non-coinbase transactions
coinbase_sigopsset toNonein 0.2.2 becausebitcoincore-rpc0.18.0 does not expose the coinbase transaction on the GBT result struct (tracked for 0.2.3 via raw JSON parsing or crate upgrade)- Populates
template_weightfrom per-transactionweightfield summation
Template timestamp
created_at_unix_msnow stamped on everyTemplateProposeat creation time- Enables downstream staleness detection without clock synchronization assumptions
Pool verifier policy enforcement
Enforced checks (opt in, default observe only)
weight_ratio_exceededactivates whenobserved_weightortemplate_weightdivided by max block weight (4,000,000 WU) exceedssafety.max_weight_ratiotemplate_staleactivates when current time minuscreated_at_unix_msexceedssafety.max_template_age_ms- Each check gated by
safety.enforce_weight_ratioandsafety.enforce_template_agebooleans in policy TOML, both defaultfalse - When
enforce = false, structured warning log emitted with metric values but verdict stays accept
Observed checks (log and dashboard only, no rejection path)
- Sigops headroom: warns when
total_sigopsexceedssafety.warn_sigops_ratioof the 80,000 consensus limit - Coinbase sigops anomaly: warns when
coinbase_sigopsexceedssafety.warn_coinbase_sigops_max - Both thresholds configurable under
[policy.safety] - Warnings carry full policy context for traceability
Policy TOML additions under [policy.safety]
max_weight_ratiofloat, default0.999max_template_age_msmaximum acceptable template age in millisecondsenforce_weight_ratioboolean, defaultfalseenforce_template_ageboolean, defaultfalsewarn_sigops_ratiofloat, default0.95(warn at 95% of consensus limit)warn_coinbase_sigops_maxinteger, default400
Deterministic evaluation
evaluate_dynamicaccepts explicitnow_ms: u64parameter for testabilityevaluate()wrapper callsnow_unix_ms()internally, preserving existing call sites- Safety checks run after existing 8 economic and structural checks in fixed order
CSV export completeness
/verdicts.csvheader and row formatting include all v0.2.2 fields:template_weight,total_sigops,coinbase_sigops,created_at_unix_ms,safety_warnings
Dashboard (built-in)
Consensus safety panel
- Weight utilization gauge showing template weight as percentage of 4,000,000 WU max
- Sigops headroom bar showing total sigops as percentage of 80,000 limit
- Template age display for most recent verdict
- Coinbase sigops reservation indicator
- Color thresholds: red at >99% weight, >95% sigops, >30s template age, >400 coinbase sigops
- All metrics live even in observe only mode
Aggregate reason categories rework
- Reason aggregates now display as collapsible categories sorted by count
- Clicking a category expands to show the last 15 matching verdicts with template id, block height, timestamp, and reason detail
- Overflow indicator shows count of remaining verdicts beyond the visible 15
- Accepted ("ok") category displayed as count only, not expandable
- Expand state persists across 3 second refresh cycles
- Chevron rotation animates via CSS transition
Observe mode (veldra-site-v3)
Full v0.2.2 feature parity with built-in dashboard
- Consensus safety panel with weight utilization gauge, sigops headroom gauge, template age, and coinbase sigops
- Collapsible aggregate reason categories with verdict drill-down (last 10 per reason code)
- Safety warning lines displayed on verdict rows
- Four new reason codes in the catalog table with Safety category badge (
weight_ratio_exceeded,template_stale,sigops_budget_warning,coinbase_sigops_abnormal) - Updated mock data and policy for demo mode with v0.2.2 fields
- "How It Works" flow updated to mention consensus safety checks
Enforcement mode badges
- Each safety gauge displays an "enforced" or "observe" badge pulled from the
/policyresponse - Weight ratio and template age reflect their
enforce_*flags - Sigops and coinbase always show "observe" in 0.2.2
Mempool context bar
- Displays live mempool tx count, memory usage percentage, and derived fee tier
- Tier derived from policy
low_mempool_txandhigh_mempool_txthresholds - Freshness indicator shows seconds since last mempool snapshot
- Hidden when mempool endpoint is unavailable (demo mode or disconnected)
CSV and NDJSON export links
- Export bar appears below the verdict stream when connected to a live backend
- Links point directly to
/verdicts.csvand/verdicts/logon the configured API endpoint - Hidden in demo mode since there is no backend to export from
Security hardening
?noauthbypass restricted tolocalhostand127.0.0.1only; ignored on production domains- Mixed content warning displayed when the page is served over https but the API URL uses http
Stale data overlay
- When data is older than 30 seconds, opacity dim now applies to all panels: stats grid, verdict stream, reason chart, safety panel, tier cards, and mempool bar
- Previously only the stats grid was affected
sv2-bridge compatibility
TemplateProposeconstruction updated withtotal_sigops: None,coinbase_sigops: None,template_weight: None- Synthetic bridge has no real consensus data; fields set to
Noneso the verifier knows values are unavailable
Repo policy files
- All four profiles updated with
[policy.safety]section:policy.toml,demo-showcase-policy.toml,demo-strict-policy.toml,demo-open-policy.toml - Strict profile enables enforcement:
enforce_weight_ratio = true,enforce_template_age = true, tighter thresholds (max_weight_ratio = 0.95,warn_sigops_ratio = 0.90) - Base and demo profiles default to observe only
Test matrix
weight_ratio_exceeded_enforcedweight_ratio_exceeded_observe_onlyweight_ratio_under_limit_no_warningtemplate_stale_enforcedtemplate_stale_observe_onlysigops_warning_fires_above_thresholdsigops_warning_silent_below_thresholdcoinbase_sigops_anomaly_detectionnew_fields_backward_compatible_serdeall_codes_match_as_str(updated for new variants)all_constant_covers_every_variant(length bumped to 15)