Use absolute path in native_executor for Blake2Hasher (#1671)

This commit is contained in:
Bastian Köcher
2019-02-04 11:26:51 +01:00
committed by Gav Wood
parent 6c341f4e9d
commit 4ea3ac1c4a
2 changed files with 3 additions and 3 deletions
+2 -1
View File
@@ -46,7 +46,8 @@ pub use native_executor::{with_native_environment, NativeExecutor, NativeExecuti
pub use state_machine::Externalities;
pub use runtime_version::{RuntimeVersion, NativeVersion};
pub use parity_codec::Codec;
use primitives::Blake2Hasher;
#[doc(hidden)]
pub use primitives::Blake2Hasher;
/// Provides runtime information.
pub trait RuntimeInfo {
@@ -266,14 +266,13 @@ macro_rules! native_executor_instance {
native_executor_instance!(IMPL $name, $dispatcher, $version, $code);
};
(IMPL $name:ident, $dispatcher:path, $version:path, $code:expr) => {
use primitives::Blake2Hasher as _Blake2Hasher;
impl $crate::NativeExecutionDispatch for $name {
fn native_equivalent() -> &'static [u8] {
// WARNING!!! This assumes that the runtime was built *before* the main project. Until we
// get a proper build script, this must be strictly adhered to or things will go wrong.
$code
}
fn dispatch(ext: &mut $crate::Externalities<_Blake2Hasher>, method: &str, data: &[u8]) -> $crate::error::Result<Vec<u8>> {
fn dispatch(ext: &mut $crate::Externalities<$crate::Blake2Hasher>, method: &str, data: &[u8]) -> $crate::error::Result<Vec<u8>> {
$crate::with_native_environment(ext, move || $dispatcher(method, data))?
.ok_or_else(|| $crate::error::ErrorKind::MethodNotFound(method.to_owned()).into())
}