Repository navigation
refactor(protocols): run req/resp over the seam types of libp2p/core - #81
Conversation
W5.2 merged, so req/resp stops taking its seam types from Protocols.Mock.Core. Payload, Limiter, Exchange, and reqRespId name Libp2p.Core. The stream error map moves to a module of its own, StreamError, over the real Core.Error. Identify and ping still type over the core mock, and their swap is issue etheorem#55, so the mock and its copy of the map stay for them. The muxer and host-stream test values now fill the real MuxSession, Muxer, and StreamHandler seams. They go once the W5.4 values and the host type over libp2p/core (issues etheorem#77 and etheorem#70). Part of etheorem#78
…anded The muxer values of libp2p/mux took the real core seams in PR etheorem#84 while this branch ran, so the sentences that wait on issue etheorem#77 are stale. The module docstring and the package docs now say the swap is due (issue etheorem#78), and the integration note drops the met condition.
27a69bc to
f0d269e
Compare
|
Reviewed at The muxer-mock finding applies. The branch started while issue #77 was open, and it retypes The stale prose is fixed in The core-mock swap itself is done and honest. Req/resp takes no type from The new The two retyped mocks state their waits. Gates at
Axiom audit. What remains of the three mocks. I pushed APPROVE |
Summary
PR #46 merged with three own mocks. This PR moves req/resp off the first one,
Protocols.Mock.Core, now that W5.2 merged in #64. It retypes the other two, the muxer and host-stream test values, onto the real core seams. Neither can go yet: the W5.4 muxer values still type overMux.Mock.Core(issue #77), and the host still upgrades through its negotiate mock (#70, PR #80). Part of #78.What changed
libp2p/protocols:ReqResp/Payload.lean:Error.openFailedcarries aLibp2p.Core.Error, andMethod.idis aLibp2p.Core.ProtocolId.ReqResp/Limiter.leankeys its table byLibp2p.Core.ProtocolId.ReqResp/Exchange.lean:OpenStream,mapError, andhandlernameLibp2p.Core. InsideReqRespa bareCoreis the reader core, so the seam types keep the full prefix, and a comment says so.Constants.lean:reqRespIdanswers aLibp2p.Core.ProtocolId. The identify and ping ids stay on the mock for [SEAM] W5.7 identify/ping: the mock connections of #45 #55.StreamError.lean(new) holdsmapStreamErrorover the realCore.Error.Protocols.Mock.Corekeeps its copy for identify and ping; [SEAM] W5.7 identify/ping: the mock connections of #45 #55 deletes it with the module.Mock/Muxer.leandrops its copies ofRole,MuxSession, andMuxer, andmuxeris a value of the real seam.openStreamtakes the protocol id and leaves it unread, as yamux does, andjoinreplacesdone.Mock/HostStream.leantakesProtocolId,StreamContext,StreamHandler, andMuxSessionfromlibp2p/core.StreamErrorrow, and says what each remaining mock waits on. The sentence that the host lists no outbound call is gone: the host namesnewStream.Tests:
Tests/ReqResp.leanimportsMock.Muxerdirectly, sinceMock.HostStreamno longer imports it.Test plan
lake build --wfailis green (257 jobs).lake testpasses: 27169 passed, 0 failed, 10 skipped. It passes again withLEAN_NUM_THREADS=1.Risk / trust footprint
None added or removed.
#print axiomsover the req/resp theorems showspropext,Classical.choice, andQuot.soundat most:Notes for reviewers
Protocols.Mock.Corerow for PR feat(protocols): W6.3, the req/resp framework over the snappy framing format #46 on [TRACKING] Machine-Checked Devcon Week: the task tree #25 is done for req/resp. The module stays for the PR feat(protocols): W5.7, identify and ping #45 row ([SEAM] W5.7 identify/ping: the mock connections of #45 #55).StreamError.LICENSE (LGPL version 3)