mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Parachain execution yields messages to send (#96)
* read head-data directly out of WASM memory * implement ext_post_message for parachain WASM * further refactoring of the parachain module * add externalities error type * accumulate posted messages when validating parachain candidate * define Extrinsic type in primitives * availability-store: store extrinsic data * compute extrinsic and check against candidate * add some egress queue tests * grumbles & substrate update * ensure everything builds
This commit is contained in:
committed by
Gav Wood
parent
152bb30889
commit
fe6351ca65
@@ -1 +0,0 @@
|
||||
src
|
||||
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
adder = { path = ".." }
|
||||
polkadot-parachain = { path = "../../../parachain", default-features = false }
|
||||
polkadot-parachain = { path = "../../../parachain", default-features = false, features = ["wasm-api"] }
|
||||
wee_alloc = { version = "0.4.1" }
|
||||
pwasm-libc = { version = "0.2" }
|
||||
tiny-keccak = "1.4"
|
||||
|
||||
@@ -23,13 +23,11 @@
|
||||
)]
|
||||
|
||||
extern crate alloc;
|
||||
extern crate wee_alloc;
|
||||
extern crate pwasm_libc;
|
||||
extern crate adder;
|
||||
extern crate polkadot_parachain as parachain;
|
||||
extern crate tiny_keccak;
|
||||
|
||||
// Define global allocator.
|
||||
#[global_allocator]
|
||||
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
||||
|
||||
@@ -56,7 +54,7 @@ pub fn oom(_: ::core::alloc::Layout) -> ! {
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn validate(offset: usize, len: usize) -> usize {
|
||||
let params = unsafe { ::parachain::load_params(offset, len) };
|
||||
let params = unsafe { ::parachain::wasm_api::load_params(offset, len) };
|
||||
let parent_head = HeadData::decode(&mut ¶ms.parent_head[..])
|
||||
.expect("invalid parent head format.");
|
||||
|
||||
@@ -66,7 +64,9 @@ pub extern fn validate(offset: usize, len: usize) -> usize {
|
||||
let parent_hash = ::tiny_keccak::keccak256(¶ms.parent_head[..]);
|
||||
|
||||
match ::adder::execute(parent_hash, parent_head, &block_data) {
|
||||
Ok(new_head) => parachain::write_result(ValidationResult { head_data: new_head.encode() }),
|
||||
Ok(new_head) => parachain::wasm_api::write_result(
|
||||
ValidationResult { head_data: new_head.encode() }
|
||||
),
|
||||
Err(_) => panic!("execution failure"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user