Repository navigation
refactor(negotiate): run the upgrader over the seam types of libp2p/core - #82
Conversation
W5.2 merged, so the package drops Negotiate.Mock.Core and takes ProtocolId, Role, Error, SecureConn, SecurityProtocol, MuxSession, and Muxer from Libp2p.Core. Two seam rules of the real core change the upgrader. The secure read delivers the bytes the handshake over-read, so the muxer negotiation starts with no seed; SecureConn.leftover only records them. The upgrader owns the SecureConn and must join it. The answered session's join now waits for the session loop, then for the secure connection. Every failure after the handshake closes and joins the secure connection, and a session that opens as the deadline fires is closed and joined before the call answers. The suite's plaintext security value delivers its over-read bytes through its read, as the real seam does, and the pipeline checks join both sessions. Closes etheorem#53
88bea89 to
8f395b3
Compare
|
Re-review of the seam swap at The base moved; the rebase was clean. The tip gained PR #79 (the security seam swap) after the push, so I rebased the branch onto The overage, on record. The core mock window closed at 19:21:56 UTC on 7 Nov (PR #64 merged at 07:21:56 UTC). The swap commit landed at 08:41:42 UTC on 8 Nov, about 13 hours late. The swap is complete, so per the organiser ruling this stays an approval, with the overage recorded here. Issue #53 is done. Semantic change 1: the muxer negotiation reads the over-read bytes through Semantic change 2: the upgrader owns the
One observation, for the record: Strictness. No Axiom audit. I ran Gates at
The body says 162 modules for the lint. That number belongs to the pre-rebase base; PR #79 dropped a module, and the rebased head measures 161. The body's note about the intermittent hang matches #83, which is unrelated to this PR and open. Ledger. The row for PR #40 on issue #25 can be struck when this merges, as the body asks. Issue #53 closes with this head. APPROVE |
Summary
PR #40 merged with
Negotiate.Mock.Core, a copy of the W5.2 surface. W5.2 merged in #64, so the negotiate package takes its seam types fromlibp2p/coreand the mock goes. Two rules of the real seam change the upgrader, and this PR applies them: the muxer negotiation reads the handshake's over-read bytes through the secureread, and the upgrader joins theSecureConnit owns. Closes #53.What changed
libp2p/negotiate:Constants.lean,Message.lean, andStep.leannameCore.ProtocolIdandCore.Rolefromlibp2p/core.Upgrade.leanimportsLibp2p.Coreand takes the realSecurityProtocol,SecureConn,Muxer, andMuxSession:sc.toConnectionwith an empty seed. The realSecureConndelivers the bytes its handshake over-read throughread, and the core pair says no stage abovereadtakesSecureConn.leftover("The leftover hand-over"). For Noise those bytes are ciphertext.SecureConn(core contract 4). The frozen answer stays(MuxSession × PeerId); the answered session'sjoinwaits for the session loop, then for the secure connection (ownSecure). The secure connection is joined even when the session's join throws.Muxer.open) closes the secure connection and joins it (discardSecure).releaseLatecloses it and gives its join to a task set thatupgradeWithjoins before it answers.Mock/Core.leanis deleted. The root module doc andConstants.leanlose their mock sentences.Tests:
Tests/Upgrade.lean: the two plaintext security values build theirSecureConnthroughsecureOf, whosereaddelivers the over-read bytes first, as the real seam does. The test muxer'sopenStreamtakes the id. The full and split pipeline checks join both sessions and check that the joins answer.ok(two new checks).Tests/Negotiate.leannamesLibp2p.Core.ProtocolId.Test plan
lake build --wfailis green, with no warning.lake testpasses: 27171 passed, 0 failed, 10 skipped. It passes again withLEAN_NUM_THREADS=1.LEANP2P_TRACEpassed.Risk / trust footprint
None added or removed.
#print axiomsover the 44 package theorems andupgradeshowspropext,Classical.choice, andQuot.soundat most.Notes for reviewers
hackathon26as well. The fix is test(yamux): wait for the pong deadline before the clock moves #83.Negotiate.upgrade.LICENSE (LGPL version 3)