README.md raw

Comprehensive Negentropy Sync Test Suite

Tests NIP-77 negentropy synchronization between ORLY and strfry relays.

Test Scenarios

1. strfry as Client, ORLY as Server (Phases 1-6)

Uses strfry sync command to test:

2. ORLY as Client, ORLY as Server (Phases 7-10)

Uses orly sync CLI with a temporary Badger DB as a bridge:

Infrastructure

┌─────────────┐  NIP-77   ┌──────────────┐
│   strfry    │◄─────────►│ orly-relay-1 │
│  (7777)     │           │   (3334)     │
└─────────────┘           └──────┬───────┘
                                 │
                          orly sync CLI
                          (bridge DB in
                           test-runner)
                                 │
                          ┌──────┴───────┐
                          │ orly-relay-2 │
                          │   (3335)     │
                          └──────────────┘

The orly sync CLI runs inside the test-runner container. It opens a temporary Badger database and uses NIP-77 negentropy to sync with each relay, effectively bridging events between the two ORLY instances.

Quick Start

Prerequisites

Run All Tests

cd tests/negentropy

# Build all images
docker compose build

# Start infrastructure
docker compose up -d

# Run comprehensive tests
./comprehensive-test.sh

# Or with verbose output
./comprehensive-test.sh --verbose

# Clean up
docker compose down -v

Manual Operations

# Generate events
docker compose exec -T test-runner event-generator -count 500 -relay ws://strfry:7777

# strfry sync (strfry as client, ORLY as server)
docker compose exec -T strfry /app/strfry --config=/etc/strfry.conf sync ws://orly-relay-1:3334 --dir down

# orly sync (orly CLI as client, any relay as server)
docker compose exec -T test-runner orly sync ws://orly-relay-1:3334 --data-dir /tmp/sync-db

# Manual event inspection
echo '["REQ", "test", {"limit": 10}]' | websocat ws://localhost:7777
echo '["REQ", "test", {"limit": 10}]' | websocat ws://localhost:3334
echo '["REQ", "test", {"limit": 10}]' | websocat ws://localhost:3335

Test Parameters

Event Distribution

KindPercentageDescription
160%Short text notes
015%Metadata
310%Contacts
19845%Reports
100005%Mute lists
100013%Pin lists
300232%Long-form articles

Troubleshooting

Check service health

docker compose ps
docker compose logs -f strfry
docker compose logs -f orly-relay-1
docker compose logs -f orly-relay-2

Reset test data

docker compose down -v
docker compose up -d

Architecture Details

Strfry

ORLY Relay

Test Runner