Skip to content

Commit f6f371c

Browse files
committed
remove reputation
1 parent 130d333 commit f6f371c

File tree

12 files changed

+2
-3796
lines changed

12 files changed

+2
-3796
lines changed

relay/src/index.ts

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import fs from "fs";
44
import cors from "cors";
55
import dotenv from "dotenv";
66
import setSelfAdjustingInterval from "self-adjusting-interval";
7-
import crypto from "crypto";
87
import { fileURLToPath } from "url";
98
import Gun from "gun";
109
import "gun/sea";
@@ -16,8 +15,6 @@ import "./utils/bullet-catcher";
1615

1716
import multer from "multer";
1817
import { initRelayUser, getRelayUser } from "./utils/relay-user";
19-
import * as Reputation from "./utils/relay-reputation";
20-
import * as FrozenData from "./utils/frozen-data";
2118
import SQLiteStore from "./utils/sqlite-store";
2219
import S3Store from "./utils/s3-store";
2320
import { loggers } from "./utils/logger";
@@ -38,7 +35,6 @@ import {
3835
import { startWormholeCleanup } from "./utils/wormhole-cleanup";
3936
import { tokenAuthMiddleware } from "./middleware/token-auth";
4037
import { secureCompare, hashToken, createProductionErrorHandler } from "./utils/security";
41-
import { announceRelayPresence, syncGunDBPeers, syncMulePeers } from "./utils/peer-discovery";
4238

4339
import { GUN_PATHS, getGunNode } from "./utils/gun-paths";
4440
// Chat service removed
@@ -500,13 +496,8 @@ async function initializeServer() {
500496

501497
const gun = (Gun as any)(gunConfig);
502498

503-
<<<<<<< HEAD
504499
// Initialize Gun Alias Guard to prevent duplicate usernames
505500
gunAliasGuard(gun);
506-
507-
508-
=======
509-
>>>>>>> 0e2afc9b6825ccb0789c64c14f714e13a829b678
510501
// Store gun instance in express app for access from routes
511502
app.set("gunInstance", gun);
512503
// Store the gun storage adapter for stats access
@@ -707,14 +698,6 @@ See docs/RELAY_KEYS.md for more information.
707698
// Not a valid URL, use as-is
708699
}
709700

710-
// Initialize reputation tracking for this relay
711-
try {
712-
Reputation.initReputationTracking(gun, host);
713-
loggers.server.info({ host }, `📊 Reputation tracking initialized`);
714-
} catch (e: any) {
715-
loggers.server.warn({ err: e }, "⚠️ Failed to initialize reputation tracking");
716-
}
717-
718701
// Initialize Network Pin Request Listener (auto-replication)
719702
const autoReplication = replicationConfig.autoReplication;
720703

@@ -858,13 +841,6 @@ See docs/RELAY_KEYS.md for more information.
858841
status: "completed",
859842
});
860843

861-
// Record pin fulfillment for reputation tracking
862-
try {
863-
await Reputation.recordPinFulfillment(gun, host, true);
864-
} catch (e: any) {
865-
loggers.server.warn({ err: e }, "Failed to record pin fulfillment for reputation");
866-
}
867-
868844
// Publish response
869845
const crypto = await import("crypto");
870846
const responseId = crypto.randomBytes(8).toString("hex");
@@ -884,15 +860,6 @@ See docs/RELAY_KEYS.md for more information.
884860
status: "failed",
885861
});
886862

887-
// Record failed pin fulfillment
888-
try {
889-
await Reputation.recordPinFulfillment(gun, host, false);
890-
} catch (e: any) {
891-
// Silent in production
892-
if (loggingConfig.debug) {
893-
loggers.server.warn("Failed to record pin fulfillment for reputation:", e.message);
894-
}
895-
}
896863
}
897864
} catch (error: any) {
898865
if (loggingConfig.debug) {
@@ -906,12 +873,6 @@ See docs/RELAY_KEYS.md for more information.
906873
status: "failed",
907874
});
908875

909-
// Record failed pin fulfillment for reputation tracking
910-
try {
911-
await Reputation.recordPinFulfillment(gun, host, false);
912-
} catch (e: any) {
913-
// Silent in production
914-
}
915876
}
916877
});
917878
} else {
@@ -1190,93 +1151,8 @@ See docs/RELAY_KEYS.md for more information.
11901151
addTimeSeriesPoint("connections.active", activeWires);
11911152
addTimeSeriesPoint("memory.heapUsed", process.memoryUsage().heapUsed);
11921153

1193-
// Record pulse for reputation tracking (own uptime)
1194-
try {
1195-
await Reputation.recordPulse(gun, host);
1196-
// Periodically update stored score (every 10 minutes = 20 pulses)
1197-
if (Math.random() < 0.05) {
1198-
// ~5% chance each pulse
1199-
await Reputation.updateStoredScore(gun, host);
1200-
}
1201-
} catch (e: any) {
1202-
// Non-critical, don't log every time
1203-
}
1204-
1205-
// Create frozen (immutable, signed) announcement every ~5 minutes
1206-
// Only if relay user is initialized (has keypair for signing)
1207-
try {
1208-
const relayUser = getRelayUser();
1209-
if (relayUser && relayUser.is && Math.random() < 0.1) {
1210-
// ~10% chance = every ~5 min
1211-
const announcement = {
1212-
type: "relay-announcement",
1213-
host,
1214-
port,
1215-
name: relayConfig.name,
1216-
version: packageConfig.version,
1217-
uptime: process.uptime(),
1218-
connections: pulse.connections,
1219-
ipfs: pulse.ipfs,
1220-
// Use object instead of array for GunDB compatibility
1221-
capabilities: {
1222-
"ipfs-pin": true,
1223-
"storage-proof": true,
1224-
"x402-subscription": true,
1225-
"storage-deals": true,
1226-
},
1227-
};
1228-
1229-
await FrozenData.createFrozenEntry(
1230-
gun,
1231-
announcement,
1232-
(relayUser as any)?._?.sea, // SEA keypair
1233-
"relay-announcements",
1234-
host
1235-
);
1236-
}
1237-
} catch (e: any) {
1238-
// Non-critical, frozen announcements are optional
1239-
if (loggingConfig.debug) loggers.server.debug({ err: e }, "Frozen announcement skipped");
1240-
}
12411154
}, 30000); // 30 seconds
12421155

