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
@@ -28,15 +28,18 @@ macro_rules! convert_args {
macro_rules! gen_signature {
( ( $( $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 ) => (
{
parity_wasm::elements::FunctionType::new(convert_args!($($params),*), vec![{
use $crate::wasm::env_def::ConvertibleToWasm; <$returns>::VALUE_TYPE
}])
pwasm_utils::parity_wasm::elements::FunctionType::new(
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;
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"))]
if module == b"__unstable__" {
return false;
@@ -247,8 +255,7 @@ macro_rules! define_env {
#[cfg(test)]
mod tests {
use parity_wasm::elements::FunctionType;
use parity_wasm::elements::ValueType;
use pwasm_utils::parity_wasm::elements::{FunctionType, ValueType};
use sp_runtime::traits::Zero;
use sp_sandbox::{ReturnValue, Value};
use crate::{
@@ -19,7 +19,7 @@ use super::Runtime;
use crate::exec::Ext;
use sp_sandbox::Value;
use parity_wasm::elements::{FunctionType, ValueType};
use pwasm_utils::parity_wasm::elements::{FunctionType, ValueType};
#[macro_use]
pub mod macros;
@@ -24,7 +24,7 @@ use crate::{
chain_extension::ChainExtension,
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_std::prelude::*;
@@ -105,7 +105,7 @@ impl<'a, T: Config> ContractModule<'a, T> {
return Ok(());
};
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 table.table.len() > limit as usize {
return Err("BrTable's immediate value is too big.")
@@ -484,7 +484,7 @@ pub fn reinstrument_contract<T: Config>(
#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking {
use super::*;
use parity_wasm::elements::FunctionType;
use super::elements::FunctionType;
impl ImportSatisfyCheck for () {
fn can_satisfy(_module: &[u8], _name: &[u8], _func_type: &FunctionType) -> bool {
@@ -24,7 +24,7 @@ use crate::{
wasm::env_def::ConvertibleToWasm,
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 sp_std::prelude::*;
use codec::{Decode, DecodeAll, Encode};