mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Update to latest Substrate master (#320)
* Make `collator::Network` require `Send + Sync` to make it work * Update packages * Update to latest Substrate * Make it compile and make tests work * Use `polkadot-master` * Fix CI * Remove `build.sh` from readmes * Delete old stuff * Bring one back
This commit is contained in:
committed by
André Silva
parent
d99f721540
commit
c0b065837e
@@ -4,8 +4,26 @@ version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
description = "Test parachain which adds to a number as its state transition"
|
||||
edition = "2018"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
parachain = { package = "polkadot-parachain", path = "../../parachain/", default-features = false }
|
||||
parity-codec = { version = "4.1", default-features = false, features = ["derive"] }
|
||||
tiny-keccak = "1.4"
|
||||
tiny-keccak = "1.5.0"
|
||||
dlmalloc = { version = "0.1.3", features = ["global"], optional = true }
|
||||
|
||||
# We need to make sure the global allocator is disabled until we have support of full substrate externalities
|
||||
rstd = { package = "sr-std", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
no_std = [
|
||||
# We need to make sure the global allocator is disabled until we have support of full substrate externalities
|
||||
"rstd/no_global_allocator",
|
||||
"parachain/wasm-api",
|
||||
"dlmalloc",
|
||||
]
|
||||
std = []
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright 2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Substrate 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.
|
||||
|
||||
// Substrate 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 Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSource};
|
||||
|
||||
fn main() {
|
||||
build_current_project_with_rustflags(
|
||||
"wasm_binary.rs",
|
||||
WasmBuilderSource::Crates("1.0.4"),
|
||||
"-C link-arg=--import-memory",
|
||||
);
|
||||
}
|
||||
@@ -18,8 +18,21 @@
|
||||
|
||||
#![no_std]
|
||||
|
||||
#![cfg_attr(feature = "no_std", feature(core_intrinsics, lang_items, core_panic_info, alloc_error_handler))]
|
||||
|
||||
use parity_codec::{Encode, Decode};
|
||||
|
||||
#[cfg(feature = "no_std")]
|
||||
mod wasm_validation;
|
||||
|
||||
#[cfg(feature = "no_std")]
|
||||
#[global_allocator]
|
||||
static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
|
||||
|
||||
// Make the WASM binary available.
|
||||
#[cfg(feature = "std")]
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
/// Head data for this parachain.
|
||||
#[derive(Default, Clone, Hash, Eq, PartialEq, Encode, Decode)]
|
||||
pub struct HeadData {
|
||||
|
||||
+5
-12
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017 Parity Technologies (UK) Ltd.
|
||||
// Copyright 2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot is free software: you can redistribute it and/or modify
|
||||
@@ -16,17 +16,10 @@
|
||||
|
||||
//! WASM validation for adder parachain.
|
||||
|
||||
#![no_std]
|
||||
|
||||
#![feature(core_intrinsics, lang_items, core_panic_info, alloc_error_handler)]
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
|
||||
|
||||
use crate::{HeadData, BlockData};
|
||||
use core::{intrinsics, panic};
|
||||
use parachain::ValidationResult;
|
||||
use parachain::codec::{Encode, Decode};
|
||||
use adder::{HeadData, BlockData};
|
||||
|
||||
#[panic_handler]
|
||||
#[no_mangle]
|
||||
@@ -57,14 +50,14 @@ pub extern fn validate_block(params: *const u8, len: usize) -> usize {
|
||||
|
||||
// we also add based on incoming data from messages. ignoring unknown message
|
||||
// kinds.
|
||||
let from_messages = adder::process_messages(
|
||||
let from_messages = crate::process_messages(
|
||||
params.ingress.iter().map(|incoming| &incoming.data[..])
|
||||
);
|
||||
|
||||
match adder::execute(parent_hash, parent_head, &block_data, from_messages) {
|
||||
match crate::execute(parent_hash, parent_head, &block_data, from_messages) {
|
||||
Ok(new_head) => parachain::wasm_api::write_result(
|
||||
ValidationResult { head_data: new_head.encode() }
|
||||
),
|
||||
Err(_) => panic!("execution failure"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
[package]
|
||||
name = "adder-wasm"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
adder = { path = ".." }
|
||||
parachain = { package = "polkadot-parachain", path = "../../../parachain", default-features = false, features = ["wasm-api"] }
|
||||
tiny-keccak = "1.4"
|
||||
dlmalloc = { version = "0.1.3", features = ["global"] }
|
||||
|
||||
# We need to make sure the global allocator is disabled until we have support of full substrate externalities
|
||||
rstd = { package = "sr-std", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false, features = [ "no_global_allocator" ] }
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
lto = true
|
||||
|
||||
[workspace]
|
||||
Reference in New Issue
Block a user