mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
06386558ae
* Make use of `runtime_interface` for parachain externalities This also changes the encoding of the `ValidationResult` return value to match the default encoding used in Substrate. * Fix compilation for web * Update `Cargo.lock` * Include feedback * Move proc macro * Update parachain/src/lib.rs Co-Authored-By: Robert Habermeier <rphmeier@gmail.com> Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
44 lines
1.5 KiB
Rust
44 lines
1.5 KiB
Rust
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
|
|
// This file is part of Polkadot.
|
|
|
|
// Polkadot is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Polkadot is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
mod adder;
|
|
mod wasm_executor;
|
|
|
|
use polkadot_parachain as parachain;
|
|
use crate::parachain::{
|
|
TargetedMessage, UpwardMessage, wasm_executor::{Externalities, run_worker},
|
|
};
|
|
|
|
struct DummyExt;
|
|
impl Externalities for DummyExt {
|
|
fn post_message(&mut self, _: TargetedMessage) -> Result<(), String> {
|
|
Ok(())
|
|
}
|
|
fn post_upward_message(&mut self, _: UpwardMessage) -> Result<(), String> {
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
// This is not an actual test, but rather an entry point for out-of process WASM executor.
|
|
// When executing tests the executor spawns currently executing binary, which happens to be test binary.
|
|
// It then passes "validation_worker" on CLI effectivly making rust test executor to run this single test.
|
|
#[test]
|
|
fn validation_worker() {
|
|
if let Some(id) = std::env::args().find(|a| a.starts_with("/shmem_rs_")) {
|
|
run_worker(&id).unwrap()
|
|
}
|
|
}
|