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

Implement downloading the chain storage #2876

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Oct 14, 2022

cc #165

Adds a mode to the warp_sync where, instead of downloading just the runtime and then the consensus-related information, we download the entire storage of the chain.

To achieve this, the StorageGet requests have been renamed to StorageGetKeys, and a new StorageGetRange request has been added.

Works for Westend. For Polkadot I'm getting UnexpectedEntriesCount errors which I can't manage to solve at the moment.
This needs to be solved, and this PR needs a bit of clean up, before being ready for review/merging. However it is 90% ready.

@tomaka tomaka marked this pull request as draft October 14, 2022 14:07
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 Oct 14, 2022

Another thing to note is that at the moment we use the "no proof" version of the network protocol.
However, as I'm implementing this PR, I've stumbled upon some tricky safety issues that would be solved if we used the "with proof" version of the protocol.
So we might change this before merging.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2022

twiggy diff report

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


 Delta Bytes │ Item
─────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────
       +8809 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h795f7045dc5d1da5
       -8588 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h3d4e690099240d8a
       -5708 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h233d14a70f39b769
       +5708 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h3a74d5eaea3b2301
       +3918 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h9e35c363097b7b55
       +3910 ┊ smoldot_light::sync_service::standalone::Task<TPlat>::inject_network_event::h4037b49ef2b6f64b
       -3910 ┊ smoldot_light::sync_service::standalone::Task<TPlat>::inject_network_event::he38c6bf2e66ec472
       -3734 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h0e11a7d80a855012
       +3556 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h8e360ca87fb9c5fb
       -3556 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hbb7d95b1ee9ed0b6
       +3246 ┊ smoldot_light::sync_service::standalone::Task<TPlat>::start_next_request::h8d92e48e4934f874
       -3227 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h50f061f0ad7e5727
       +3227 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h88262e23ee85068d
       +2860 ┊ smoldot::sync::warp_sync::VerifyStorage<TSrc,TRq>::verify::hc5aa519292cb189f
       -2728 ┊ smoldot_light::sync_service::standalone::Task<TPlat>::start_next_request::h973f318cb6c022c7
       -2577 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1057ed3a217c53d9
       +2577 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hcc5840e6931b361e
       +2483 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h0cf618a8e6a8f5c6
       -2483 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h454061b20ee19b01
       +2277 ┊ smoldot::sync::warp_sync::BuildRuntime<TSrc,TRq>::build::h3ec15337145eeabc
      +39576 ┊ ... and 1015 more.
      +84354 ┊ Σ [1035 Total Rows]

@tomaka tomaka added the blocked Can't work on this issue because it is blocked on something out of our control label Oct 20, 2022
@tomaka
Copy link
Contributor Author

tomaka commented Oct 20, 2022

Doesn't work due to the lack of child tries support.

@tomaka
Copy link
Contributor Author

tomaka commented Oct 31, 2022

I'm going to update this PR to use the "proof version" of the request, and afterwards I would like to merge it.
We're going to need state requests in order to properly implement the state_getKeysPaged RPC function without running into situations where the storage response is too large.

@tomaka tomaka removed the blocked Can't work on this issue because it is blocked on something out of our control label Oct 31, 2022
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