You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR refactors the WebRTC code into something that actually works.
The `WebRtcConnection` code is split into `OpeningWebRtcConnection` and
`WebRtcConnection`. The former only deals with the Noise handshake
whereas the latter implements a typical connection event loop, dealing
with inbound/outbound substreams and data exchange. The PR also
implements a new substream type for WebRTC which is implemented using
`tokio::sync::mpsc::{Sender, Receiver}` since `str0m` doesn't expose a
substream type. The `multistream-select` code used by WebRTC is
refactored and its test coverage is increased.
This PR also updates `str0m` to the latest version but during testing it
was discovered that there are issues with `ChannelId`/SCTP stream id
reuse and those have to be reported to upstream and fixed. They're are
not blockers for merging this PR though because the fixes should be
contained to `str0m` and for litep2p it would only be a version bump if
the fixes are accepted.
The WebRTC implementation (with pending fixes to `str0m`) has been
tested with smoldot and the code works. IPFS Ping, Kademlia and Identify
all work, opening and negotiating notification protocols work and block
requests work. There are, however, two issues that I was able to find:
1) The first "notification" smoldot reads from the substream is not
actually a notification but the substream handshake which results in
"protocol-error":
```
[network] protocol-error; peer_id=12D3KooWNGCW63xu9tGh1WxWEazHs6UgMdTjrLSos89NrVSCh9bz, error=BadBlockAnnounce(DecodeBlockAnnounceError(Verify))
[network] protocol-error; peer_id=12D3KooWNGCW63xu9tGh1WxWEazHs6UgMdTjrLSos89NrVSCh9bz, error=BadGrandpaNotification(DecodeGrandpaNotificationError(Verify))
```
It looks like smoldot is still able to receive block announcements and
GRANDPA notifications so I'm not entirely what the issue here is.
2) There is another issues with justifications but I don't see how it
could be related to WebRTC
```
[sync-service-westend2] finality-proof-verify-error; error=FinalityVerify(UnknownTargetBlock { block_number: 19772928, block_hash: [22, 163, 175, 94, 114, 75, 142, 174, 83, 146, 11, 251, 184, 119, 212, 76, 34, 85, 144, 47, 83, 251, 83, 86, 152, 141, 204, 104, 253, 236, 21, 48] }), sender=12D3KooWNGCW63xu9tGh1WxWEazHs6UgMdTjrLSos89NrVSCh9bz
[sync-service-westend2] Error while verifying justification: Justification targets a block (#19772928) that isn't in the chain.
```
This happens on the first try, gossip is closed, then it's opened again
and it's able to start warp sync.
---------
Co-authored-by: Dmitry Markin <[email protected]>
Co-authored-by: Alexandru Vasile <[email protected]>
0 commit comments