Bump parity-wasm and pwasm-utils to the newest versions everywhere (#8928)

This commit is contained in:
Alexander Theißen
2021-05-28 13:06:16 +02:00
committed by GitHub
parent bf9837499a
commit 61859bbdb1
18 changed files with 78 additions and 88 deletions
+18 -40
View File
@@ -1431,6 +1431,12 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "downcast-rs"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]] [[package]]
name = "dyn-clonable" name = "dyn-clonable"
version = "0.9.0" version = "0.9.0"
@@ -4797,10 +4803,9 @@ dependencies = [
"pallet-randomness-collective-flip", "pallet-randomness-collective-flip",
"pallet-timestamp", "pallet-timestamp",
"parity-scale-codec", "parity-scale-codec",
"parity-wasm 0.42.2",
"paste 1.0.4", "paste 1.0.4",
"pretty_assertions 0.7.2", "pretty_assertions 0.7.2",
"pwasm-utils 0.17.0", "pwasm-utils",
"rand 0.8.3", "rand 0.8.3",
"rand_pcg 0.3.0", "rand_pcg 0.3.0",
"serde", "serde",
@@ -4810,7 +4815,7 @@ dependencies = [
"sp-runtime", "sp-runtime",
"sp-sandbox", "sp-sandbox",
"sp-std", "sp-std",
"wasmi-validation 0.4.0", "wasmi-validation",
"wat", "wat",
] ]
@@ -5723,12 +5728,6 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "parity-wasm"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865"
[[package]] [[package]]
name = "parity-wasm" name = "parity-wasm"
version = "0.42.2" version = "0.42.2"
@@ -6295,20 +6294,9 @@ dependencies = [
[[package]] [[package]]
name = "pwasm-utils" name = "pwasm-utils"
version = "0.14.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f53bc2558e8376358ebdc28301546471d67336584f6438ed4b7c7457a055fd7" checksum = "a0e517f47d9964362883182404b68d0b6949382c0baa40aa5ffca94f5f1e3481"
dependencies = [
"byteorder",
"log",
"parity-wasm 0.41.0",
]
[[package]]
name = "pwasm-utils"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51992bc74c0f34f759ff97fb303602e60343afc83693769c91aa17724442809e"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"log", "log",
@@ -7346,7 +7334,7 @@ dependencies = [
"libsecp256k1", "libsecp256k1",
"log", "log",
"parity-scale-codec", "parity-scale-codec",
"parity-wasm 0.41.0", "parity-wasm 0.42.2",
"parking_lot 0.11.1", "parking_lot 0.11.1",
"paste 1.0.4", "paste 1.0.4",
"sc-executor-common", "sc-executor-common",
@@ -7381,8 +7369,7 @@ version = "0.9.0"
dependencies = [ dependencies = [
"derive_more", "derive_more",
"parity-scale-codec", "parity-scale-codec",
"parity-wasm 0.41.0", "pwasm-utils",
"pwasm-utils 0.14.0",
"sp-allocator", "sp-allocator",
"sp-core", "sp-core",
"sp-maybe-compressed-blob", "sp-maybe-compressed-blob",
@@ -7413,8 +7400,7 @@ dependencies = [
"assert_matches", "assert_matches",
"log", "log",
"parity-scale-codec", "parity-scale-codec",
"parity-wasm 0.41.0", "parity-wasm 0.42.2",
"pwasm-utils 0.14.0",
"sc-executor-common", "sc-executor-common",
"scoped-tls", "scoped-tls",
"sp-allocator", "sp-allocator",
@@ -10856,26 +10842,18 @@ dependencies = [
[[package]] [[package]]
name = "wasmi" name = "wasmi"
version = "0.6.2" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" checksum = "d2ee05bba3d1d994652079893941a2ef9324d2b58a63c31b40678fb7eddd7a5a"
dependencies = [ dependencies = [
"downcast-rs",
"errno", "errno",
"libc", "libc",
"memory_units", "memory_units",
"num-rational", "num-rational",
"num-traits", "num-traits",
"parity-wasm 0.41.0", "parity-wasm 0.42.2",
"wasmi-validation 0.3.0", "wasmi-validation",
]
[[package]]
name = "wasmi-validation"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93"
dependencies = [
"parity-wasm 0.41.0",
] ]
[[package]] [[package]]
+2 -2
View File
@@ -23,8 +23,8 @@ sp-trie = { version = "3.0.0", path = "../../primitives/trie" }
sp-serializer = { version = "3.0.0", path = "../../primitives/serializer" } sp-serializer = { version = "3.0.0", path = "../../primitives/serializer" }
sp-version = { version = "3.0.0", path = "../../primitives/version" } sp-version = { version = "3.0.0", path = "../../primitives/version" }
sp-panic-handler = { version = "3.0.0", path = "../../primitives/panic-handler" } sp-panic-handler = { version = "3.0.0", path = "../../primitives/panic-handler" }
wasmi = "0.6.2" wasmi = "0.9.0"
parity-wasm = "0.41.0" parity-wasm = "0.42.0"
lazy_static = "1.4.0" lazy_static = "1.4.0"
sp-api = { version = "3.0.0", path = "../../primitives/api" } sp-api = { version = "3.0.0", path = "../../primitives/api" }
sp-wasm-interface = { version = "3.0.0", path = "../../primitives/wasm-interface" } sp-wasm-interface = { version = "3.0.0", path = "../../primitives/wasm-interface" }
+2 -3
View File
@@ -15,10 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
derive_more = "0.99.2" derive_more = "0.99.2"
parity-wasm = "0.41.0" pwasm-utils = "0.18.0"
pwasm-utils = "0.14.0"
codec = { package = "parity-scale-codec", version = "2.0.0" } codec = { package = "parity-scale-codec", version = "2.0.0" }
wasmi = "0.6.2" wasmi = "0.9.0"
sp-core = { version = "3.0.0", path = "../../../primitives/core" } sp-core = { version = "3.0.0", path = "../../../primitives/core" }
sp-allocator = { version = "3.0.0", path = "../../../primitives/allocator" } sp-allocator = { version = "3.0.0", path = "../../../primitives/allocator" }
sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" } sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" }
@@ -19,7 +19,7 @@
use crate::error::{self, Error}; use crate::error::{self, Error};
use super::RuntimeBlob; use super::RuntimeBlob;
use std::mem; use std::mem;
use parity_wasm::elements::Instruction; use pwasm_utils::parity_wasm::elements::Instruction;
/// This is a snapshot of data segments specialzied for a particular instantiation. /// This is a snapshot of data segments specialzied for a particular instantiation.
/// ///
@@ -16,14 +16,18 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use parity_wasm::elements::{DataSegment, Module as RawModule, deserialize_buffer, serialize}; use pwasm_utils::{
parity_wasm::elements::{
DataSegment, Module, deserialize_buffer, serialize, Internal,
},
export_mutable_globals,
};
use crate::error::WasmError; use crate::error::WasmError;
/// A bunch of information collected from a WebAssembly module. /// A bunch of information collected from a WebAssembly module.
#[derive(Clone)] #[derive(Clone)]
pub struct RuntimeBlob { pub struct RuntimeBlob {
raw_module: RawModule, raw_module: Module,
} }
impl RuntimeBlob { impl RuntimeBlob {
@@ -42,7 +46,7 @@ impl RuntimeBlob {
/// ///
/// Returns `Err` if the wasm code cannot be deserialized. /// Returns `Err` if the wasm code cannot be deserialized.
pub fn new(wasm_code: &[u8]) -> Result<Self, WasmError> { pub fn new(wasm_code: &[u8]) -> Result<Self, WasmError> {
let raw_module: RawModule = deserialize_buffer(wasm_code) let raw_module: Module = deserialize_buffer(wasm_code)
.map_err(|e| WasmError::Other(format!("cannot deserialize module: {:?}", e)))?; .map_err(|e| WasmError::Other(format!("cannot deserialize module: {:?}", e)))?;
Ok(Self { raw_module }) Ok(Self { raw_module })
} }
@@ -74,7 +78,7 @@ impl RuntimeBlob {
/// Perform an instrumentation that makes sure that the mutable globals are exported. /// Perform an instrumentation that makes sure that the mutable globals are exported.
pub fn expose_mutable_globals(&mut self) { pub fn expose_mutable_globals(&mut self) {
pwasm_utils::export_mutable_globals(&mut self.raw_module, "exported_internal_global"); export_mutable_globals(&mut self.raw_module, "exported_internal_global");
} }
/// Returns an iterator of all globals which were exported by [`expose_mutable_globals`]. /// Returns an iterator of all globals which were exported by [`expose_mutable_globals`].
@@ -87,7 +91,7 @@ impl RuntimeBlob {
.map(|es| es.entries()) .map(|es| es.entries())
.unwrap_or(&[]); .unwrap_or(&[]);
exports.iter().filter_map(|export| match export.internal() { exports.iter().filter_map(|export| match export.internal() {
parity_wasm::elements::Internal::Global(_) Internal::Global(_)
if export.field().starts_with("exported_internal_global") => if export.field().starts_with("exported_internal_global") =>
{ {
Some(export.field()) Some(export.field())
@@ -112,7 +116,7 @@ impl RuntimeBlob {
} }
/// Destructure this structure into the underlying parity-wasm Module. /// Destructure this structure into the underlying parity-wasm Module.
pub fn into_inner(self) -> RawModule { pub fn into_inner(self) -> Module {
self.raw_module self.raw_module
} }
} }
+1 -1
View File
@@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
log = "0.4.8" log = "0.4.8"
wasmi = "0.6.2" wasmi = "0.9.0"
codec = { package = "parity-scale-codec", version = "2.0.0" } codec = { package = "parity-scale-codec", version = "2.0.0" }
sc-executor-common = { version = "0.9.0", path = "../common" } sc-executor-common = { version = "0.9.0", path = "../common" }
sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" } sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" }
@@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
log = "0.4.8" log = "0.4.8"
scoped-tls = "1.0" scoped-tls = "1.0"
parity-wasm = "0.41.0" parity-wasm = "0.42.0"
codec = { package = "parity-scale-codec", version = "2.0.0" } codec = { package = "parity-scale-codec", version = "2.0.0" }
sc-executor-common = { version = "0.9.0", path = "../common" } sc-executor-common = { version = "0.9.0", path = "../common" }
sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" } sp-wasm-interface = { version = "3.0.0", path = "../../../primitives/wasm-interface" }
@@ -23,7 +23,6 @@ sp-runtime-interface = { version = "3.0.0", path = "../../../primitives/runtime-
sp-core = { version = "3.0.0", path = "../../../primitives/core" } sp-core = { version = "3.0.0", path = "../../../primitives/core" }
sp-allocator = { version = "3.0.0", path = "../../../primitives/allocator" } sp-allocator = { version = "3.0.0", path = "../../../primitives/allocator" }
wasmtime = "0.24.0" wasmtime = "0.24.0"
pwasm-utils = "0.14.0"
[dev-dependencies] [dev-dependencies]
assert_matches = "1.3.0" assert_matches = "1.3.0"
+1 -3
View File
@@ -15,8 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4", default-features = false } log = { version = "0.4", default-features = false }
parity-wasm = { version = "0.42", default-features = false } pwasm-utils = { version = "0.18", default-features = false }
pwasm-utils = { version = "0.17", default-features = false }
serde = { version = "1", optional = true, features = ["derive"] } serde = { version = "1", optional = true, features = ["derive"] }
smallvec = { version = "1", default-features = false, features = ["const_generics"] } smallvec = { version = "1", default-features = false, features = ["const_generics"] }
wasmi-validation = { version = "0.4", default-features = false } wasmi-validation = { version = "0.4", default-features = false }
@@ -61,7 +60,6 @@ std = [
"sp-sandbox/std", "sp-sandbox/std",
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"parity-wasm/std",
"pwasm-utils/std", "pwasm-utils/std",
"wasmi-validation/std", "wasmi-validation/std",
"pallet-contracts-primitives/std", "pallet-contracts-primitives/std",
@@ -25,10 +25,16 @@
//! compiles it down into a `WasmModule` that can be used as a contract's code. //! compiles it down into a `WasmModule` that can be used as a contract's code.
use crate::Config; use crate::Config;
use parity_wasm::elements::{ use pwasm_utils::{
Instruction, Instructions, FuncBody, ValueType, BlockType, Section, CustomSection, stack_height::inject_limiter,
parity_wasm::{
elements::{
self, Instruction, Instructions, FuncBody, ValueType, BlockType, Section,
CustomSection,
},
builder,
},
}; };
use pwasm_utils::stack_height::inject_limiter;
use sp_core::crypto::UncheckedFrom; use sp_core::crypto::UncheckedFrom;
use sp_runtime::traits::Hash; use sp_runtime::traits::Hash;
use sp_sandbox::{EnvironmentDefinitionBuilder, Memory}; use sp_sandbox::{EnvironmentDefinitionBuilder, Memory};
@@ -127,7 +133,7 @@ where
let func_offset = u32::try_from(def.imported_functions.len()).unwrap(); let func_offset = u32::try_from(def.imported_functions.len()).unwrap();
// Every contract must export "deploy" and "call" functions // Every contract must export "deploy" and "call" functions
let mut contract = parity_wasm::builder::module() let mut contract = builder::module()
// deploy function (first internal function) // deploy function (first internal function)
.function() .function()
.signature().build() .signature().build()
@@ -166,7 +172,7 @@ where
// Import supervisor functions. They start with idx 0. // Import supervisor functions. They start with idx 0.
for func in def.imported_functions { for func in def.imported_functions {
let sig = parity_wasm::builder::signature() let sig = builder::signature()
.with_params(func.params) .with_params(func.params)
.with_results(func.return_type.into_iter().collect()) .with_results(func.return_type.into_iter().collect())
.build_sig(); .build_sig();
@@ -174,7 +180,7 @@ where
contract = contract.import() contract = contract.import()
.module(func.module) .module(func.module)
.field(func.name) .field(func.name)
.with_external(parity_wasm::elements::External::Function(sig)) .with_external(elements::External::Function(sig))
.build(); .build();
} }
@@ -264,7 +270,7 @@ where
/// `instantiate_with_code` for different sizes of wasm modules. The generated module maximizes /// `instantiate_with_code` for different sizes of wasm modules. The generated module maximizes
/// instrumentation runtime by nesting blocks as deeply as possible given the byte budget. /// instrumentation runtime by nesting blocks as deeply as possible given the byte budget.
pub fn sized(target_bytes: u32) -> Self { pub fn sized(target_bytes: u32) -> Self {
use parity_wasm::elements::Instruction::{If, I32Const, Return, End}; use self::elements::Instruction::{If, I32Const, Return, End};
// Base size of a contract is 63 bytes and each expansion adds 6 bytes. // Base size of a contract is 63 bytes and each expansion adds 6 bytes.
// We do one expansion less to account for the code section and function body // We do one expansion less to account for the code section and function body
// size fields inside the binary wasm module representation which are leb128 encoded // size fields inside the binary wasm module representation which are leb128 encoded
@@ -496,7 +502,7 @@ pub mod body {
/// Replace the locals of the supplied `body` with `num` i64 locals. /// Replace the locals of the supplied `body` with `num` i64 locals.
pub fn inject_locals(body: &mut FuncBody, num: u32) { pub fn inject_locals(body: &mut FuncBody, num: u32) {
use parity_wasm::elements::Local; use self::elements::Local;
*body.locals_mut() = (0..num).map(|i| Local::new(i, ValueType::I64)).collect() *body.locals_mut() = (0..num).map(|i| Local::new(i, ValueType::I64)).collect()
} }
} }
@@ -39,7 +39,7 @@ use self::{
use codec::Encode; use codec::Encode;
use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark_test_suite}; use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark_test_suite};
use frame_system::{Pallet as System, RawOrigin}; use frame_system::{Pallet as System, RawOrigin};
use parity_wasm::elements::{Instruction, ValueType, BlockType}; use pwasm_utils::parity_wasm::elements::{Instruction, ValueType, BlockType, BrTableData};
use sp_runtime::traits::{Hash, Bounded, Zero}; use sp_runtime::traits::{Hash, Bounded, Zero};
use sp_std::{default::Default, convert::{TryInto}, vec::Vec, vec}; use sp_std::{default::Default, convert::{TryInto}, vec::Vec, vec};
use pallet_contracts_primitives::RentProjection; use pallet_contracts_primitives::RentProjection;
@@ -1934,7 +1934,7 @@ benchmarks! {
// 1 * w_param + 0.5 * 2 * w_param + 0.25 * 4 * w_param // 1 * w_param + 0.5 * 2 * w_param + 0.25 * 4 * w_param
instr_br_table { instr_br_table {
let r in 0 .. INSTR_BENCHMARK_BATCHES; let r in 0 .. INSTR_BENCHMARK_BATCHES;
let table = Box::new(parity_wasm::elements::BrTableData { let table = Box::new(BrTableData {
table: Box::new([0, 1, 2]), table: Box::new([0, 1, 2]),
default: 1, default: 1,
}); });
@@ -1968,7 +1968,7 @@ benchmarks! {
.cloned() .cloned()
.cycle() .cycle()
.take((e / 2) as usize).collect(); .take((e / 2) as usize).collect();
let table = Box::new(parity_wasm::elements::BrTableData { let table = Box::new(BrTableData {
table: entry.into_boxed_slice(), table: entry.into_boxed_slice(),
default: 0, default: 0,
}); });
+2 -3
View File
@@ -26,8 +26,7 @@ use pallet_contracts_proc_macro::{ScheduleDebug, WeightDebug};
use frame_support::{DefaultNoBound, weights::Weight}; use frame_support::{DefaultNoBound, weights::Weight};
use sp_std::{marker::PhantomData, vec::Vec}; use sp_std::{marker::PhantomData, vec::Vec};
use codec::{Encode, Decode}; use codec::{Encode, Decode};
use parity_wasm::elements; use pwasm_utils::{parity_wasm::elements, rules};
use pwasm_utils::rules;
use sp_runtime::RuntimeDebug; use sp_runtime::RuntimeDebug;
/// How many API calls are executed in a single batch. The reason for increasing the amount /// How many API calls are executed in a single batch. The reason for increasing the amount
@@ -635,7 +634,7 @@ impl<T: Config> Schedule<T> {
impl<'a, T: Config> rules::Rules for ScheduleRules<'a, T> { impl<'a, T: Config> rules::Rules for ScheduleRules<'a, T> {
fn instruction_cost(&self, instruction: &elements::Instruction) -> Option<u32> { fn instruction_cost(&self, instruction: &elements::Instruction) -> Option<u32> {
use parity_wasm::elements::Instruction::*; use self::elements::Instruction::*;
let w = &self.schedule.instruction_weights; let w = &self.schedule.instruction_weights;
let max_params = self.schedule.limits.parameters; let max_params = self.schedule.limits.parameters;
@@ -28,15 +28,18 @@ macro_rules! convert_args {
macro_rules! gen_signature { macro_rules! gen_signature {
( ( $( $params: ty ),* ) ) => ( ( ( $( $params: ty ),* ) ) => (
{ {
parity_wasm::elements::FunctionType::new(convert_args!($($params),*), vec![]) pwasm_utils::parity_wasm::elements::FunctionType::new(
convert_args!($($params),*), vec![],
)
} }
); );
( ( $( $params: ty ),* ) -> $returns: ty ) => ( ( ( $( $params: ty ),* ) -> $returns: ty ) => (
{ {
parity_wasm::elements::FunctionType::new(convert_args!($($params),*), vec![{ pwasm_utils::parity_wasm::elements::FunctionType::new(
use $crate::wasm::env_def::ConvertibleToWasm; <$returns>::VALUE_TYPE convert_args!($($params),*),
}]) vec![{use $crate::wasm::env_def::ConvertibleToWasm; <$returns>::VALUE_TYPE}],
)
} }
); );
} }
@@ -214,7 +217,12 @@ macro_rules! define_env {
pub struct $init_name; pub struct $init_name;
impl $crate::wasm::env_def::ImportSatisfyCheck for $init_name { impl $crate::wasm::env_def::ImportSatisfyCheck for $init_name {
fn can_satisfy(module: &[u8], name: &[u8], func_type: &parity_wasm::elements::FunctionType) -> bool { fn can_satisfy(
module: &[u8],
name: &[u8],
func_type: &pwasm_utils::parity_wasm::elements::FunctionType,
) -> bool
{
#[cfg(not(feature = "unstable-interface"))] #[cfg(not(feature = "unstable-interface"))]
if module == b"__unstable__" { if module == b"__unstable__" {
return false; return false;
@@ -247,8 +255,7 @@ macro_rules! define_env {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use parity_wasm::elements::FunctionType; use pwasm_utils::parity_wasm::elements::{FunctionType, ValueType};
use parity_wasm::elements::ValueType;
use sp_runtime::traits::Zero; use sp_runtime::traits::Zero;
use sp_sandbox::{ReturnValue, Value}; use sp_sandbox::{ReturnValue, Value};
use crate::{ use crate::{
@@ -19,7 +19,7 @@ use super::Runtime;
use crate::exec::Ext; use crate::exec::Ext;
use sp_sandbox::Value; use sp_sandbox::Value;
use parity_wasm::elements::{FunctionType, ValueType}; use pwasm_utils::parity_wasm::elements::{FunctionType, ValueType};
#[macro_use] #[macro_use]
pub mod macros; pub mod macros;
@@ -24,7 +24,7 @@ use crate::{
chain_extension::ChainExtension, chain_extension::ChainExtension,
wasm::{PrefabWasmModule, env_def::ImportSatisfyCheck}, wasm::{PrefabWasmModule, env_def::ImportSatisfyCheck},
}; };
use parity_wasm::elements::{self, Internal, External, MemoryType, Type, ValueType}; use pwasm_utils::parity_wasm::elements::{self, Internal, External, MemoryType, Type, ValueType};
use sp_runtime::traits::Hash; use sp_runtime::traits::Hash;
use sp_std::prelude::*; use sp_std::prelude::*;
@@ -105,7 +105,7 @@ impl<'a, T: Config> ContractModule<'a, T> {
return Ok(()); return Ok(());
}; };
for instr in code_section.bodies().iter().flat_map(|body| body.code().elements()) { for instr in code_section.bodies().iter().flat_map(|body| body.code().elements()) {
use parity_wasm::elements::Instruction::BrTable; use self::elements::Instruction::BrTable;
if let BrTable(table) = instr { if let BrTable(table) = instr {
if table.table.len() > limit as usize { if table.table.len() > limit as usize {
return Err("BrTable's immediate value is too big.") return Err("BrTable's immediate value is too big.")
@@ -484,7 +484,7 @@ pub fn reinstrument_contract<T: Config>(
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking { pub mod benchmarking {
use super::*; use super::*;
use parity_wasm::elements::FunctionType; use super::elements::FunctionType;
impl ImportSatisfyCheck for () { impl ImportSatisfyCheck for () {
fn can_satisfy(_module: &[u8], _name: &[u8], _func_type: &FunctionType) -> bool { fn can_satisfy(_module: &[u8], _name: &[u8], _func_type: &FunctionType) -> bool {
@@ -24,7 +24,7 @@ use crate::{
wasm::env_def::ConvertibleToWasm, wasm::env_def::ConvertibleToWasm,
schedule::HostFnWeights, schedule::HostFnWeights,
}; };
use parity_wasm::elements::ValueType; use pwasm_utils::parity_wasm::elements::ValueType;
use frame_support::{dispatch::DispatchError, ensure, traits::Get, weights::Weight}; use frame_support::{dispatch::DispatchError, ensure, traits::Get, weights::Weight};
use sp_std::prelude::*; use sp_std::prelude::*;
use codec::{Decode, DecodeAll, Encode}; use codec::{Decode, DecodeAll, Encode};
+1 -1
View File
@@ -20,7 +20,7 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] }
byteorder = { version = "1.3.2", default-features = false } byteorder = { version = "1.3.2", default-features = false }
primitive-types = { version = "0.9.0", default-features = false, features = ["codec"] } primitive-types = { version = "0.9.0", default-features = false, features = ["codec"] }
impl-serde = { version = "0.3.0", optional = true } impl-serde = { version = "0.3.0", optional = true }
wasmi = { version = "0.6.2", optional = true } wasmi = { version = "0.9.0", optional = true }
hash-db = { version = "0.15.2", default-features = false } hash-db = { version = "0.15.2", default-features = false }
hash256-std-hasher = { version = "0.15.2", default-features = false } hash256-std-hasher = { version = "0.15.2", default-features = false }
base58 = { version = "0.1.0", optional = true } base58 = { version = "0.1.0", optional = true }
+1 -1
View File
@@ -13,7 +13,7 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
wasmi = { version = "0.6.2", optional = true } wasmi = { version = "0.9.0", optional = true }
sp-core = { version = "3.0.0", default-features = false, path = "../core" } sp-core = { version = "3.0.0", default-features = false, path = "../core" }
sp-std = { version = "3.0.0", default-features = false, path = "../std" } sp-std = { version = "3.0.0", default-features = false, path = "../std" }
sp-io = { version = "3.0.0", default-features = false, path = "../io" } sp-io = { version = "3.0.0", default-features = false, path = "../io" }
@@ -14,7 +14,7 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
wasmi = { version = "0.6.2", optional = true } wasmi = { version = "0.9.0", optional = true }
impl-trait-for-tuples = "0.2.1" impl-trait-for-tuples = "0.2.1"
sp-std = { version = "3.0.0", path = "../std", default-features = false } sp-std = { version = "3.0.0", path = "../std", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }