Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Considerably clean up the Yamux implementation #383

Merged
merged 75 commits into from
Apr 5, 2023

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Mar 31, 2023

This PR does a clean-up pass on the Yamux implementation, fixing many issues.

Can be reviewed commit by commit.

A ton of tests have been added, caches have been added (that should lead to better performances if there are a lot of substreams), and a couple of bugs fixed.

@github-actions
Copy link

github-actions bot commented Mar 31, 2023

twiggy diff report

Difference in .wasm size before and after this pull request.


 Delta Bytes │ Item
─────────────┼────────────────────────────────────────────────────────────────────────────────────────────────
       +3389 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::incoming_data::hbec2442590fd1b5e
       -3097 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::incoming_data::he1af0535c3421d38
       -2483 ┊ smoldot::libp2p::connection::yamux::ExtractOut<T>::extract_next::h63813046158f7ee2
       +2133 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::extract_next::h465027d23d97872e
        +979 ┊ hashbrown::raw::RawTable<T,A>::reserve_rehash::h2e6f1c7a8087b60c
        +664 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::new::h96318b718c0cf79b
        +564 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::reset::h1f65e245fde4ea1a
        -531 ┊ alloc::collections::vec_deque::VecDeque<T,A>::wrap_copy::hae8d5fcf55547b7b
        +501 ┊ <alloc::collections::vec_deque::VecDeque<T,A> as core::cmp::PartialEq>::eq::h1dd1dea36f48f671
        -486 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::open_substream::ha10e044a578140cd
        -454 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::accept_pending_substream::h28d9e37b6ac6e60c
        -409 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::queue_data_frame_header::h267b1d76a0f7d24e
        -401 ┊ smoldot::libp2p::connection::yamux::SubstreamMut<T>::reset::h8c6466aca3888c37
        -391 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::new::h06e250ba221135ec
        -378 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::queue_window_size_frame_header::h67391e1fa5ea560f
        -375 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::reject_pending_substream::hc0d0ca02e0a76273
        +327 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::accept_pending_substream::h74493668e5525915
        +323 ┊ smoldot::libp2p::connection::yamux::header::encode::h16cbec4dab922805
        +305 ┊ smoldot::libp2p::connection::yamux::write_queue::WriteQueue::extract_some::hb165d0945e5add14
        -297 ┊ smoldot::libp2p::connection::yamux::Yamux<T>::queue_ping_request_header::hb9f2001c8b8d4f21
       +1807 ┊ ... and 154 more.
       +4917 ┊ Σ [174 Total Rows]

@tomaka tomaka marked this pull request as ready for review April 5, 2023 12:31
@tomaka
Copy link
Contributor Author

tomaka commented Apr 5, 2023

This big pull request is now ready. I've finished cleaning everything, and I believe that the code is now production-grade.

@tomaka
Copy link
Contributor Author

tomaka commented Apr 5, 2023

Nothing wrong has been detected after one hour of fuzzing.

@tomaka tomaka added this pull request to the merge queue Apr 5, 2023
Merged via the queue into smol-dot:main with commit 0191700 Apr 5, 2023
@tomaka tomaka deleted the yamux-cleanups branch April 5, 2023 18:54
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.

1 participant