Repository navigation
refactor(host): run the upgrade and stream selection on the real negotiate - #86
Open
IvanAnishchuk wants to merge 2 commits into
Open
IvanAnishchuk wants to merge 2 commits into
IvanAnishchuk wants to merge 2 commits into
Conversation
…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.
This was referenced Nov 10, 2026
IvanAnishchuk
added a commit
to IvanAnishchuk/leanp2p
that referenced
this pull request
Nov 10, 2026
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.
6 of 8 tasks
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.
IvanAnishchuk
added a commit
to IvanAnishchuk/leanp2p
that referenced
this pull request
Nov 10, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The host now runs on the merged
libp2p/negotiate. It builds its upgrade from the package's public stages. 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. TheNegotiate.Legacycopy from PR #59 is gone, and the unit 1b host legs run. Closes #70.What changed
libp2p/host:Upgrade.lean(new):upgraderunsNegotiate.negotiatefor security, the handshake,checkIdentity, the host's checkpoint,Negotiate.negotiatefor the muxer, andMuxer.open. OnewithinDeadlinecovers the whole upgrade, andsettleUpgrademaps its answer.UpgradedandAdmissionlive here.StreamSelect.lean(new):negotiateStreamruns multistream-select on a muxedStreamoverinitiatorStart,responderStart, anddrive. It hands the bytes after the selection to the handler throughStream.prependBytes(§5.6).Swarm.leandrops theNegotiate.Legacyimport and callsupgrade. A refusal atallowSecuredorsetPeercloses and joins the secure connection before the muxer stage, and answersgated.libp2p/negotiate:Negotiate/Legacy.leanandNegotiate/Legacy/are deleted. Nothing imports them now.Tests:
Tests/Host.leanruns the six unit 1b legs in place of the skips: the pipeline in both directions, the host's own answers, the policy doubles, the silent peer, the shutdown stages, and the leftover hand-over.Noise.fixedKeyProtocolseeded from each host's identity byte, and aTestClock. The host PLAN named the productionNoise.securityProtocolas an option for these legs, and now names the test value only.Test plan
lake build --wfailis green (286 jobs).lake testpasses: 27824 passed, 0 failed, 4 skipped. It passes again withLEAN_NUM_THREADS=1.Risk / trust footprint
None added or removed. The new modules hold no theorem, no
partial def, and no@[extern]. The negotiation loops userepeat, asNegotiate.negotiatedoes. The dedup theorems inDedup.leanare unchanged.Notes for reviewers
Negotiate.upgradeWithtakes no checkpoint, so the host composes the stages itself. The stage order follows the privateNegotiate.upgradeCore. Both module docs say that a change to the order in one needs the same change in the other.Host.Mock.Negotiate(PR feat(host): W5.6, the host with dedup, serving, and shutdown #61) andNegotiate/Legacy/(PR feat(protocols): W6.4, gossipsub v1.1 #59) can be struck when this merges.Mock.MuxerandMock.HostStream), then [SEAM] W5.9 interop: connect Interop.Mock.Stack and land the green matrix run inside #60 #73.LICENSE (LGPL version 3)