Commit Graph

29 Commits

Author SHA1 Message Date
LKLY 9b5b1de5d9 Merge branch 'main' into optimizations 2026-01-02 15:00:57 -05:00
lklynet 07404e9583 refactor: remove MAX_PEERS limit and related enforcement logic 2026-01-02 14:57:57 -05:00
Kilian Tyler bfdefcd1a7 fix(peers): count and relay peers even when storage is full
Previously, when seenPeers reached MAX_PEERS, new peer messages were
completely dropped - never verified, counted, or relayed. This caused
the node to stop discovering new peers and stop propagating messages.

Now we always verify, count (HyperLogLog), and relay valid messages.
We just don't store peers in seenPeers if we're at capacity.
2026-01-02 14:39:49 -05:00
Kilian Tyler 8711a4e0fa perf(heartbeat): add adaptive rate with fast startup sync
- Fast mode (2s interval) for first 2 minutes after first connection
- Slow mode (30s interval) for steady state operation
- Timer starts on first connection, not process start
- Stale peer timeout increased to 90s to match slower heartbeat
2026-01-02 14:30:21 -05:00
Kilian Tyler 3fcf71d6e8 perf(peers): use lightweight Buffer storage instead of KeyObject
Store raw DER buffer (~100 bytes) instead of parsed KeyObject (~2-5KB)
per peer. Parse on-demand during verification only. Also reduces
MAX_PEERS from 10000 to 1000 for better memory efficiency.
2026-01-02 14:29:19 -05:00
Kilian Tyler 5d1e4f059e feat(peers): add HyperLogLog for scalable peer counting
Adds approximate unique peer counting with fixed ~1KB memory usage.
Can count millions of peers with ~2% accuracy. Separates counting
(unlimited) from storage (capped at MAX_PEERS for verification).
2026-01-02 14:28:25 -05:00
Kilian Tyler 895281e54d perf(gossip): add bloom filter for message deduplication
Prevents re-relaying messages we've already forwarded. Uses a
time-bucketed dual bloom filter that rotates every 30 seconds
to prevent fill-up while maintaining deduplication.
2026-01-02 14:26:46 -05:00
Kilian Tyler 86dff90364 perf(gossip): add fanout-limited relay to reduce bandwidth
Instead of relaying messages to ALL connections, relay to max 3
random peers. This reduces O(N) per-hop to O(1) while maintaining
epidemic spread through the network.
2026-01-02 14:25:59 -05:00
lklynet 2bd144ba07 perf(peers): optimize message handling and peer management
- Add MAX_PEERS limit to prevent memory exhaustion
- Check message sequence early to drop duplicates before expensive verify
- Simplify peer update logic by removing redundant checks
2026-01-02 13:12:05 -05:00
lklynet 0d589872cd perf(peer-handling): optimize peer verification and cleanup intervals
- Cache peer public keys to avoid repeated key creation
- Increase peer cleanup interval from 2.5s to 15s to reduce overhead
- Adjust cleanup check interval from 500ms to 5s
2026-01-02 12:49:38 -05:00
LKLY 9607ff522f Merge pull request #2 from LunyaaDev/perf/dockerfile
perf: reduce docker image size
2026-01-02 12:39:39 -05:00
lklynet 1e16d431d5 perf: throttle updates and limit particles to prevent crashes
Added rate limiting to broadcast updates to once per second and cap visual particles at 500 to prevent browser crashes from excessive rendering. Stop ruining my fun.
2026-01-02 11:40:26 -05:00
LunyaaDev fa3e8cc8b4 add docker compose 2026-01-02 17:38:54 +01:00
LunyaaDev 11d640c9a1 reduce docker image size 2026-01-02 17:34:04 +01:00
lklynet 81864969da feat(security): add PoW and Ed25519 signatures to prevent Sybil attacks 2026-01-02 11:05:44 -05:00
lklynet 149298016e some flair and pizzazz 2026-01-02 09:52:00 -05:00
lklynet c6d4a3e8f1 my god hes done it 2026-01-01 23:31:21 -05:00
lklynet 0dc2c6efb2 refactor: replace uuidv4 with crypto.randomUUID for id generation 2026-01-01 23:27:07 -05:00
lklynet d25e8e793b build(docker): update base image and improve build process
- Switch to node:18-bookworm for better stability
- Add required build tools (python3, make, g++)
- Use npm ci for more reliable production installs
- Update package.json metadata and dependencies
2026-01-01 23:24:13 -05:00
lklynet 6ca4c9e21a build: simplify Dockerfile by removing unnecessary dependencies
Remove python3, make, and g++ as they are no longer needed for building native modules. Also switch to a lighter base image by removing the '-bullseye-slim' tag since the full node:18 image is sufficient.
2026-01-01 23:18:48 -05:00
lklynet 7db91bb594 build(docker): optimize docker image size and build process
Use slim base image and install build dependencies only when needed
Rebuild native modules during install for production compatibility
2026-01-01 23:16:42 -05:00
lklynet 0f2fddab6d ai's dumb ass couldnt figure it out either lmao 2026-01-01 23:12:42 -05:00
lklynet 7d2278b5de just letting ai do it... may god have mercy 2026-01-01 23:09:23 -05:00
lklynet 952433ba6d trying every version of debian til one works 2026-01-01 23:06:25 -05:00
lklynet 28264086c0 angry sad 2026-01-01 23:04:02 -05:00
lklynet 8f7bf8fa9b MAXIMUM COMPATIBILITY 2026-01-01 22:58:25 -05:00
lklynet 739ef36f73 how tf does docker even work 2026-01-01 22:51:35 -05:00
lklynet 4578250692 im so dumb 2026-01-01 22:48:00 -05:00
lklynet d5f517658f Screaming into the void 2026-01-01 22:40:32 -05:00