mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Migrate executor, xinherens, keyring and keystore to 2018 edition (#1585)
This commit is contained in:
committed by
Gav Wood
parent
ecffe0c371
commit
e6839d2d41
@@ -2,16 +2,17 @@
|
|||||||
name = "substrate-executor"
|
name = "substrate-executor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
error-chain = "0.12"
|
error-chain = "0.12"
|
||||||
parity-codec = "3.0"
|
parity-codec = "3.0"
|
||||||
sr-io = { path = "../sr-io" }
|
runtime_io = { package = "sr-io", path = "../sr-io" }
|
||||||
substrate-primitives = { path = "../primitives" }
|
primitives = { package = "substrate-primitives", path = "../primitives" }
|
||||||
substrate-trie = { path = "../trie" }
|
trie = { package = "substrate-trie", path = "../trie" }
|
||||||
substrate-serializer = { path = "../serializer" }
|
serializer = { package = "substrate-serializer", path = "../serializer" }
|
||||||
substrate-state-machine = { path = "../state-machine" }
|
state_machine = { package = "substrate-state-machine", path = "../state-machine" }
|
||||||
sr-version = { path = "../sr-version" }
|
runtime_version = { package = "sr-version", path = "../sr-version" }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
wasmi = { version = "0.4.3" }
|
wasmi = { version = "0.4.3" }
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
use state_machine;
|
use state_machine;
|
||||||
use serializer;
|
use serializer;
|
||||||
use wasmi;
|
use wasmi;
|
||||||
|
use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed,
|
||||||
|
impl_extract_backtrace, impl_error_chain_kind};
|
||||||
|
|
||||||
error_chain! {
|
error_chain! {
|
||||||
foreign_links {
|
foreign_links {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
extern crate fnv;
|
extern crate fnv;
|
||||||
|
|
||||||
use std::vec;
|
use std::vec;
|
||||||
|
use log::trace;
|
||||||
use self::fnv::FnvHashMap;
|
use self::fnv::FnvHashMap;
|
||||||
|
|
||||||
// The pointers need to be aligned to 8 bytes.
|
// The pointers need to be aligned to 8 bytes.
|
||||||
|
|||||||
@@ -28,37 +28,6 @@
|
|||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
#![recursion_limit="128"]
|
#![recursion_limit="128"]
|
||||||
|
|
||||||
extern crate tiny_keccak;
|
|
||||||
extern crate secp256k1;
|
|
||||||
extern crate parity_codec as codec;
|
|
||||||
extern crate sr_io as runtime_io;
|
|
||||||
#[cfg_attr(test, macro_use)]
|
|
||||||
extern crate substrate_primitives as primitives;
|
|
||||||
extern crate substrate_serializer as serializer;
|
|
||||||
extern crate substrate_state_machine as state_machine;
|
|
||||||
extern crate sr_version as runtime_version;
|
|
||||||
extern crate substrate_trie as trie;
|
|
||||||
|
|
||||||
extern crate wasmi;
|
|
||||||
extern crate byteorder;
|
|
||||||
extern crate parking_lot;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate log;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate error_chain;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate assert_matches;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate wabt;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
#[macro_use]
|
|
||||||
extern crate hex_literal;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod wasm_utils;
|
mod wasm_utils;
|
||||||
mod wasm_executor;
|
mod wasm_executor;
|
||||||
@@ -68,11 +37,12 @@ mod sandbox;
|
|||||||
mod heap;
|
mod heap;
|
||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
pub use wasmi;
|
||||||
pub use wasm_executor::WasmExecutor;
|
pub use wasm_executor::WasmExecutor;
|
||||||
pub use native_executor::{with_native_environment, NativeExecutor, NativeExecutionDispatch};
|
pub use native_executor::{with_native_environment, NativeExecutor, NativeExecutionDispatch};
|
||||||
pub use state_machine::Externalities;
|
pub use state_machine::Externalities;
|
||||||
pub use runtime_version::{RuntimeVersion, NativeVersion};
|
pub use runtime_version::{RuntimeVersion, NativeVersion};
|
||||||
pub use codec::Codec;
|
pub use parity_codec::Codec;
|
||||||
use primitives::Blake2Hasher;
|
use primitives::Blake2Hasher;
|
||||||
|
|
||||||
/// Provides runtime information.
|
/// Provides runtime information.
|
||||||
|
|||||||
@@ -16,16 +16,17 @@
|
|||||||
|
|
||||||
use std::borrow::BorrowMut;
|
use std::borrow::BorrowMut;
|
||||||
use std::cell::{RefMut, RefCell};
|
use std::cell::{RefMut, RefCell};
|
||||||
use error::{Error, ErrorKind, Result};
|
use crate::error::{Error, ErrorKind, Result};
|
||||||
use state_machine::{CodeExecutor, Externalities};
|
use state_machine::{CodeExecutor, Externalities};
|
||||||
use wasm_executor::WasmExecutor;
|
use crate::wasm_executor::WasmExecutor;
|
||||||
use wasmi::{Module as WasmModule, ModuleRef as WasmModuleInstanceRef};
|
use wasmi::{Module as WasmModule, ModuleRef as WasmModuleInstanceRef};
|
||||||
use runtime_version::{NativeVersion, RuntimeVersion};
|
use runtime_version::{NativeVersion, RuntimeVersion};
|
||||||
use std::{collections::HashMap, panic::UnwindSafe};
|
use std::{collections::HashMap, panic::UnwindSafe};
|
||||||
use codec::{Decode, Encode};
|
use parity_codec::{Decode, Encode};
|
||||||
use RuntimeInfo;
|
use crate::RuntimeInfo;
|
||||||
use primitives::{Blake2Hasher, NativeOrEncoded};
|
use primitives::{Blake2Hasher, NativeOrEncoded};
|
||||||
use primitives::storage::well_known_keys;
|
use primitives::storage::well_known_keys;
|
||||||
|
use log::trace;
|
||||||
|
|
||||||
/// Default num of pages for the heap
|
/// Default num of pages for the heap
|
||||||
const DEFAULT_HEAP_PAGES: u64 = 1024;
|
const DEFAULT_HEAP_PAGES: u64 = 1024;
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use codec::{Decode, Encode};
|
use parity_codec::{Decode, Encode};
|
||||||
use primitives::sandbox as sandbox_primitives;
|
use primitives::sandbox as sandbox_primitives;
|
||||||
use wasm_utils::UserError;
|
use crate::wasm_utils::UserError;
|
||||||
use wasmi;
|
use wasmi;
|
||||||
use wasmi::memory_units::Pages;
|
use wasmi::memory_units::Pages;
|
||||||
use wasmi::{
|
use wasmi::{
|
||||||
@@ -558,7 +558,7 @@ impl Store {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use primitives::{Blake2Hasher};
|
use primitives::{Blake2Hasher};
|
||||||
use wasm_executor::WasmExecutor;
|
use crate::wasm_executor::WasmExecutor;
|
||||||
use state_machine::TestExternalities;
|
use state_machine::TestExternalities;
|
||||||
use wabt;
|
use wabt;
|
||||||
|
|
||||||
|
|||||||
@@ -26,15 +26,16 @@ use wasmi::{
|
|||||||
use wasmi::RuntimeValue::{I32, I64};
|
use wasmi::RuntimeValue::{I32, I64};
|
||||||
use wasmi::memory_units::{Bytes, Pages};
|
use wasmi::memory_units::{Bytes, Pages};
|
||||||
use state_machine::Externalities;
|
use state_machine::Externalities;
|
||||||
use error::{Error, ErrorKind, Result};
|
use crate::error::{Error, ErrorKind, Result};
|
||||||
use wasm_utils::UserError;
|
use crate::wasm_utils::UserError;
|
||||||
use primitives::{blake2_256, twox_128, twox_256, ed25519};
|
use primitives::{blake2_256, twox_128, twox_256, ed25519};
|
||||||
use primitives::hexdisplay::HexDisplay;
|
use primitives::hexdisplay::HexDisplay;
|
||||||
use primitives::sandbox as sandbox_primitives;
|
use primitives::sandbox as sandbox_primitives;
|
||||||
use primitives::{H256, Blake2Hasher};
|
use primitives::{H256, Blake2Hasher};
|
||||||
use trie::ordered_trie_root;
|
use trie::ordered_trie_root;
|
||||||
use sandbox;
|
use crate::sandbox;
|
||||||
use heap;
|
use crate::heap;
|
||||||
|
use log::trace;
|
||||||
|
|
||||||
#[cfg(feature="wasm-extern-trace")]
|
#[cfg(feature="wasm-extern-trace")]
|
||||||
macro_rules! debug_trace {
|
macro_rules! debug_trace {
|
||||||
@@ -547,7 +548,7 @@ impl_function_executor!(this: FunctionExecutor<'e, E>,
|
|||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
ext_sandbox_invoke(instance_idx: u32, export_ptr: *const u8, export_len: usize, args_ptr: *const u8, args_len: usize, return_val_ptr: *const u8, return_val_len: usize, state: usize) -> u32 => {
|
ext_sandbox_invoke(instance_idx: u32, export_ptr: *const u8, export_len: usize, args_ptr: *const u8, args_len: usize, return_val_ptr: *const u8, return_val_len: usize, state: usize) -> u32 => {
|
||||||
use codec::{Decode, Encode};
|
use parity_codec::{Decode, Encode};
|
||||||
|
|
||||||
trace!(target: "sr-sandbox", "invoke, instance_idx={}", instance_idx);
|
trace!(target: "sr-sandbox", "invoke, instance_idx={}", instance_idx);
|
||||||
let export = this.memory.get(export_ptr, export_len as usize)
|
let export = this.memory.get(export_ptr, export_len as usize)
|
||||||
@@ -751,8 +752,10 @@ impl WasmExecutor {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use codec::Encode;
|
use parity_codec::Encode;
|
||||||
use state_machine::TestExternalities;
|
use state_machine::TestExternalities;
|
||||||
|
use hex_literal::{hex, hex_impl};
|
||||||
|
use primitives::map;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn returning_should_work() {
|
fn returning_should_work() {
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
name = "runtime-test"
|
name = "runtime-test"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sr-io = { path = "../../sr-io", version = "0.1", default-features = false }
|
runtime_io = { package = "sr-io", path = "../../sr-io", version = "0.1", default-features = false }
|
||||||
sr-sandbox = { path = "../../sr-sandbox", version = "0.1", default-features = false }
|
sandbox = { package = "sr-sandbox", path = "../../sr-sandbox", version = "0.1", default-features = false }
|
||||||
substrate-primitives = { path = "../../primitives", default-features = false }
|
substrate-primitives = { path = "../../primitives", default-features = false }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ extern crate alloc;
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use alloc::slice;
|
use alloc::slice;
|
||||||
|
|
||||||
extern crate sr_io as runtime_io;
|
|
||||||
extern crate sr_sandbox as sandbox;
|
|
||||||
extern crate substrate_primitives;
|
|
||||||
|
|
||||||
use runtime_io::{
|
use runtime_io::{
|
||||||
set_storage, storage, clear_prefix, print, blake2_256,
|
set_storage, storage, clear_prefix, print, blake2_256,
|
||||||
twox_128, twox_256, ed25519_verify, enumerated_trie_root
|
twox_128, twox_256, ed25519_verify, enumerated_trie_root
|
||||||
|
|||||||
@@ -32,8 +32,7 @@
|
|||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
extern crate parity_codec as codec;
|
use parity_codec as codec;
|
||||||
|
|
||||||
use parity_codec_derive::{Encode, Decode};
|
use parity_codec_derive::{Encode, Decode};
|
||||||
|
|
||||||
use rstd::{collections::btree_map::{BTreeMap, IntoIter, Entry}, vec::Vec};
|
use rstd::{collections::btree_map::{BTreeMap, IntoIter, Entry}, vec::Vec};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
name = "substrate-keyring"
|
name = "substrate-keyring"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
substrate-primitives = { path = "../primitives" }
|
substrate-primitives = { path = "../primitives" }
|
||||||
|
|||||||
@@ -16,12 +16,10 @@
|
|||||||
|
|
||||||
//! Support code for the runtime. A set of test accounts.
|
//! Support code for the runtime. A set of test accounts.
|
||||||
|
|
||||||
#[macro_use] extern crate hex_literal;
|
|
||||||
#[macro_use] extern crate lazy_static;
|
|
||||||
extern crate substrate_primitives;
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
use hex_literal::{hex, hex_impl};
|
||||||
use substrate_primitives::ed25519::{Pair, Public, Signature};
|
use substrate_primitives::ed25519::{Pair, Public, Signature};
|
||||||
pub use substrate_primitives::ed25519;
|
pub use substrate_primitives::ed25519;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
name = "substrate-keystore"
|
name = "substrate-keystore"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
substrate-primitives = { path = "../primitives" }
|
substrate-primitives = { path = "../primitives" }
|
||||||
parity-crypto = { version = "0.2", default-features = false }
|
crypto = { package = "parity-crypto", version = "0.2", default-features = false }
|
||||||
error-chain = "0.12"
|
error-chain = "0.12"
|
||||||
hex = "0.3"
|
hex = "0.3"
|
||||||
rand = "0.6"
|
rand = "0.6"
|
||||||
|
|||||||
@@ -20,27 +20,15 @@
|
|||||||
// https://github.com/paritytech/substrate/issues/1547
|
// https://github.com/paritytech/substrate/issues/1547
|
||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
extern crate substrate_primitives;
|
|
||||||
extern crate parity_crypto as crypto;
|
|
||||||
extern crate subtle;
|
|
||||||
extern crate rand;
|
|
||||||
extern crate serde_json;
|
|
||||||
extern crate hex;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate serde_derive;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate error_chain;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate tempdir;
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
|
use serde_derive::{Serialize, Deserialize};
|
||||||
|
use error_chain::{error_chain, error_chain_processing, impl_error_chain_processed,
|
||||||
|
impl_extract_backtrace, impl_error_chain_kind};
|
||||||
|
|
||||||
use substrate_primitives::{hashing::blake2_256, ed25519::{Pair, Public, PKCS_LEN}};
|
use substrate_primitives::{hashing::blake2_256, ed25519::{Pair, Public, PKCS_LEN}};
|
||||||
|
|
||||||
pub use crypto::KEY_ITERATIONS;
|
pub use crypto::KEY_ITERATIONS;
|
||||||
|
|||||||
Reference in New Issue
Block a user