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

Do not panic when passed an invalid bootnode address #2207

Merged
merged 7 commits into from
Apr 6, 2022

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Apr 5, 2022

Close #2204

We no longer panic when the chain spec contains an invalid bootnode address.

As I've commented in the code, it is not possible to be sure that a bootnode address is actually invalid. We can only be sure that smoldot cannot parse it, but that's not the same as saying that it's invalid.
For this reason, invalid bootnode addresses are simply ignored in the light client.

Copy link
Contributor

@mergify mergify bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatically approving tomaka's pull requests. This auto-approval will be removed once more maintainers are active.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 5, 2022

twiggy diff report

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


 Delta Bytes │ Item
─────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       -2271 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h4db768a317f75bd7
       +2271 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hf15ccf8a70d20b90
       +1391 ┊ alloc::str::join_generic_copy::h2b60db0ca0225613
        -964 ┊ <smoldot::chain_spec::FromGenesisStorageError as core::fmt::Display>::fmt::h3d8fdea000660d7c
        +964 ┊ <smoldot::chain_spec::FromGenesisStorageError as core::fmt::Display>::fmt::h88bbc34ef75f7114
        +711 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1b4cd9f06cb36df2
        -711 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h733c3b8651cfb4ca
        +515 ┊ core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once::h4e9404b7c02c8ce1
        -417 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h0021740f386b88d3
        +417 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h2621b010151d6ae0
        +404 ┊ smoldot_light_base::Client<TChain,TPlat>::add_chain::hf0c4531441a14584
        +392 ┊ core::ptr::drop_in_place<futures_util::future::future::remote_handle::Remote<core::future::from_generator::GenFuture<smoldot_light_base::Client<alloc::vec::Vec<futures_util::abortable::AbortHandle>,smoldot_light_wasm::platform::Platform>::add_chain<alloc::vec::into_iter::IntoIter<smoldot_light_base::ChainId>>::{{closure}}>>>::h3f9bf02353884686
        -392 ┊ core::ptr::drop_in_place<futures_util::future::future::remote_handle::Remote<core::future::from_generator::GenFuture<smoldot_light_base::Client<alloc::vec::Vec<futures_util::abortable::AbortHandle>,smoldot_light_wasm::platform::Platform>::add_chain<alloc::vec::into_iter::IntoIter<smoldot_light_base::ChainId>>::{{closure}}>>>::h4f3fe95ebde6ccd7
        +357 ┊ <futures_util::future::future::remote_handle::Remote<Fut> as core::future::future::Future>::poll::h2b96185b8a472863
        -357 ┊ <futures_util::future::future::remote_handle::Remote<Fut> as core::future::future::Future>::poll::h45ab72d6f0ea9c0d
        -302 ┊ <smoldot::libp2p::multiaddr::ParseError as core::fmt::Debug>::fmt::h29b691bf50afa559
        -259 ┊ <futures_util::future::future::catch_unwind::CatchUnwind<Fut> as core::future::future::Future>::poll::h8d914696536f9f3a
        +259 ┊ <futures_util::future::future::catch_unwind::CatchUnwind<Fut> as core::future::future::Future>::poll::hfac1c1a68fdf162e
        -143 ┊ futures_util::future::future::remote_handle::remote_handle::h020c0b31b1eeeaec
        +143 ┊ futures_util::future::future::remote_handle::remote_handle::h05a9bbed0b10ee10
        +854 ┊ ... and 49 more.
       +3961 ┊ Σ [69 Total Rows]

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if let Ok(multiaddr) = multiaddr.parse::<multiaddr::Multiaddr>() {
let peer_id = peer_id::PeerId::from_bytes(peer_id).unwrap();
valid_list.push((peer_id, vec![multiaddr]));
continue;
Copy link
Contributor

@melekes melekes Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need continue here?

@tomaka tomaka added the automerge Automatically merge pull request as soon as possible label Apr 6, 2022
@mergify mergify bot merged commit 09bd054 into paritytech:main Apr 6, 2022
@tomaka tomaka deleted the bootnodes-proper branch April 6, 2022 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge pull request as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panicked at 'called Result::unwrap() on an Err value: InvalidPort'
2 participants