Skip to content

feat(net-svc): first build of net-svc#31

Merged
Zk2u merged 3 commits intomainfrom
feat/net-svc-skeleton
Jan 22, 2026
Merged

feat(net-svc): first build of net-svc#31
Zk2u merged 3 commits intomainfrom
feat/net-svc-skeleton

Conversation

@Zk2u
Copy link
Copy Markdown
Collaborator

@Zk2u Zk2u commented Jan 22, 2026

Description

Implements scaffolding and most of the implementation for the NetService. It's mostly broken into two halves:

  1. Generic byte streams, connection management, easier public key stuff hotwired into the TLS certs etc.
  2. Fully typed API that wraps the above API with our mosaic specific wire protocol

QUIC uses TLS which is kinda ugly around our usecases, so this uses a custom cert verifier and uses ed25519 TLS keys. This means we only have to keep 32 byte public keys for each peer's identity, rather than full PEM certs and whatever that are manky.

Mosaic has a isolated thread that runs the net-svc. This uses a single threaded tokio runtime that doesn't leak on the public API. net-svc exposes a public low-level API that allows callers from other threads obtain streams with a given PeerId. There are two stream types, protocol streams and bulk transfer streams. They use the same underlying stream system, but bulk transfer streams have a identifier, and the API to receive incoming streams works differently. This is so garbled table transfers can be received in jobs, and incoming protocol messages can be received by the SMScheduler.

net-svc relies on net-wire for the low level wire types.

net-svc is mostly built out in this PR with integration tests et al.

The next PR will build out the typed layer, net-types and net-client, the latter which will be directly used by Jobs and the SMScheduler for comms. net-client adds our application specific protocol into the network layer, for example sending protocol messages with priority 0, protocol msg acks with prio 1, and garbling table transfers with prio -1.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests
  • Dependency update
  • Security fix

Notes to Reviewers

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

Related Issues

@Zk2u Zk2u added this to the Network Service milestone Jan 22, 2026
@Zk2u Zk2u requested review from delbonis and sapinb January 22, 2026 12:53
@Zk2u Zk2u self-assigned this Jan 22, 2026
@Zk2u Zk2u added the enhancement New feature or request label Jan 22, 2026
@Zk2u Zk2u force-pushed the feat/net-svc-skeleton branch 2 times, most recently from 8603990 to 16f2c4c Compare January 22, 2026 17:50
@Zk2u Zk2u force-pushed the feat/net-svc-skeleton branch from 16f2c4c to ea67994 Compare January 22, 2026 17:53
@Zk2u Zk2u merged commit 0870d5d into main Jan 22, 2026
10 checks passed
@AaronFeickert
Copy link
Copy Markdown
Collaborator

We should really be pushing for reviews and not immediate merges.

Comment thread crates/net-types/src/lib.rs
Comment thread crates/jobs/src/lib.rs
Comment thread crates/jobs/src/lib.rs
@AaronFeickert AaronFeickert mentioned this pull request Jan 27, 2026
14 tasks
@Zk2u Zk2u mentioned this pull request Feb 8, 2026
@Zk2u Zk2u modified the milestones: Network Service, Service Production Ready Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants