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

Only use database if it's more recent than checkpoint #2401

Merged
merged 3 commits into from
Jun 19, 2022

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Jun 17, 2022

At a chain initialization, we provide a chain spec and, generally, an existing database. The chain spec can contain a checkpoint where we start syncing from.

Before this PR, the database always took precedence. This means that if database contains block 10 but the chain spec contains block 50000, we'll start syncing at block 10.
After this PR, the database is ignored if its block is below the checkpoint's.

This is especially important in situations where some sudo operation happened on a chain which breaks the warp syncing, like it happened on Rococo a week ago. Basically, smoldot is incapable of syncing over the blocks that force-change the list of validators. Before this PR, even if we ship a more recent checkpoint to bypass this issue, users would still use their database and be stuck at the block in question.

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.

@tomaka
Copy link
Contributor Author

tomaka commented Jun 17, 2022

Basically, smoldot is incapable of syncing over the blocks that force-change the list of validators.

This is tracked by #515

@github-actions
Copy link
Contributor

github-actions bot commented Jun 17, 2022

twiggy diff report

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


 Delta Bytes │ Item
─────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       +2136 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h2495e8785881c9f4
       -2136 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h41e6b32b76d7531b
        -711 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h222f8a7e07acb2d1
        +711 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h85a570f32dd9bb7e
        +417 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hafcd3a090a5b2c7d
        -417 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hcecd1d80dd6ad043
        +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}}>>>::h2bdd568a921b4e9f
        -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}}>>>::h36cc13704380f279
        -357 ┊ <futures_util::future::future::remote_handle::Remote<Fut> as core::future::future::Future>::poll::h3c31d804d76e8362
        +357 ┊ <futures_util::future::future::remote_handle::Remote<Fut> as core::future::future::Future>::poll::hc9ff43df8216928d
        +256 ┊ <futures_util::future::future::catch_unwind::CatchUnwind<Fut> as core::future::future::Future>::poll::h9c340f0acaffded4
        -256 ┊ <futures_util::future::future::catch_unwind::CatchUnwind<Fut> as core::future::future::Future>::poll::hdc9863dbfab82c7b
        -247 ┊ itertools::Itertools::exactly_one::hec6ca64459d20c3d
        +247 ┊ itertools::Itertools::exactly_one::hff087ac4881b6d5b
        +157 ┊ smoldot_light_base::Client<TChain,TPlat>::add_chain::hf77781e52e632e9b
        +147 ┊ <itertools::exactly_one_err::ExactlyOneError<I> as core::iter::traits::iterator::Iterator>::next::h2206f6f53339e0b7
        -147 ┊ <itertools::exactly_one_err::ExactlyOneError<I> as core::iter::traits::iterator::Iterator>::next::hb50088e4aaf5b15c
        +143 ┊ futures_util::future::future::remote_handle::remote_handle::h3e14db2be99815ef
        -143 ┊ futures_util::future::future::remote_handle::remote_handle::hf3183ed735b5c02a
        +139 ┊ core::ptr::drop_in_place<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}}>>::he7ddaf42ee3af467
        -114 ┊ ... and 34 more.
        +406 ┊ Σ [54 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.

👍

@tomaka tomaka added the automerge Automatically merge pull request as soon as possible label Jun 19, 2022
@mergify mergify bot merged commit aa7a378 into paritytech:main Jun 19, 2022
@tomaka tomaka deleted the proper-db-load branch June 19, 2022 07:48
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.

2 participants