diff --git a/SPECS.md b/SPECS.md index ec5be96..d61160b 100644 --- a/SPECS.md +++ b/SPECS.md @@ -6,7 +6,7 @@ the rules the owner has set. The protocol itself is in how to run a node is in [README.md](README.md); the Kubernetes setup is in [k8s/README.md](k8s/README.md). This file does not repeat them. -Status as of 2026-11-18. Check `git log` before trusting any "not built yet" +Status as of 2026-11-19. Check `git log` before trusting any "not built yet" below. ## The idea @@ -74,7 +74,10 @@ in the middle. its last 30 days (same device key; the node never stores the phrase). `init --no-phrase` creates an identity that cannot be renewed (used for the bootstrap node). -- **Listings.** Canonical JSON (RFC 8785), ed25519 signatures, proof-of-work, +- **Listings.** Canonical JSON (RFC 8785), ed25519 signatures, proof-of-work + (24 leading zero bits since 2026-11-19, was 16; `pow.Mine` hashes the bytes + before the nonce once and finds the same nonce as trying them in order, about + 4 s a listing on 8 cores; it deters casual bulk posting, not GPUs), geohash location, `seq`-based versions (higher wins), tombstones for deletion, at most 30 days to live (the owner renews by hand, so abandoned listings lapse). @@ -112,8 +115,11 @@ in the middle. | Place names for `--region` (GeoNames, CC BY 4.0) | done | | Expiry reminder in the terminal (≤5 days left) | done | | Device certificate renewal from the browser with the phrase (last 30 days; same device key, listings re-signed) | done | +| Fast proof-of-work miner (`internal/pow/mine.go`), default difficulty 24 for listings, reports and revocations | done; **network-wide change**: nodes still at 16 and nodes at 24 exchange no listings | +| Abuse limits: per-peer gossip rate and ban (`internal/p2p/guard.go`), sync stream limits, 100 listings per author, 16 inbound connections per public IP, 600 API requests a minute per client, trusted proxies for `X-Forwarded-For` | done, tested, simulated | | Packaging: Dockerfile, Nix flake and module, `make image` | done | -| Kubernetes bootstrap node (`k8s/`, kustomize, Traefik IngressRoute) | written and **deployed by the owner**; running image is older than digest sync, anti-entropy, reports | +| Kubernetes bootstrap node (`k8s/`, kustomize, Traefik IngressRoute; `DIFFICULTY`, `REGION`, `TRUSTED_PROXY` in `config.env`) | written and **deployed by the owner**. The manifest now pins image `f784553` (digest in `kustomization.yaml`, pushed 2026-11-19), which has everything above; whether it is applied is the owner's to say, and the previously running image is older than digest sync, anti-entropy and reports | +| Load tool `cmd/allmende-load` (signed invented listings into a data directory, mining-time measurement) and `scripts/fake-listings.mjs` | done; the 100,000-listing capacity test was started and **not finished** | | Network simulator `cmd/allmende-sim`: 100-300 real nodes, latency, connection loss, attackers, seeds down, repair (results in docs/PROTOCOL.md) | done | | Tests: Go (`-race`), web (`node:test` + jsdom), end-to-end with real binaries (`make e2e`) | all passing | @@ -147,13 +153,22 @@ starting a design-heavy item; see "Working with the owner". - **Check a public node's memory under load.** `--public` nodes now accept 1000 inbound connections (`--max-conns`); nobody has measured a node holding that many against the 512 MiB pod limit. -- **Peer scoring beyond the guard.** `internal/p2p/guard.go` drops a peer - relaying over 1200 messages a minute and bans one that sends 20 invalid ones - for an hour, limits sync streams (4 at once, 1500 a minute), keeps at most - 100 listings per author (`--max-per-author`) and 16 inbound connections per - public IP (`--max-conns-per-ip`), and 600 API requests a minute per client - address (`--requests-per-minute`, `--trusted-proxy`). Not covered: attackers - with many addresses, sharing bans between nodes (deliberately). +- **Finish the capacity test.** Fill a node with 100,000 listings + (`allmende-load -count`, difficulty 8 locally) and see how a bootstrap node + syncs and serves them. Known limits to fix first: `maxSyncPages` 200 × page + 500 caps one sync at 100,000, `syncTimeout` is 2 minutes, `ListingDigest` + scans every row of a region per call, SQLite uses one connection, about + 4.6 KB a listing. The 100-per-author quota also means 100,000 listings need + 1,000 authors. +- **What the abuse limits do not cover** (`internal/p2p/guard.go`, `ipgate.go`, + `internal/api/ratelimit.go`): attackers with many real addresses, valid but + unwanted records under the limits, and bans are per node and not shared + (deliberate: a shared ban could be used against honest nodes). Signed + blocklists (see vouching above) are the next layer. +- **Rate limits depend on the deployment**: the per-IP connection limit needs + real source addresses (`externalTrafficPolicy: Local`; the nodeport overlay + uses `Cluster` and hides them), and the API limit needs `TRUSTED_PROXY` to + cover the ingress or the whole site shares one allowance. - **Joining without the seeds.** A newcomer whose remembered peers are all in another region cannot find its region when no DHT server is up (sim: 0 of 114 listings). Remember region peers separately, or ask connected peers. @@ -231,10 +246,11 @@ make image # build and push the container image (clean tree only) | `internal/message` | encrypted envelopes, plaintext rules, sealing (mirrored in `web/src/message.ts`, checked against a golden fixture) | | `internal/report` | the signed abuse report | | `internal/store` | SQLite: listings, messages, inbox, reports, tips; conflict rules; hide rule | -| `internal/p2p` | libp2p node, topics, validators, sync, discovery | +| `internal/p2p` | libp2p node, topics, validators, sync, discovery; `guard.go` (per-peer limits and bans), `ipgate.go` (connections per IP) | | `internal/inbox` | the owner's conversations, replies, block | -| `internal/api` | HTTP API (public reads, relay, admin) | -| `internal/places`, `internal/jcs`, `internal/pow` | place names, canonical JSON, hashcash | +| `internal/api` | HTTP API (public reads, relay, admin); `ratelimit.go` (per-client limit, trusted proxies) | +| `internal/places`, `internal/jcs`, `internal/pow` | place names, canonical JSON, hashcash (`pow.Mine`, the fast miner) | +| `cmd/allmende-sim`, `cmd/allmende-load` | network simulator; load and mining-time tool | | `web/` | TypeScript UI (embedded), tests, build; `web/static/places.tsv` is generated | | `k8s/`, `nix/`, `Dockerfile` | deployment | | `scripts/e2e.sh`, `scripts/e2e/` | end-to-end with real binaries and jsdom |