abuse reports: signed reports, gossip and sync, a local hide rule, visitor tips

A report is signed by a node operator (device key and certificate) and
gossiped on one global topic. Each node decides whose reports count: the
operator's own report hides a listing on that node, one trusted report of
illegal content hides it, and --hide-after trusted scam reports hide it
(--trust-reporter names others). Hidden listings stay stored and reachable.
Visitors can tip the node's operator off with a proof-of-work request that
hides nothing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 21:18:43 +01:00
co-authored by Claude Sonnet 5.5
parent 253eb6e75c
commit 6d55222ac5
17 changed files with 1854 additions and 13 deletions
+13 -6
View File
@@ -101,6 +101,14 @@ func (tn *tnode) listing(t *testing.T, geohash string) *listing.Listing {
return l
}
// store puts l straight into the node's store, failing the test if it is refused.
func (tn *tnode) store(t *testing.T, l *listing.Listing) {
t.Helper()
if _, err := tn.s.Put(context.Background(), l); err != nil {
t.Fatal(err)
}
}
func connect(t *testing.T, from, to *tnode) {
t.Helper()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
@@ -449,8 +457,8 @@ func TestIncrementalSyncFetchesOnlyTheDifference(t *testing.T) {
var shared []*listing.Listing
for i := 0; i < 5; i++ { // page size is 3: two inventory pages
l := a.listing(t, "u1xjhx")
a.s.Put(ctx, l)
b.s.Put(ctx, l)
a.store(t, l)
b.store(t, l)
shared = append(shared, l)
}
update := &listing.Listing{
@@ -463,8 +471,8 @@ func TestIncrementalSyncFetchesOnlyTheDifference(t *testing.T) {
t.Fatal(err)
}
fresh := a.listing(t, "u1xjhx")
a.s.Put(ctx, update)
a.s.Put(ctx, fresh)
a.store(t, update)
a.store(t, fresh)
connect(t, b, a)
eventually(t, "b has the update and the new listing", func() bool {
@@ -484,9 +492,8 @@ func TestIncrementalSyncFetchesOnlyTheDifference(t *testing.T) {
func TestSyncWithANodeThatKnowsNoDigests(t *testing.T) {
a := startNode(t, nil, "u1x")
a.oldSync = true
ctx := context.Background()
for i := 0; i < 4; i++ {
a.s.Put(ctx, a.listing(t, "u1xjhx"))
a.store(t, a.listing(t, "u1xjhx"))
}
b := startNode(t, nil, "u1x")
connect(t, b, a)