Skip to content

test(protocols): run the req/resp sim checks between two real hosts - #87

Open
IvanAnishchuk wants to merge 5 commits into
etheorem:hackathon26from
IvanAnishchuk:seam-reqresp-mocks
Open

IvanAnishchuk wants to merge 5 commits into
etheorem:hackathon26from
IvanAnishchuk:seam-reqresp-mocks

Conversation

@IvanAnishchuk

@IvanAnishchuk IvanAnishchuk commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The req/resp sim checks now run between two real hosts, on the fixed-key Noise value, yamux, and a test clock. This PR deletes Protocols.Mock.Muxer and Protocols.Mock.HostStream, the two mocks #78 still owes. Closes #78.

This PR stacks on #86, which puts the host on the real negotiate. Until #86 merges, the diff also shows its two commits. Review the three commits after them:

  • test(protocols): run the req/resp sim checks between two real hosts, the swap.
  • docs(protocols): …, which drops the req/resp sentence that said the host still upgrades through a negotiate mock.
  • test(protocols): run the host pair on the fixed-key Noise value and a test clock, which puts Tests/HostPair.lean on the test values of root §3.1.

What changed

Tests:

  • Tests/HostPair.lean (new): two hosts over a new sim net, on the test values of root §3.1. Each host takes Noise.fixedKeyProtocol with an Ed25519 identity from one byte, and its ephemeral keys from an Rng seeded from that byte. Both hosts run on one TestClock, which Pair.close closes. The muxer is Mux.yamux. The server listens on /memory/4100, and the client holds a session to it.
  • Tests/ReqResp.lean: the sim section takes the pair. openStreamOf maps the host's newStream onto the OpenStream of requestPeer. A host failure that wraps a seam error reaches the requester as that error.
  • An id the peer does not serve now fails the open (openFailed). The mock reset the stream. The real host runs multistream-select, which answers na, so the stream never opens for that id.

libp2p/protocols:

  • Mock/Muxer.lean and Mock/HostStream.lean are deleted.
  • The package ARCHITECTURE drops the mock row and describes the two-host suite. The PLAN milestone lists the four sim checks with the new na answer.

Test plan

  • lake build --wfail on Libp2pProtocols, Tests.HostPair, and Tests.ReqResp is green.
  • lake test passes: 27824 passed, 0 failed, 4 skipped. It passes again with LEAN_NUM_THREADS=1.
  • Stress: the test binary passes 8 of 8 runs at 4 workers, each under a 600 s timeout.
  • The import-rule lint is green: 186 modules, 0 violations.
  • A new codec or framing layer comes with its round-trip theorem or property test, and with a test for its length cap. (n/a: no new codec)
  • If this touches wire behavior: the captured vectors still pass, and the description names the spec section the change follows. (n/a: test-only change)
  • If this touches the go interop path: the interop matrix (PLAN W5.9) is green. (n/a)

Risk / trust footprint

None added or removed. The deleted Mock/HostStream.lean held two partial def loops (readHeader, serveLoop). They go with it.

Notes for reviewers

LICENSE (LGPL version 3)

  • I have read and accepted LICENSE (LGPL version 3), NOTICE and CLA in the root of this project.

…tiate

The host builds its upgrade from the public stages of libp2p/negotiate.
The secured checkpoint sits between the handshake and the muxer stage,
where the core seam puts it. Stream selection is a host shell over the
pure negotiate core. This commit deletes the Negotiate.Legacy copy, and
the unit 1b host legs now run.

Part of etheorem#70.
Root ARCHITECTURE §3.1 says every suite above the transport runs on the
test values, and the Noise test value has fixed keys. The host legs used
Noise.securityProtocol, whose ephemeral keys come from Rng.system. Each
suite host now takes Noise.fixedKeyProtocol, seeded from its identity
byte. The host PLAN offered the production value as an option, and now
names the test value only.

Part of etheorem#70.
The sim checks of the req/resp suite now run between two hosts with
Noise and yamux. Tests/HostPair.lean builds the pair. The requester
opens its stream through the host's newStream. This commit deletes
Protocols.Mock.Muxer and Protocols.Mock.HostStream.

An id the peer does not serve now fails the open. Multistream-select
answers na, so the stream never opens for that id.

Part of etheorem#78.
The req/resp section said the host still upgrades through a mock of
libp2p/negotiate, so the suite ran against a mock of the stream call.
etheorem#86 puts the host on the real negotiate, and this branch runs the suite
between two real hosts, so the sentence goes.

Part of etheorem#78.
… test clock

Root ARCHITECTURE §3.1 says every suite above the transport runs on the
test values. Tests/HostPair.lean built its hosts with
Noise.securityProtocol and the system clock. Each host now takes
Noise.fixedKeyProtocol, seeded from its identity byte, and both hosts
run on one TestClock that Pair.close closes.

Part of etheorem#78.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SEAM] W6.3 req/resp: drop the three mocks after PR #46

1 participant