Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

Signer floors: env overrides so a paused engine cannot hog the topup queue

nirholas41f58344c43c
diff --git a/.env.example b/.env.example
index a6635cb92..e3e24e111 100644
--- a/.env.example
+++ b/.env.example
@@ -937,6 +937,15 @@ DB_RETENTION_HIGH_WATER_MB=470
# a SOL sweep smaller than this is skipped so fees never exceed the return.
ECONOMY_SWEEPBACK_MIN_SOL=
+# ── Per-signer floor overrides (api/_lib/solana-signers.js) ───────────────────
+# Override any registry signer's SOL floor (and topup refill target) without a
+# code deploy: SIGNER_MIN_SOL_<NAME> / SIGNER_REFILL_TO_SOL_<NAME>, signer name
+# upper-cased with dashes as underscores. Applied at module load, so topup
+# targets, balance alerts, and the floors dashboard all agree. Example: park the
+# autonomous launcher's 1 SOL floor while launches are paused so its deficit
+# stops outranking active engines in the deficit-sorted topup queue.
+# SIGNER_MIN_SOL_COIN_LAUNCHER_MASTER=0.05
+
# ── Agent activity engine (api/_lib/circulation.js, /api/cron/pulse-tick) ─────
# Operates a pool of platform-owned agents that transact with one another on-chain
# (tips, payments, trades, launches, on-chain registration) so the live money feed
diff --git a/api/_lib/solana-signers.js b/api/_lib/solana-signers.js
index 409dea8da..947240205 100644
--- a/api/_lib/solana-signers.js
+++ b/api/_lib/solana-signers.js
@@ -193,6 +193,22 @@ export const SOLANA_SIGNERS = [
},
];
+// Per-signer floor overrides: SIGNER_MIN_SOL_<NAME> / SIGNER_REFILL_TO_SOL_<NAME>
+// (name upper-cased, dashes to underscores, e.g. SIGNER_MIN_SOL_COIN_LAUNCHER_MASTER).
+// Applied at module load so every consumer (treasury-topup targets, balance
+// alerts, the floors dashboard) agrees on the effective floor. Exists so ops can
+// retune one engine's floor without a code deploy; the concrete case: the
+// autonomous launcher's 1 SOL floor is the fleet's largest deficit, and while
+// launches are paused it would otherwise outrank every active engine in the
+// deficit-sorted topup queue and absorb the whole fuel budget.
+for (const spec of SOLANA_SIGNERS) {
+ const key = spec.name.toUpperCase().replace(/-/g, '_');
+ const minSol = Number(process.env[`SIGNER_MIN_SOL_${key}`]);
+ if (Number.isFinite(minSol) && minSol >= 0) spec.minSol = minSol;
+ const refillTo = Number(process.env[`SIGNER_REFILL_TO_SOL_${key}`]);
+ if (Number.isFinite(refillTo) && refillTo > 0) spec.refillTo = refillTo;
+}
+
/**
* Decode a Solana secret key from any of the encodings used across the env:
* - JSON array of 64 ints (Solana CLI keypair file contents)
diff --git a/tests/x402-ring-revshare.test.js b/tests/x402-ring-revshare.test.js
index a94281e18..47d5bed08 100644
--- a/tests/x402-ring-revshare.test.js
+++ b/tests/x402-ring-revshare.test.js
@@ -52,3 +52,13 @@ describe('autonomous registry maintenance slots', () => {
for (const e of maint) expect(typeof e.run).toBe('function');
});
});
+
+describe('signer floor env overrides', () => {
+ it('SIGNER_MIN_SOL_<NAME> overrides a registry floor at load', async () => {
+ process.env.SIGNER_MIN_SOL_COIN_LAUNCHER_MASTER = '0.05';
+ const { SOLANA_SIGNERS } = await import('../api/_lib/solana-signers.js?floor-override');
+ const spec = SOLANA_SIGNERS.find((s) => s.name === 'coin-launcher-master');
+ expect(spec.minSol).toBe(0.05);
+ delete process.env.SIGNER_MIN_SOL_COIN_LAUNCHER_MASTER;
+ });
+});