mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Move client only primitives to another dir (#9220)
* Move alloc primitive (not used in /pallets) * Move to alternative location as not shared * moved crates to different dir * ren sp_chain_spec to sc_chain_spec_primatives * merged sc-chain-spec and moved allocation up one. * no no_std * nudge * Bump CI
This commit is contained in:
@@ -19,7 +19,7 @@ pwasm-utils = "0.18.0"
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0" }
|
||||
wasmi = "0.9.0"
|
||||
sp-core = { version = "3.0.0", path = "../../../primitives/core" }
|
||||
sp-allocator = { version = "3.0.0", path = "../../../primitives/allocator" }
|
||||
sc-allocator = { version = "3.0.0", path = "../../allocator" }
|
||||
sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" }
|
||||
sp-maybe-compressed-blob = { version = "3.0.0", path = "../../../primitives/maybe-compressed-blob" }
|
||||
sp-serializer = { version = "3.0.0", path = "../../../primitives/serializer" }
|
||||
|
||||
@@ -77,7 +77,7 @@ pub enum Error {
|
||||
Other(String),
|
||||
|
||||
#[error(transparent)]
|
||||
Allocator(#[from] sp_allocator::Error),
|
||||
Allocator(#[from] sc_allocator::Error),
|
||||
|
||||
#[error("Host function {0} execution failed with: {1}")]
|
||||
FunctionExecution(String, String),
|
||||
|
||||
@@ -13,7 +13,7 @@ repository = "https://github.com/paritytech/substrate/"
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
sp-allocator = { version = "3.0.0", default-features = false, path = "../../../primitives/allocator" }
|
||||
sc-allocator = { version = "3.0.0", default-features = false, path = "../../allocator" }
|
||||
sp-core = { version = "3.0.0", default-features = false, path = "../../../primitives/core" }
|
||||
sp-io = { version = "3.0.0", default-features = false, path = "../../../primitives/io" }
|
||||
sp-runtime = { version = "3.0.0", default-features = false, path = "../../../primitives/runtime" }
|
||||
@@ -27,7 +27,7 @@ substrate-wasm-builder = { version = "4.0.0", path = "../../../utils/wasm-builde
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"sp-allocator/std",
|
||||
"sc-allocator/std",
|
||||
"sp-core/std",
|
||||
"sp-io/std",
|
||||
"sp-runtime/std",
|
||||
|
||||
@@ -211,7 +211,6 @@ sp_core::wasm_export_functions! {
|
||||
code
|
||||
}
|
||||
|
||||
|
||||
fn test_sandbox_get_global_val(code: Vec<u8>) -> i64 {
|
||||
let env_builder = sp_sandbox::EnvironmentDefinitionBuilder::new();
|
||||
let instance = if let Ok(i) = sp_sandbox::Instance::new(&code, &env_builder, &mut ()) {
|
||||
@@ -227,12 +226,10 @@ sp_core::wasm_export_functions! {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn test_offchain_index_set() {
|
||||
sp_io::offchain_index::set(b"k", b"v");
|
||||
}
|
||||
|
||||
|
||||
fn test_offchain_local_storage() -> bool {
|
||||
let kind = sp_core::offchain::StorageKind::PERSISTENT;
|
||||
assert_eq!(sp_io::offchain::local_storage_get(kind, b"test"), None);
|
||||
@@ -286,11 +283,6 @@ sp_core::wasm_export_functions! {
|
||||
run().is_some()
|
||||
}
|
||||
|
||||
// Just some test to make sure that `sp-allocator` compiles on `no_std`.
|
||||
fn test_sp_allocator_compiles() {
|
||||
sp_allocator::FreeingBumpHeapAllocator::new(0);
|
||||
}
|
||||
|
||||
fn test_enter_span() -> u64 {
|
||||
wasm_tracing::enter_span(Default::default())
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ log = "0.4.8"
|
||||
wasmi = "0.9.0"
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0" }
|
||||
sc-executor-common = { version = "0.9.0", path = "../common" }
|
||||
sc-allocator = { version = "3.0.0", path = "../../allocator" }
|
||||
sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" }
|
||||
sp-runtime-interface = { version = "3.0.0", path = "../../../primitives/runtime-interface" }
|
||||
sp-core = { version = "3.0.0", path = "../../../primitives/core" }
|
||||
sp-allocator = { version = "3.0.0", path = "../../../primitives/allocator" }
|
||||
|
||||
@@ -40,7 +40,7 @@ use sc_executor_common::runtime_blob::{RuntimeBlob, DataSegmentsSnapshot};
|
||||
|
||||
struct FunctionExecutor<'a> {
|
||||
sandbox_store: sandbox::Store<wasmi::FuncRef>,
|
||||
heap: sp_allocator::FreeingBumpHeapAllocator,
|
||||
heap: sc_allocator::FreeingBumpHeapAllocator,
|
||||
memory: MemoryRef,
|
||||
table: Option<TableRef>,
|
||||
host_functions: &'a [&'static dyn Function],
|
||||
@@ -59,7 +59,7 @@ impl<'a> FunctionExecutor<'a> {
|
||||
) -> Result<Self, Error> {
|
||||
Ok(FunctionExecutor {
|
||||
sandbox_store: sandbox::Store::new(),
|
||||
heap: sp_allocator::FreeingBumpHeapAllocator::new(heap_base),
|
||||
heap: sc_allocator::FreeingBumpHeapAllocator::new(heap_base),
|
||||
memory: m,
|
||||
table: t,
|
||||
host_functions,
|
||||
|
||||
@@ -23,7 +23,7 @@ sc-executor-common = { version = "0.9.0", path = "../common" }
|
||||
sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" }
|
||||
sp-runtime-interface = { version = "3.0.0", path = "../../../primitives/runtime-interface" }
|
||||
sp-core = { version = "3.0.0", path = "../../../primitives/core" }
|
||||
sp-allocator = { version = "3.0.0", path = "../../../primitives/allocator" }
|
||||
sc-allocator = { version = "3.0.0", path = "../../allocator" }
|
||||
wasmtime = "0.27.0"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -24,7 +24,7 @@ use crate::util;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
use log::trace;
|
||||
use codec::{Encode, Decode};
|
||||
use sp_allocator::FreeingBumpHeapAllocator;
|
||||
use sc_allocator::FreeingBumpHeapAllocator;
|
||||
use sc_executor_common::error::Result;
|
||||
use sc_executor_common::sandbox::{self, SandboxCapabilities, SupervisorFuncIndex};
|
||||
use sp_core::sandbox as sandbox_primitives;
|
||||
|
||||
@@ -340,7 +340,7 @@ impl InstanceWrapper {
|
||||
|
||||
let range = util::checked_range(address.into(), data.len(), memory.len())
|
||||
.ok_or_else(|| Error::Other("memory write is out of bounds".into()))?;
|
||||
&mut memory[range].copy_from_slice(data);
|
||||
memory[range].copy_from_slice(data);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -351,7 +351,7 @@ impl InstanceWrapper {
|
||||
/// to get more details.
|
||||
pub fn allocate(
|
||||
&self,
|
||||
allocator: &mut sp_allocator::FreeingBumpHeapAllocator,
|
||||
allocator: &mut sc_allocator::FreeingBumpHeapAllocator,
|
||||
size: WordSize,
|
||||
) -> Result<Pointer<u8>> {
|
||||
unsafe {
|
||||
@@ -368,7 +368,7 @@ impl InstanceWrapper {
|
||||
/// Returns `Err` in case the given memory region cannot be deallocated.
|
||||
pub fn deallocate(
|
||||
&self,
|
||||
allocator: &mut sp_allocator::FreeingBumpHeapAllocator,
|
||||
allocator: &mut sc_allocator::FreeingBumpHeapAllocator,
|
||||
ptr: Pointer<u8>,
|
||||
) -> Result<()> {
|
||||
unsafe {
|
||||
|
||||
@@ -31,7 +31,7 @@ use sc_executor_common::{
|
||||
runtime_blob::{DataSegmentsSnapshot, ExposedMutableGlobalsSet, GlobalsSnapshot, RuntimeBlob},
|
||||
wasm_runtime::{WasmModule, WasmInstance, InvokeMethod},
|
||||
};
|
||||
use sp_allocator::FreeingBumpHeapAllocator;
|
||||
use sc_allocator::FreeingBumpHeapAllocator;
|
||||
use sp_runtime_interface::unpack_ptr_and_len;
|
||||
use sp_wasm_interface::{Function, Pointer, WordSize, Value};
|
||||
use wasmtime::{Engine, Store};
|
||||
|
||||
Reference in New Issue
Block a user