1243-
// ============================================================================
1244-
// GUNDB PEER DISCOVERY
1245-
// ============================================================================
1246-
1247-
try {
1248-
const ownEndpoint = process.env.RELAY_HOST
1249-
? `https://${process.env.RELAY_HOST}`
1250-
: `http://localhost:${port}`;
1251-
1252-
// Start GunDB-based peer discovery
1253-
syncGunDBPeers(gun, ownEndpoint);
1254-
syncMulePeers(gun);
1255-
1256-
// Announce presence on GunDB
1257-
if (relayKeyPair && relayKeyPair.pub) {
1258-
const relayInfo = {
1259-
endpoint: ownEndpoint,
1260-
version: packageConfig.version,
1261-
alias: relayConfig.name,
1262-
};
1263-
1264-
// Announce immediately
1265-
announceRelayPresence(gun, relayInfo, relayKeyPair.pub);
1266-
1267-
// And periodically to update 'lastSeen'
1268-
setInterval(() => {
1269-
announceRelayPresence(gun, relayInfo, relayKeyPair.pub);
1270-
}, 60 * 1000); // Every minute
1271-
1272-
loggers.server.info({ pubKey: relayKeyPair.pub }, "📢 Relay presence announced on GunDB");
1273-
}
1274-
1275-
loggers.server.info("🔗 Started GunDB peer discovery");
1276-
} catch (error: any) {
1277-
loggers.server.warn({ err: error }, "⚠️ Failed to start peer discovery");
1278-
}
1279-
12801156
// Shutdown function
12811157
async function shutdown() {
12821158
loggers.server.info("🛑 Shutting down Shogun Relay...");

relay/src/public/dashboard/src/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Layout from "./components/Layout";
33
import Status from "./views/Status";
44
import LiveStats from "./views/LiveStats";
55
import Files from "./views/Files";
6-
import Network from "./views/Network";
76
// Torrents import removed
87
import Settings from "./views/Settings";
98
import ApiKeys from "./views/ApiKeys";
@@ -19,7 +18,6 @@ function App() {
1918
<Route index element={<Status />} />
2019
<Route path="stats" element={<LiveStats />} />
2120
<Route path="files" element={<Files />} />
22-
<Route path="network" element={<Network />} />
2321
{/* Torrents route removed */}
2422
<Route path="api-keys" element={<ApiKeys />} />
2523
<Route path="charts" element={<Charts />} />

relay/src/public/dashboard/src/components/Sidebar.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const iconMap: Record<string, string> = {
66
status: "◉",
77
stats: "▤",
88
files: "▢",
9-
network: "◇",
109
apiKeys: "◈",
1110
charts: "▦",
1211
visualGraph: "◬",
@@ -26,7 +25,6 @@ const navItems: NavItem[] = [
2625
{ path: "/", icon: iconMap.status, label: "Status", group: "main" },
2726
{ path: "/stats", icon: iconMap.stats, label: "Live Stats", group: "main" },
2827
{ path: "/files", icon: iconMap.files, label: "Files", group: "storage" },
29-
{ path: "/network", icon: iconMap.network, label: "Network", group: "network" },
3028
{ path: "/api-keys", icon: iconMap.apiKeys, label: "API Keys", group: "tools" },
3129
{ path: "/charts", icon: iconMap.charts, label: "Charts", group: "tools" },
3230
{ path: "/visual-graph", icon: iconMap.visualGraph, label: "Visual Graph", group: "tools" },
@@ -38,13 +36,12 @@ const navItems: NavItem[] = [
3836
const groupLabels: Record<string, string> = {
3937
main: "DASHBOARD",
4038
storage: "STORAGE",
41-
network: "NETWORK",
4239
tools: "TOOLS",
4340
system: "SYSTEM",
4441
};
4542

4643
function Sidebar() {
47-
const groups = ["main", "storage", "network", "tools", "system"];
44+
const groups = ["main", "storage", "tools", "system"];
4845

4946
return (
5047
<div className="drawer-side z-40">

0 commit comments

Comments
 (0)