diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 89e8ccd33a..b57ca6e54e 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -6325,6 +6325,7 @@ dependencies = [ "environmental 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "sc-executor 2.0.0", "sp-core 2.0.0", "sp-externalities 2.0.0", @@ -6335,6 +6336,7 @@ dependencies = [ "sp-std 2.0.0", "sp-wasm-interface 2.0.0", "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trybuild 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -6342,15 +6344,10 @@ name = "sp-runtime-interface-proc-macro" version = "2.0.0" dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 2.0.0", - "sp-runtime-interface 2.0.0", "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "trybuild 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/substrate/primitives/runtime-interface/Cargo.toml b/substrate/primitives/runtime-interface/Cargo.toml index cebc5286f6..704ae1b243 100644 --- a/substrate/primitives/runtime-interface/Cargo.toml +++ b/substrate/primitives/runtime-interface/Cargo.toml @@ -20,6 +20,8 @@ test-wasm = { package = "sp-runtime-interface-test-wasm", path = "test-wasm" } state_machine = { package = "sp-state-machine", path = "../../primitives/state-machine" } primitives = { package = "sp-core", path = "../core" } sp-io = { path = "../io" } +rustversion = "1.0.0" +trybuild = "1.0.17" [features] default = [ "std" ] diff --git a/substrate/primitives/runtime-interface/proc-macro/Cargo.toml b/substrate/primitives/runtime-interface/proc-macro/Cargo.toml index 2fcaa59447..a5d12de0a6 100644 --- a/substrate/primitives/runtime-interface/proc-macro/Cargo.toml +++ b/substrate/primitives/runtime-interface/proc-macro/Cargo.toml @@ -13,15 +13,3 @@ quote = "1.0.2" proc-macro2 = "1.0.3" Inflector = "0.11.4" proc-macro-crate = "0.1.4" - -[dev-dependencies] -runtime-interface = { package = "sp-runtime-interface", path = ".." } -codec = { package = "parity-scale-codec", version = "1.0.6", features = ["derive"] } -externalities = { package = "sp-externalities", path = "../../externalities" } -rustversion = "1.0.0" -trybuild = "1.0.17" - -# We actually don't need the `std` feature in this crate, but the tests require it. -[features] -default = [ "std" ] -std = [] diff --git a/substrate/primitives/runtime-interface/proc-macro/src/lib.rs b/substrate/primitives/runtime-interface/proc-macro/src/lib.rs index 023a97c117..af18165457 100644 --- a/substrate/primitives/runtime-interface/proc-macro/src/lib.rs +++ b/substrate/primitives/runtime-interface/proc-macro/src/lib.rs @@ -33,148 +33,6 @@ mod pass_by; mod runtime_interface; mod utils; -/// Attribute macro for transforming a trait declaration into a runtime interface. -/// -/// A runtime interface is a fixed interface between a Substrate compatible runtime and the native -/// node. This interface is callable from a native and a wasm runtime. The macro will generate the -/// corresponding code for the native implementation and the code for calling from the wasm -/// side to the native implementation. -/// -/// The macro expects the runtime interface declaration as trait declaration: -/// -/// ``` -/// # use runtime_interface::runtime_interface; -/// -/// #[runtime_interface] -/// trait Interface { -/// /// A function that can be called from native/wasm. -/// /// -/// /// The implementation given to this function is only compiled on native. -/// fn call_some_complex_code(data: &[u8]) -> Vec { -/// // Here you could call some rather complex code that only compiles on native or -/// // is way faster in native than executing it in wasm. -/// Vec::new() -/// } -/// -/// /// A function can take a `&self` or `&mut self` argument to get access to the -/// /// `Externalities`. (The generated method does not require -/// /// this argument, so the function can be called just with the `optional` argument) -/// fn set_or_clear(&mut self, optional: Option>) { -/// match optional { -/// Some(value) => self.set_storage([1, 2, 3, 4].to_vec(), value), -/// None => self.clear_storage(&[1, 2, 3, 4]), -/// } -/// } -/// } -/// ``` -/// -/// -/// The given example will generate roughly the following code for native: -/// -/// ``` -/// // The name of the trait is converted to snake case and used as mod name. -/// // -/// // Be aware that this module is not `public`, the visibility of the module is determined based -/// // on the visibility of the trait declaration. -/// mod interface { -/// trait Interface { -/// fn call_some_complex_code(data: &[u8]) -> Vec; -/// fn set_or_clear(&mut self, optional: Option>); -/// } -/// -/// impl Interface for &mut dyn externalities::Externalities { -/// fn call_some_complex_code(data: &[u8]) -> Vec { Vec::new() } -/// fn set_or_clear(&mut self, optional: Option>) { -/// match optional { -/// Some(value) => self.set_storage([1, 2, 3, 4].to_vec(), value), -/// None => self.clear_storage(&[1, 2, 3, 4]), -/// } -/// } -/// } -/// -/// pub fn call_some_complex_code(data: &[u8]) -> Vec { -/// <&mut dyn externalities::Externalities as Interface>::call_some_complex_code(data) -/// } -/// -/// pub fn set_or_clear(optional: Option>) { -/// externalities::with_externalities(|mut ext| Interface::set_or_clear(&mut ext, optional)) -/// .expect("`set_or_clear` called outside of an Externalities-provided environment.") -/// } -/// -/// /// This type implements the `HostFunctions` trait (from `sp-wasm-interface`) and -/// /// provides the host implementation for the wasm side. The host implementation converts the -/// /// arguments from wasm to native and calls the corresponding native function. -/// /// -/// /// This type needs to be passed to the wasm executor, so that the host functions will be -/// /// registered in the executor. -/// pub struct HostFunctions; -/// } -/// ``` -/// -/// -/// The given example will generate roughly the following code for wasm: -/// -/// ``` -/// mod interface { -/// mod extern_host_functions_impls { -/// extern "C" { -/// /// Every function is exported as `ext_TRAIT_NAME_FUNCTION_NAME_version_VERSION`. -/// /// -/// /// `TRAIT_NAME` is converted into snake case. -/// /// -/// /// The type for each argument of the exported function depends on -/// /// `::FFIType`. -/// /// -/// /// `data` holds the pointer and the length to the `[u8]` slice. -/// pub fn ext_Interface_call_some_complex_code_version_1(data: u64) -> u64; -/// /// `optional` holds the pointer and the length of the encoded value. -/// pub fn ext_Interface_set_or_clear_version_1(optional: u64); -/// } -/// } -/// -/// /// The type is actually `ExchangeableFunction` (from `sp-runtime-interface`). -/// /// -/// /// This can be used to replace the implementation of the `call_some_complex_code` function. -/// /// Instead of calling into the host, the callee will automatically call the other -/// /// implementation. -/// /// -/// /// To replace the implementation: -/// /// -/// /// `host_call_some_complex_code.replace_implementation(some_other_impl)` -/// pub static host_call_some_complex_code: () = (); -/// pub static host_set_or_clear: () = (); -/// -/// pub fn call_some_complex_code(data: &[u8]) -> Vec { -/// // This is the actual call: `host_call_some_complex_code.get()(data)` -/// // -/// // But that does not work for several reasons in this example, so we just return an -/// // empty vector. -/// Vec::new() -/// } -/// -/// pub fn set_or_clear(optional: Option>) { -/// // Same as above -/// } -/// } -/// ``` -/// -/// # Argument types -/// -/// The macro supports any kind of argument type, as long as it implements `RIType` and the required -/// `FromFFIValue`/`IntoFFIValue` from `sp-runtime-interface`. The macro will convert each -/// argument to the corresponding FFI representation and will call into the host using this FFI -/// representation. On the host each argument is converted back to the native representation and -/// the native implementation is called. Any return value is handled in the same way. -/// -/// # Wasm only interfaces -/// -/// Some interfaces are only required from within the wasm runtime e.g. the allocator interface. -/// To support this, the macro can be called like `#[runtime_interface(wasm_only)]`. This instructs -/// the macro to make two significant changes to the generated code: -/// -/// 1. The generated functions are not callable from the native side. -/// 2. The trait as shown above is not implemented for `Externalities` and is instead implemented -/// for `FunctionExecutor` (from `sp-wasm-interface`). #[proc_macro_attribute] pub fn runtime_interface( attrs: proc_macro::TokenStream, @@ -188,76 +46,18 @@ pub fn runtime_interface( .into() } -/// Derive macro for implementing `PassBy` with the `Codec` strategy. -/// -/// This requires that the type implements `Encode` and `Decode` from `parity-scale-codec`. -/// -/// # Example -/// -/// ``` -/// # use runtime_interface::pass_by::PassByCodec; -/// # use codec::{Encode, Decode}; -/// #[derive(PassByCodec, Encode, Decode)] -/// struct EncodableType { -/// name: Vec, -/// param: u32, -/// } -/// ``` #[proc_macro_derive(PassByCodec)] pub fn pass_by_codec(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let input = parse_macro_input!(input as DeriveInput); pass_by::codec_derive_impl(input).unwrap_or_else(|e| e.to_compile_error()).into() } -/// Derive macro for implementing `PassBy` with the `Inner` strategy. -/// -/// Besides implementing `PassBy`, this derive also implements the helper trait `PassByInner`. -/// -/// The type is required to be a struct with just one field. The field type needs to implement -/// the required traits to pass it between the wasm and the native side. (See the runtime interface -/// crate for more information about these traits.) -/// -/// # Example -/// -/// ``` -/// # use runtime_interface::pass_by::PassByInner; -/// #[derive(PassByInner)] -/// struct Data([u8; 32]); -/// ``` -/// -/// ``` -/// # use runtime_interface::pass_by::PassByInner; -/// #[derive(PassByInner)] -/// struct Data { -/// data: [u8; 32], -/// } -/// ``` #[proc_macro_derive(PassByInner)] pub fn pass_by_inner(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let input = parse_macro_input!(input as DeriveInput); pass_by::inner_derive_impl(input).unwrap_or_else(|e| e.to_compile_error()).into() } -/// Derive macro for implementing `PassBy` with the `Enum` strategy. -/// -/// Besides implementing `PassBy`, this derive also implements `TryFrom` and `From for u8` -/// for the type. -/// -/// The type is required to be an enum with only unit variants and at maximum `256` variants. Also -/// it is required that the type implements `Copy`. -/// -/// # Example -/// -/// ``` -/// # use runtime_interface::pass_by::PassByEnum; -/// #[derive(PassByEnum, Copy, Clone)] -/// enum Data { -/// Okay, -/// NotOkay, -/// // This will not work with the derive. -/// //Why(u32), -/// } -/// ``` #[proc_macro_derive(PassByEnum)] pub fn pass_by_enum(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let input = parse_macro_input!(input as DeriveInput); diff --git a/substrate/primitives/runtime-interface/src/lib.rs b/substrate/primitives/runtime-interface/src/lib.rs index 3a2a780d2d..ac172a9bc8 100644 --- a/substrate/primitives/runtime-interface/src/lib.rs +++ b/substrate/primitives/runtime-interface/src/lib.rs @@ -72,6 +72,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate self as sp_runtime_interface; + #[doc(hidden)] #[cfg(feature = "std")] pub use wasm_interface; @@ -79,6 +81,148 @@ pub use wasm_interface; #[doc(hidden)] pub use sp_std; +/// Attribute macro for transforming a trait declaration into a runtime interface. +/// +/// A runtime interface is a fixed interface between a Substrate compatible runtime and the native +/// node. This interface is callable from a native and a wasm runtime. The macro will generate the +/// corresponding code for the native implementation and the code for calling from the wasm +/// side to the native implementation. +/// +/// The macro expects the runtime interface declaration as trait declaration: +/// +/// ``` +/// # use sp_runtime_interface::runtime_interface; +/// +/// #[runtime_interface] +/// trait Interface { +/// /// A function that can be called from native/wasm. +/// /// +/// /// The implementation given to this function is only compiled on native. +/// fn call_some_complex_code(data: &[u8]) -> Vec { +/// // Here you could call some rather complex code that only compiles on native or +/// // is way faster in native than executing it in wasm. +/// Vec::new() +/// } +/// +/// /// A function can take a `&self` or `&mut self` argument to get access to the +/// /// `Externalities`. (The generated method does not require +/// /// this argument, so the function can be called just with the `optional` argument) +/// fn set_or_clear(&mut self, optional: Option>) { +/// match optional { +/// Some(value) => self.set_storage([1, 2, 3, 4].to_vec(), value), +/// None => self.clear_storage(&[1, 2, 3, 4]), +/// } +/// } +/// } +/// ``` +/// +/// +/// The given example will generate roughly the following code for native: +/// +/// ``` +/// // The name of the trait is converted to snake case and used as mod name. +/// // +/// // Be aware that this module is not `public`, the visibility of the module is determined based +/// // on the visibility of the trait declaration. +/// mod interface { +/// trait Interface { +/// fn call_some_complex_code(data: &[u8]) -> Vec; +/// fn set_or_clear(&mut self, optional: Option>); +/// } +/// +/// impl Interface for &mut dyn externalities::Externalities { +/// fn call_some_complex_code(data: &[u8]) -> Vec { Vec::new() } +/// fn set_or_clear(&mut self, optional: Option>) { +/// match optional { +/// Some(value) => self.set_storage([1, 2, 3, 4].to_vec(), value), +/// None => self.clear_storage(&[1, 2, 3, 4]), +/// } +/// } +/// } +/// +/// pub fn call_some_complex_code(data: &[u8]) -> Vec { +/// <&mut dyn externalities::Externalities as Interface>::call_some_complex_code(data) +/// } +/// +/// pub fn set_or_clear(optional: Option>) { +/// externalities::with_externalities(|mut ext| Interface::set_or_clear(&mut ext, optional)) +/// .expect("`set_or_clear` called outside of an Externalities-provided environment.") +/// } +/// +/// /// This type implements the `HostFunctions` trait (from `sp-wasm-interface`) and +/// /// provides the host implementation for the wasm side. The host implementation converts the +/// /// arguments from wasm to native and calls the corresponding native function. +/// /// +/// /// This type needs to be passed to the wasm executor, so that the host functions will be +/// /// registered in the executor. +/// pub struct HostFunctions; +/// } +/// ``` +/// +/// +/// The given example will generate roughly the following code for wasm: +/// +/// ``` +/// mod interface { +/// mod extern_host_functions_impls { +/// extern "C" { +/// /// Every function is exported as `ext_TRAIT_NAME_FUNCTION_NAME_version_VERSION`. +/// /// +/// /// `TRAIT_NAME` is converted into snake case. +/// /// +/// /// The type for each argument of the exported function depends on +/// /// `::FFIType`. +/// /// +/// /// `data` holds the pointer and the length to the `[u8]` slice. +/// pub fn ext_Interface_call_some_complex_code_version_1(data: u64) -> u64; +/// /// `optional` holds the pointer and the length of the encoded value. +/// pub fn ext_Interface_set_or_clear_version_1(optional: u64); +/// } +/// } +/// +/// /// The type is actually `ExchangeableFunction` (from `sp-runtime-interface`). +/// /// +/// /// This can be used to replace the implementation of the `call_some_complex_code` function. +/// /// Instead of calling into the host, the callee will automatically call the other +/// /// implementation. +/// /// +/// /// To replace the implementation: +/// /// +/// /// `host_call_some_complex_code.replace_implementation(some_other_impl)` +/// pub static host_call_some_complex_code: () = (); +/// pub static host_set_or_clear: () = (); +/// +/// pub fn call_some_complex_code(data: &[u8]) -> Vec { +/// // This is the actual call: `host_call_some_complex_code.get()(data)` +/// // +/// // But that does not work for several reasons in this example, so we just return an +/// // empty vector. +/// Vec::new() +/// } +/// +/// pub fn set_or_clear(optional: Option>) { +/// // Same as above +/// } +/// } +/// ``` +/// +/// # Argument types +/// +/// The macro supports any kind of argument type, as long as it implements [`RIType`] and the +/// required `FromFFIValue`/`IntoFFIValue`. The macro will convert each +/// argument to the corresponding FFI representation and will call into the host using this FFI +/// representation. On the host each argument is converted back to the native representation and +/// the native implementation is called. Any return value is handled in the same way. +/// +/// # Wasm only interfaces +/// +/// Some interfaces are only required from within the wasm runtime e.g. the allocator interface. +/// To support this, the macro can be called like `#[runtime_interface(wasm_only)]`. This instructs +/// the macro to make two significant changes to the generated code: +/// +/// 1. The generated functions are not callable from the native side. +/// 2. The trait as shown above is not implemented for `Externalities` and is instead implemented +/// for `FunctionExecutor` (from `sp-wasm-interface`). pub use sp_runtime_interface_proc_macro::runtime_interface; #[doc(hidden)] diff --git a/substrate/primitives/runtime-interface/src/pass_by.rs b/substrate/primitives/runtime-interface/src/pass_by.rs index 96cd6314ba..5d5b98244e 100644 --- a/substrate/primitives/runtime-interface/src/pass_by.rs +++ b/substrate/primitives/runtime-interface/src/pass_by.rs @@ -35,7 +35,70 @@ use sp_std::{marker::PhantomData, convert::TryFrom}; #[cfg(not(feature = "std"))] use sp_std::{slice, vec::Vec}; -pub use sp_runtime_interface_proc_macro::{PassByCodec, PassByInner, PassByEnum}; +/// Derive macro for implementing [`PassBy`] with the [`Codec`] strategy. +/// +/// This requires that the type implements [`Encode`](codec::Encode) and [`Decode`](codec::Decode) +/// from `parity-scale-codec`. +/// +/// # Example +/// +/// ``` +/// # use sp_runtime_interface::pass_by::PassByCodec; +/// # use codec::{Encode, Decode}; +/// #[derive(PassByCodec, Encode, Decode)] +/// struct EncodableType { +/// name: Vec, +/// param: u32, +/// } +/// ``` +pub use sp_runtime_interface_proc_macro::PassByCodec; + +/// Derive macro for implementing [`PassBy`] with the [`Inner`] strategy. +/// +/// Besides implementing [`PassBy`], this derive also implements the helper trait [`PassByInner`]. +/// +/// The type is required to be a struct with just one field. The field type needs to implement +/// the required traits to pass it between the wasm and the native side. (See the runtime interface +/// crate for more information about these traits.) +/// +/// # Example +/// +/// ``` +/// # use sp_runtime_interface::pass_by::PassByInner; +/// #[derive(PassByInner)] +/// struct Data([u8; 32]); +/// ``` +/// +/// ``` +/// # use sp_runtime_interface::pass_by::PassByInner; +/// #[derive(PassByInner)] +/// struct Data { +/// data: [u8; 32], +/// } +/// ``` +pub use sp_runtime_interface_proc_macro::PassByInner; + +/// Derive macro for implementing [`PassBy`] with the [`Enum`] strategy. +/// +/// Besides implementing [`PassBy`], this derive also implements `TryFrom` and +/// `From for u8` for the type. +/// +/// The type is required to be an enum with only unit variants and at maximum `256` variants. Also +/// it is required that the type implements `Copy`. +/// +/// # Example +/// +/// ``` +/// # use sp_runtime_interface::pass_by::PassByEnum; +/// #[derive(PassByEnum, Copy, Clone)] +/// enum Data { +/// Okay, +/// NotOkay, +/// // This will not work with the derive. +/// //Why(u32), +/// } +/// ``` +pub use sp_runtime_interface_proc_macro::PassByEnum; /// Something that should be passed between wasm and the host using the given strategy. /// diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui.rs b/substrate/primitives/runtime-interface/tests/ui.rs similarity index 100% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui.rs rename to substrate/primitives/runtime-interface/tests/ui.rs diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.rs b/substrate/primitives/runtime-interface/tests/ui/no_generic_parameters.rs similarity index 61% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.rs rename to substrate/primitives/runtime-interface/tests/ui/no_generic_parameters.rs index 489fe5d9b4..17ddb00fab 100644 --- a/substrate/primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.rs +++ b/substrate/primitives/runtime-interface/tests/ui/no_generic_parameters.rs @@ -1,4 +1,4 @@ -use runtime_interface::runtime_interface; +use sp_runtime_interface::runtime_interface; #[runtime_interface] trait Test { diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.stderr b/substrate/primitives/runtime-interface/tests/ui/no_generic_parameters.stderr similarity index 100% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/no_generic_parameters.stderr rename to substrate/primitives/runtime-interface/tests/ui/no_generic_parameters.stderr diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.rs b/substrate/primitives/runtime-interface/tests/ui/no_method_implementation.rs similarity index 58% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.rs rename to substrate/primitives/runtime-interface/tests/ui/no_method_implementation.rs index 5291942420..e3cd93e4a9 100644 --- a/substrate/primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.rs +++ b/substrate/primitives/runtime-interface/tests/ui/no_method_implementation.rs @@ -1,4 +1,4 @@ -use runtime_interface::runtime_interface; +use sp_runtime_interface::runtime_interface; #[runtime_interface] trait Test { diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.stderr b/substrate/primitives/runtime-interface/tests/ui/no_method_implementation.stderr similarity index 100% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/no_method_implementation.stderr rename to substrate/primitives/runtime-interface/tests/ui/no_method_implementation.stderr diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.rs b/substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_struct.rs similarity index 51% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.rs rename to substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_struct.rs index a729e0a99a..6f4ae37ea4 100644 --- a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.rs +++ b/substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_struct.rs @@ -1,4 +1,4 @@ -use runtime_interface::pass_by::PassByEnum; +use sp_runtime_interface::pass_by::PassByEnum; #[derive(PassByEnum)] struct Test; diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.stderr b/substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_struct.stderr similarity index 100% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_struct.stderr rename to substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_struct.stderr diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.rs b/substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_value_variant.rs similarity index 57% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.rs rename to substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_value_variant.rs index d2558e7977..a03bfdc1ae 100644 --- a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.rs +++ b/substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_value_variant.rs @@ -1,4 +1,4 @@ -use runtime_interface::pass_by::PassByEnum; +use sp_runtime_interface::pass_by::PassByEnum; #[derive(PassByEnum)] enum Test { diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.stderr b/substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_value_variant.stderr similarity index 100% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_enum_with_value_variant.stderr rename to substrate/primitives/runtime-interface/tests/ui/pass_by_enum_with_value_variant.stderr diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.rs b/substrate/primitives/runtime-interface/tests/ui/pass_by_inner_with_two_fields.rs similarity index 62% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.rs rename to substrate/primitives/runtime-interface/tests/ui/pass_by_inner_with_two_fields.rs index eab79eae19..f496bc3700 100644 --- a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.rs +++ b/substrate/primitives/runtime-interface/tests/ui/pass_by_inner_with_two_fields.rs @@ -1,4 +1,4 @@ -use runtime_interface::pass_by::PassByInner; +use sp_runtime_interface::pass_by::PassByInner; #[derive(PassByInner)] struct Test { diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.stderr b/substrate/primitives/runtime-interface/tests/ui/pass_by_inner_with_two_fields.stderr similarity index 100% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/pass_by_inner_with_two_fields.stderr rename to substrate/primitives/runtime-interface/tests/ui/pass_by_inner_with_two_fields.stderr diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.rs b/substrate/primitives/runtime-interface/tests/ui/take_self_by_value.rs similarity index 60% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.rs rename to substrate/primitives/runtime-interface/tests/ui/take_self_by_value.rs index f01c2de21e..9c12614d93 100644 --- a/substrate/primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.rs +++ b/substrate/primitives/runtime-interface/tests/ui/take_self_by_value.rs @@ -1,4 +1,4 @@ -use runtime_interface::runtime_interface; +use sp_runtime_interface::runtime_interface; #[runtime_interface] trait Test { diff --git a/substrate/primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.stderr b/substrate/primitives/runtime-interface/tests/ui/take_self_by_value.stderr similarity index 100% rename from substrate/primitives/runtime-interface/proc-macro/tests/ui/take_self_by_value.stderr rename to substrate/primitives/runtime-interface/tests/ui/take_self_by_value.stderr