mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 22:11:06 +00:00
Bump parity-wasm and pwasm-utils to the newest versions everywhere (#8928)
This commit is contained in:
committed by
GitHub
parent
bf9837499a
commit
61859bbdb1
@@ -15,8 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
log = { version = "0.4", default-features = false }
|
||||
parity-wasm = { version = "0.42", default-features = false }
|
||||
pwasm-utils = { version = "0.17", default-features = false }
|
||||
pwasm-utils = { version = "0.18", default-features = false }
|
||||
serde = { version = "1", optional = true, features = ["derive"] }
|
||||
smallvec = { version = "1", default-features = false, features = ["const_generics"] }
|
||||
wasmi-validation = { version = "0.4", default-features = false }
|
||||
@@ -61,7 +60,6 @@ std = [
|
||||
"sp-sandbox/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"parity-wasm/std",
|
||||
"pwasm-utils/std",
|
||||
"wasmi-validation/std",
|
||||
"pallet-contracts-primitives/std",
|
||||
|
||||
@@ -25,10 +25,16 @@
|
||||
//! compiles it down into a `WasmModule` that can be used as a contract's code.
|
||||
|
||||
use crate::Config;
|
||||
use parity_wasm::elements::{
|
||||
Instruction, Instructions, FuncBody, ValueType, BlockType, Section, CustomSection,
|
||||
use pwasm_utils::{
|
||||
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_runtime::traits::Hash;
|
||||
use sp_sandbox::{EnvironmentDefinitionBuilder, Memory};
|
||||
@@ -127,7 +133,7 @@ where
|
||||
let func_offset = u32::try_from(def.imported_functions.len()).unwrap();
|
||||
|
||||
// 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)
|
||||
.function()
|
||||
.signature().build()
|
||||
@@ -166,7 +172,7 @@ where
|
||||
|
||||
// Import supervisor functions. They start with idx 0.
|
||||
for func in def.imported_functions {
|
||||
let sig = parity_wasm::builder::signature()
|
||||
let sig = builder::signature()
|
||||
.with_params(func.params)
|
||||
.with_results(func.return_type.into_iter().collect())
|
||||
.build_sig();
|
||||
@@ -174,7 +180,7 @@ where
|
||||
contract = contract.import()
|
||||
.module(func.module)
|
||||
.field(func.name)
|
||||
.with_external(parity_wasm::elements::External::Function(sig))
|
||||
.with_external(elements::External::Function(sig))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -264,7 +270,7 @@ where
|
||||
/// `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.
|
||||
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.
|
||||
// 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
|
||||
@@ -496,7 +502,7 @@ pub mod body {
|
||||
|
||||
/// Replace the locals of the supplied `body` with `num` i64 locals.
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ use self::{
|
||||
use codec::Encode;
|
||||
use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark_test_suite};
|
||||
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_std::{default::Default, convert::{TryInto}, vec::Vec, vec};
|
||||
use pallet_contracts_primitives::RentProjection;
|
||||
@@ -1934,7 +1934,7 @@ benchmarks! {
|
||||
// 1 * w_param + 0.5 * 2 * w_param + 0.25 * 4 * w_param
|
||||
instr_br_table {
|
||||
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]),
|
||||
default: 1,
|
||||
});
|
||||
@@ -1968,7 +1968,7 @@ benchmarks! {
|
||||
.cloned()
|
||||
.cycle()
|
||||
.take((e / 2) as usize).collect();
|
||||
let table = Box::new(parity_wasm::elements::BrTableData {
|
||||
let table = Box::new(BrTableData {
|
||||
table: entry.into_boxed_slice(),
|
||||
default: 0,
|
||||
});
|
||||
|
||||
@@ -26,8 +26,7 @@ use pallet_contracts_proc_macro::{ScheduleDebug, WeightDebug};
|
||||
use frame_support::{DefaultNoBound, weights::Weight};
|
||||
use sp_std::{marker::PhantomData, vec::Vec};
|
||||
use codec::{Encode, Decode};
|
||||
use parity_wasm::elements;
|
||||
use pwasm_utils::rules;
|
||||
use pwasm_utils::{parity_wasm::elements, rules};
|
||||
use sp_runtime::RuntimeDebug;
|
||||
|
||||
/// 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> {
|
||||
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 max_params = self.schedule.limits.parameters;
|
||||
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user