This commit is contained in:
Raven Scott
2026-05-20 17:13:51 -04:00
parent 3507e4e91a
commit 7f086aa591
190 changed files with 34732 additions and 746 deletions
+27
View File
@@ -89,3 +89,30 @@ consensus.on('consensus', (decided) => {
```
All methods are fully documented and production-tested.
## P2P and runtime options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `topic` | `string` \| `Buffer` | `null` | Hyperswarm discovery topic. Hex (64 chars) or string (hashed via `hypercore-crypto`). P2P is active when set. |
| `keyPair` | `KeyPair` | random | Ed25519 key pair (`hypercore-crypto.keyPair()`). |
### Runtime flags (test exit)
| Option | Modules | Default | Description |
|--------|---------|---------|-------------|
| `enableBackgroundTimers` | oracle, reputation | `false` | Enables periodic cleanup/decay/gossip timers. Keep `false` in unit tests so the process exits. |
| `enableGossip` | causal-consensus | `false` | Enables gossip interval + Protomux proposal fan-out when `topic` is also set. |
### Protomux
Wire format uses **Protomux v3** (`createChannel``addMessage``open`) via [`../_shared/p2p-bare.js`](../_shared/p2p-bare.js).
### Testing
```bash
npm install
npx brittle-bare test/test.js
```
Integration (2-node): [`../../real_tests/integration/`](../../real_tests/integration/) — see [DEVELOPMENT.md](../../DEVELOPMENT.md).
@@ -68,3 +68,9 @@ On restart, the module replays the decided log to restore total order state.
- Peer count, pending proposals
This architecture expands the Bare/Pear ecosystem with the first production-ready BFT causal ordering primitive.
### Diagram legend (P2P)
- **Solid arrows** — implemented Hyperswarm / Protomux paths in `index.js`
- **Dashed arrows** — optional hooks (set `topic`, `enableGossip`, or pass external `hyperbee` / `swarm`)
- **Library-only** — no swarm required for core API (vector-clock, capabilities core)