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

Fix #2591 #2602

Merged
merged 15 commits into from
Aug 9, 2022
Merged

Fix #2591 #2602

merged 15 commits into from
Aug 9, 2022

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Aug 9, 2022

Fix #2591

This PR fixes the internal logic of parachain.rs and, importantly, clarifies it.

The code was doing some very wrong things with the finalized_parahead variable. This variable might be equal to a very old block (typically the genesis block), yet the code would use it as a fallback in various situations.

This would lead to the SyncService reporting that the parent of a recent block was equal to the genesis block (in theory could have been another block than genesis, but in practice the genesis block). As a consequence, the RuntimeService would download the runtime of the genesis block and think that the recent block was using the same, since it is a child and didn't indicate that a runtime upgrade occurred.

#2591 was fixed by adding a simple if block that clears all active subscriptions once a finalized parahead is known, and two other if blocks that prevent notifications from being emitted before the finalized parahead is known. This makes me think that this logic got accidentally removed in a refactoring.

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 Aug 9, 2022

twiggy diff report

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


 Delta Bytes │ Item
─────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
      +13366 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h31e4c97e9521579e
      -13044 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h90130d2061e5f423
        -471 ┊ core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::hf72ecf625d97af24
        -438 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light_base::sync_service::parachain::start_parachain<smoldot_light_wasm::platform::Platform>::{{closure}}>>::h7678abfe060201b0
        +438 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light_base::sync_service::parachain::start_parachain<smoldot_light_wasm::platform::Platform>::{{closure}}>>::h8d686787dff410aa
        +402 ┊ core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::hfa05bfd79530e126
        -392 ┊ itertools::Itertools::join::h0f2b610b81ce4d3c
        +392 ┊ itertools::Itertools::join::heb0697138391f5d0
        +376 ┊ <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h7ef56618e416d103
        -376 ┊ <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::had0db3ab4dd3211b
        -270 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h26f7ee3d152c2785
        +270 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::hc05e7ecabc9fad11
        -259 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h211b9525b15f1bb1
        +259 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h977c5f9964d931f0
        +241 ┊ core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once::h04e45e1c3a206db1
        -241 ┊ core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once::ha94b8192050fe86c
        -240 ┊ <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::hc499c69c11883d14
        +240 ┊ <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::hd0ba7c98651323ec
        +233 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h395dd64765d73847
        -233 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::hc52f39fd79e7a3f5
        +101 ┊ ... and 88 more.
        +756 ┊ Σ [108 Total Rows]

@tomaka tomaka added the automerge Automatically merge pull request as soon as possible label Aug 9, 2022
@mergify mergify bot merged commit 100e08e into paritytech:main Aug 9, 2022
@tomaka tomaka deleted the fix-2591 branch August 9, 2022 09:56
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.

Genesis wasm used for parachains.
1 participant