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

Check signatures of host functions at initialization and sync functions list with spec #183

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Feb 14, 2023

We now verify the signatures of host functions directly when initializing the prototype.
This removes some error conditions.

Additionally, this PR synchronizes the list of functions that we support with the functions on https://spec.polkadot.network/
All the todo!()s have been removed, meaning that a malicious runtime can no longer make smoldot panic.

@github-actions
Copy link

twiggy diff report

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


 Delta Bytes │ Item
─────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       +8482 ┊ smoldot::executor::vm::interpreter::InterpreterPrototype::new::h229c5de18112680c
       -1644 ┊ <&T as core::fmt::Display>::fmt::h5c4a02a4a2295041
       +1451 ┊ <&T as core::fmt::Display>::fmt::h185508ba6c8124c3
       -1117 ┊ <smoldot::executor::host::Error as core::fmt::Debug>::fmt::h4bb49b8d0e168c25
        +982 ┊ <smoldot::executor::host::Error as core::fmt::Debug>::fmt::h4803cdfa74cb1f38
        +646 ┊ smoldot::executor::host::Inner::alloc::hcc3b1baec05303f9
        -646 ┊ smoldot::executor::host::Inner::alloc::hfdc086457b5ed935
        -409 ┊ <smoldot::executor::host::Error as core::clone::Clone>::clone::hd3e4a5931d643015
        +369 ┊ <smoldot::executor::host::Error as core::clone::Clone>::clone::hfa2fd1de35d1e19b
        +268 ┊ smoldot::executor::host::ReadyToRun::run_once::h42471b52c5e6c06b
        +137 ┊ smallvec::SmallVec<A>::push::h55d7699780f3e912
        -119 ┊ <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend::h1a7e2912b57becbd
         +96 ┊ <[A] as core::slice::cmp::SlicePartialEq<B>>::equal::h62fc1a2d21b5a4c3
         +96 ┊ data[0]
         -64 ┊ core::ptr::drop_in_place<smoldot::executor::host::Error>::h55ae9a9a7d78c599
         -64 ┊ core::ptr::drop_in_place<smoldot::executor::host::Error>::hbb85a40a09c24296
         +63 ┊ core::ptr::drop_in_place<smoldot::executor::host::Error>::h62370c71bc2efa8f
         +63 ┊ core::ptr::drop_in_place<smoldot::executor::host::Error>::h72ea5e81da3b7104
         +46 ┊ smoldot::executor::host::HostFunction::name::h25167ff83f10661c
         -46 ┊ smoldot::executor::host::HostFunction::name::he4c9ce98bf187fc6
         -42 ┊ ... and 6 more.
       +8716 ┊ Σ [26 Total Rows]

@tomaka tomaka added this pull request to the merge queue Feb 15, 2023
Merged via the queue into smol-dot:main with commit 730f7ce Feb 15, 2023
@tomaka tomaka deleted the host-fn-sig branch February 15, 2023 10:36
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