Phase 14: Federation Foundation

Goal

Establish types, identity, and addressing for a multi-server world. No cross-server communication yet — this phase creates the foundation that all subsequent federation phases build on.

What Was Added

Federation Types (src/server/federation.rs)

A new module behind the server feature containing all federation types:

Server Integration

Wire Operations (0x14xx)

Code Operation Payload Response
0x1401 federation_info None FederationInfoResult
0x1402 federation_peers None FederationPeersResult

Both operations require no authentication — federation info is publicly visible, consistent with the pattern that identity and server metadata are public.

Codec Entries

Full support in both JSON and binary codecs for federation_info and federation_peers.

Design Decisions

Federation as a Separate Module

All federation types and logic live in src/server/federation.rs. The Server struct has a single federation: FederationState field that encapsulates all state. Small delegation methods on Server keep the integration clean.

Closed Federation First

The default FederationConfig has enabled: false. Phase 14-18 use config-based trusted peers. Phase 19 adds endorsement-based open joining.

Royalty Hooks

RoyaltyEntry and RoyaltyType are defined now as hooks. They are not processed by any business logic yet. Phase 19 will activate them through the BFT governance layer.

FederatedId Derives Hash, Eq, PartialEq

This enables FederatedId to be used as a HashMap key and in HashSets, which will be needed for content indexing and deduplication in Phase 16.

Tests

Unit Tests (13 in federation.rs)

Integration Tests (3 in integration.rs)

Test Counts

What's Next

Phase 15 will add server-to-server transport: the /federation WebSocket endpoint, mutual Ed25519 handshake, and encrypted channel between servers. It will reuse the existing crypto stack (sign_handshake, derive_session_keys, SessionCipher).