Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed some grumbles
  • Loading branch information
svyatonik committed Aug 30, 2019
commit 3d5aaa54fa83a07d64494c52efbfabec9248e539
8 changes: 4 additions & 4 deletions core/executor/src/wasm_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//! Rust implementation of Substrate contracts.

use std::{collections::HashMap, convert::TryFrom, str};
use std::{collections::HashMap, convert::TryFrom, str, panic};
use tiny_keccak;
use secp256k1;

Expand Down Expand Up @@ -77,12 +77,12 @@ impl<'e, E: Externalities<Blake2Hasher> + 'e> ExtHideout<'e, E> {
/// leading to process abort.
pub fn with_storage_ext<T, F>(&mut self, f: F) -> Result<T>
where
F: ::std::panic::UnwindSafe + FnOnce(&mut dyn StorageExternalities<Blake2Hasher>) -> Result<T>
F: panic::UnwindSafe + FnOnce(&mut dyn StorageExternalities<Blake2Hasher>) -> Result<T>
{
// it is safe beause basic methods of StorageExternalities are guaranteed to touch only
// its internal state + we should discard it on error
let mut ext = std::panic::AssertUnwindSafe(&mut *self.0);
std::panic::catch_unwind(move || f(&mut **ext))
let mut ext = panic::AssertUnwindSafe(&mut *self.0);
panic::catch_unwind(move || f(&mut **ext))
.map_err(|_| Error::Runtime)
.and_then(|result| result)
}
Expand Down
4 changes: 2 additions & 2 deletions core/state-machine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl fmt::Display for ExecutionError {

type CallResult<R, E> = Result<NativeOrEncoded<R>, E>;

/// Storage externalities API: pinned to specific active address.
/// Storage externalities API.
///
/// Implementations of methods of this trait guarantee that there are no side effects,
/// other than modifications to some **internal state** which could easily be
Expand Down Expand Up @@ -255,7 +255,7 @@ pub trait StorageExternalities<H: Hasher> {
fn storage_changes_root(&mut self, parent: H::Out) -> Result<Option<H::Out>, ()> where H::Out: Ord;
}

/// Extra externalities API: pinned to specific active address.
/// Externalities API.
///
/// Methods of this trait may have side-effects. Therefore, it isn't safe
/// to catch unwinding of any panics that occur during calls to them.
Expand Down