mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-08 03:08:06 +00:00
a670208a33
* Introduce first groundwork for Wasm executor. * Remove old Rust-runtime code. * Avoid commiting compled files. * Add runtime precompile. * Rename so module makes more sense. * Further renaming. * Ensure tests work. * Allow bringing in of externalities. - Add util functions/macros. - Add uncompacted runtime. - Add some external crates from pwasm-std for managing allocs/memory stuff. * Nice macros for imports. * Allow passing in of data through allocators. Make memcpy and malloc work. Basic allocator. * Can now pass in bytes to WasmExecutor. * Additional cleanup. * Switch usages of `OutData` to `u64` No need to be able to return bytes anymore. * convert to safe but extremely verbose type conversion. @rphmeier any more concise way of doing this? * Remove StaticExternalities distinction. * Remove another unused use. * Refactor wasm utils out * Remove extraneous copies that weren't really testing anything. * Try to use wasm 0.15 * Make it work! * Call-time externalities working. * Add basic externalities. * Fix grumbles and note unwraps to be sorted. * Test storage externality. Unforunately had to change signatures of externalities to avoid immutable function returning a reference. Not sure what to do about this... * Fix nits. * Compile collation logic. * Move back to refs. Yey. * Remove "object" id for storage access. * Fix test. * Fix up rest of tests. * remove unwrap. * Expose set/get code in externalities Also improve tests and add nice wrappers in rust-wasm. * Add validator set. * Introduce validator set into externalities and test. * Add another external function. * Remove code and validators; use storage for everything. * Introduce validators function. * Tests (and a fix) for the validators getter. * Allow calls into runtime to return data. * Remove unneeded trace. * Make runtime printing a bit nicer. * Create separate runtimes for testing and polkadot. * Remove commented code. * Use new path. * Refactor into shared support module. * Fix warning. * Remove unwraps. * Make macro a little less unhygenic. * Add wasm files.
37 lines
826 B
Rust
37 lines
826 B
Rust
#![no_std]
|
|
#![feature(lang_items)]
|
|
#![cfg_attr(feature = "strict", deny(warnings))]
|
|
|
|
#![feature(alloc)]
|
|
extern crate alloc;
|
|
use alloc::vec::Vec;
|
|
|
|
#[macro_use]
|
|
extern crate runtime_support;
|
|
use runtime_support::{set_storage, code, set_code, storage, validators, set_validators, print};
|
|
|
|
impl_stub!(test_data_in);
|
|
fn test_data_in(input: Vec<u8>) -> Vec<u8> {
|
|
print(b"set_storage" as &[u8]);
|
|
set_storage(b"input", &input);
|
|
|
|
print(b"code" as &[u8]);
|
|
set_storage(b"code", &code());
|
|
|
|
print(b"set_code" as &[u8]);
|
|
set_code(&input);
|
|
|
|
print(b"storage" as &[u8]);
|
|
let copy = storage(b"input");
|
|
|
|
print(b"validators" as &[u8]);
|
|
let mut v = validators();
|
|
v.push(copy);
|
|
|
|
print(b"set_validators" as &[u8]);
|
|
set_validators(&v.iter().map(Vec::as_slice).collect::<Vec<_>>());
|
|
|
|
print(b"finished!" as &[u8]);
|
|
b"all ok!".to_vec()
|
|
}
|