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

Rewrite state_get_runtime_version to use shared code #2736

Merged
merged 4 commits into from
Sep 13, 2022

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Sep 12, 2022

Fix #2468

This PR does two things:

  • Split runtime_call in half, where the first half is now a separate function named runtime_lock.
  • Make state_get_runtime_version use this new runtime_lock function.

This is better so that we don't repeat a lot of code, and also fixes a few potential panics.

@tomaka tomaka changed the title Rewrite state_get_runtime_version to use shared code Rewrite state_get_runtime_version to use shared code Sep 12, 2022
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 Sep 12, 2022

twiggy diff report

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


 Delta Bytes │ Item
─────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       -5110 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h0a26321ed3bd9c6c
       -5009 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h504842225f8dd7ee
       -4917 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h96dbf9cd60b36af4
       -4890 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1ca161858220a198
       -3501 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h9ff0302d0f8ae7b3
       +3080 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h480278b43bde0b18
       +2080 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h00c77f18a054db09
       +1974 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h2bcc8d472d697bcc
       +1880 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hc25b220c861fbb10
       +1857 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hf1bf7c9322d7b37f
       +1486 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h4156a667574c65d7
        -337 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::json_rpc_service::Background<smoldot_light_wasm::platform::Platform>::runtime_call<alloc::vec::Vec<u8>,core::iter::sources::once::Once<alloc::vec::Vec<u8>>>::{{closure}}>>::h15d08a2e591c39f8
        -309 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::json_rpc_service::Background<smoldot_light_wasm::platform::Platform>::runtime_call<&[u8; 32],core::iter::sources::once::Once<&[u8; 32]>>::{{closure}}>>::h6a1bed5027481e49
        -309 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::json_rpc_service::Background<smoldot_light_wasm::platform::Platform>::runtime_call<alloc::vec::Vec<u8>,core::iter::sources::empty::Empty<alloc::vec::Vec<u8>>>::{{closure}}>>::hf76bc1f0e9aefff0
        -309 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::json_rpc_service::Background<smoldot_light_wasm::platform::Platform>::runtime_call<either::Either<&[u8],[u8; 4]>,core::array::iter::IntoIter<either::Either<&[u8],[u8; 4]>,2_usize>>::{{closure}}>>::h1758e07f5cc8c4eb
        -299 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::json_rpc_service::state_chain::<impl smoldot_light::json_rpc_service::Background<smoldot_light_wasm::platform::Platform>>::state_get_runtime_version::{{closure}}>>::h2a16060ee4f7d8fe
        -262 ┊ <smoldot_light::json_rpc_service::RuntimeCallError as core::fmt::Debug>::fmt::h292e92113425a775
        +262 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::json_rpc_service::Background<smoldot_light_wasm::platform::Platform>::runtime_lock::{{closure}}>>::h6aeb6233c9bc9143
        +101 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::json_rpc_service::Background<smoldot_light_wasm::platform::Platform>::runtime_call<alloc::vec::Vec<u8>,core::iter::sources::once::Once<alloc::vec::Vec<u8>>>::{{closure}}>>::hf12f04a6a344a6c3
         -92 ┊ core::result::Result<T,E>::unwrap::h62a2452b5b2ca820
        +153 ┊ ... and 8 more.
      -12452 ┊ Σ [28 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 Sep 13, 2022
@mergify mergify bot merged commit 3beb9b8 into paritytech:main Sep 13, 2022
@tomaka tomaka deleted the fix-state_getRuntimeVersion branch September 13, 2022 06:53
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.

Panic in runtime call after upgrade
2 participants