Harden mesh bootstrap defaults

This commit is contained in:
BigBodyCobain
2026-07-10 20:27:56 -06:00
parent 09c8a2e6d4
commit d38c886af9
15 changed files with 183 additions and 24 deletions
@@ -66,6 +66,8 @@ export default function BootstrapView({ marketId, onBack }: BootstrapViewProps)
const swarmPullOk = Boolean(swarmPull?.ok) && !swarmPull?.skipped;
const lastPeerUrl = String(nodeStatus?.sync_runtime?.last_peer_url || '').trim();
const privateTransportRequired = Boolean(nodeStatus?.private_transport_required);
const bootstrapState = String(nodeStatus?.bootstrap?.bootstrap_state || '').toLowerCase();
const bootstrapDetail = String(nodeStatus?.bootstrap?.bootstrap_detail || '').trim();
const toggleNode = useCallback(async (enabled: boolean) => {
setNodeToggleBusy(true);
@@ -179,14 +181,16 @@ export default function BootstrapView({ marketId, onBack }: BootstrapViewProps)
? 'LOCAL FILE'
: swarmPull?.skipped
? 'WAITING'
: 'NOT LOADED'}
: bootstrapState === 'connecting'
? 'CONNECTING'
: 'LOCAL ONLY'}
</div>
</div>
</div>
<div className="mt-3 flex flex-col md:flex-row md:items-center gap-3">
<div className="flex-1 text-[11px] text-gray-500 leading-relaxed">
{nodeEnabled
? `Infonet sync is ${syncOutcome || 'active'}${lastPeerUrl ? ` via ${lastPeerUrl}` : ''}.`
? (bootstrapDetail || `Infonet sync is ${syncOutcome || 'active'}${lastPeerUrl ? ` via ${lastPeerUrl}` : ''}.`)
: 'Start a local participant node to sync through available Wormhole onion/RNS peers while this backend is running.'}
</div>
<button
@@ -14,12 +14,15 @@ interface Stats {
nodeEnabled: boolean;
syncOutcome: string;
syncError: string;
bootstrapState: string;
bootstrapDetail: string;
artiReady: boolean | null;
}
const EMPTY: Stats = {
meshtastic: 0, aprs: 0, ledgerNodes: 0, infonetEvents: 0,
syncPeers: 0, seedPeers: 0, nodeEnabled: false, syncOutcome: 'offline', syncError: '',
bootstrapState: 'offline', bootstrapDetail: '',
artiReady: null,
};
@@ -57,6 +60,7 @@ export default function NetworkStats() {
?? 0,
);
const syncOutcome = String(infonet?.sync_runtime?.last_outcome || 'offline').toLowerCase();
const bootstrapState = String(infonet?.bootstrap?.bootstrap_state || '').toLowerCase();
const artiReady = typeof wormholeRes?.arti_ready === 'boolean' ? wormholeRes.arti_ready : null;
setStats({
meshtastic: Number(channelsRes?.total_live || channelsRes?.total_nodes || meshRes?.signal_counts?.meshtastic || 0),
@@ -68,6 +72,8 @@ export default function NetworkStats() {
nodeEnabled: Boolean(infonet?.node_enabled),
syncOutcome,
syncError: String(infonet?.sync_runtime?.last_error || '').trim(),
bootstrapState,
bootstrapDetail: String(infonet?.bootstrap?.bootstrap_detail || '').trim(),
artiReady,
});
} catch { /* ignore */ }
@@ -78,17 +84,21 @@ export default function NetworkStats() {
}, []);
const artiBlocked = isArtiTransportBlocked(stats.syncError, stats.artiReady);
const connecting = stats.bootstrapState === 'connecting';
const localActive = stats.syncOutcome === 'solo' || (stats.nodeEnabled && connecting);
const nodeColor = stats.syncOutcome === 'ok' || stats.syncOutcome === 'solo' ? 'text-green-400'
: stats.syncOutcome === 'running' ? 'text-amber-400'
: stats.nodeEnabled ? 'text-amber-400' : 'text-gray-600';
const nodeLabel = stats.syncOutcome === 'ok' ? 'SEED SYNCED'
: stats.syncOutcome === 'solo' ? 'SOLO'
: localActive ? 'LOCAL ACTIVE'
: stats.syncOutcome === 'running' ? 'SYNCING'
: stats.syncOutcome === 'error' || stats.syncOutcome === 'fork'
? (artiBlocked ? 'ARTI WARMING' : 'SYNC BACKOFF')
? (artiBlocked ? 'ARTI WARMING' : 'CONNECTING')
: stats.nodeEnabled ? 'WAITING' : 'OFFLINE';
const nodeTitle = stats.syncError
? `Infonet seed sync: ${stats.syncError}`
const nodeTitle = stats.bootstrapDetail
? stats.bootstrapDetail
: stats.syncError
? `Infonet seed sync is retrying in the background: ${stats.syncError}`
: stats.nodeEnabled
? 'Participant node enabled; waiting for seed ledger sync.'
: 'Participant node offline.';
@@ -15,6 +15,8 @@ export interface RnsStatusSnapshot {
export interface InfonetBootstrapSnapshot {
node_mode?: string;
bootstrap_state?: string;
bootstrap_detail?: string;
manifest_loaded?: boolean;
manifest_signer_id?: string;
manifest_valid_until?: number;
@@ -32,6 +34,8 @@ export interface InfonetBootstrapSnapshot {
skipped?: boolean;
reason?: string;
detail?: string;
retrying?: boolean;
tried_seed_count?: number;
peer_count?: number;
merged_peer_count?: number;
seed_peer_url?: string;