Update dependencies of pallet_contracts (#8637)

* Update parity-wasm

* Cleanup Cargo.toml files

- Sort dependencies
- Remove minor and fix version where they are not necessary

* Update pretty_assertions

* Update rand
This commit is contained in:
Alexander Theißen
2021-04-19 12:47:46 +02:00
committed by GitHub
parent ea10494ca9
commit 18000a9ae8
9 changed files with 126 additions and 77 deletions
@@ -28,15 +28,15 @@ macro_rules! convert_args {
macro_rules! gen_signature {
( ( $( $params: ty ),* ) ) => (
{
parity_wasm::elements::FunctionType::new(convert_args!($($params),*), None)
parity_wasm::elements::FunctionType::new(convert_args!($($params),*), vec![])
}
);
( ( $( $params: ty ),* ) -> $returns: ty ) => (
{
parity_wasm::elements::FunctionType::new(convert_args!($($params),*), Some({
parity_wasm::elements::FunctionType::new(convert_args!($($params),*), vec![{
use $crate::wasm::env_def::ConvertibleToWasm; <$returns>::VALUE_TYPE
}))
}])
}
);
}
@@ -301,12 +301,12 @@ mod tests {
fn macro_gen_signature() {
assert_eq!(
gen_signature!((i32)),
FunctionType::new(vec![ValueType::I32], None),
FunctionType::new(vec![ValueType::I32], vec![]),
);
assert_eq!(
gen_signature!( (i32, u32) -> u32 ),
FunctionType::new(vec![ValueType::I32, ValueType::I32], Some(ValueType::I32)),
FunctionType::new(vec![ValueType::I32, ValueType::I32], vec![ValueType::I32]),
);
}
@@ -348,10 +348,10 @@ mod tests {
);
assert!(
Env::can_satisfy(b"seal0", b"seal_gas",&FunctionType::new(vec![ValueType::I32], None))
Env::can_satisfy(b"seal0", b"seal_gas",&FunctionType::new(vec![ValueType::I32], vec![]))
);
assert!(
!Env::can_satisfy(b"seal0", b"not_exists", &FunctionType::new(vec![], None))
!Env::can_satisfy(b"seal0", b"not_exists", &FunctionType::new(vec![], vec![]))
);
}
}
@@ -152,8 +152,8 @@ impl<'a, T: Config> ContractModule<'a, T> {
for wasm_type in type_section.types() {
match wasm_type {
Type::Function(func_type) => {
let return_type = func_type.return_type();
for value_type in func_type.params().iter().chain(return_type.iter()) {
let return_type = func_type.results().get(0);
for value_type in func_type.params().iter().chain(return_type) {
match value_type {
ValueType::F32 | ValueType::F64 =>
return Err("use of floating point type in function types is forbidden"),
@@ -279,9 +279,7 @@ impl<'a, T: Config> ContractModule<'a, T> {
let Type::Function(ref func_ty) = types
.get(func_ty_idx as usize)
.ok_or_else(|| "function has a non-existent type")?;
if !func_ty.params().is_empty() ||
!(func_ty.return_type().is_none() ||
func_ty.return_type() == Some(ValueType::I32)) {
if !(func_ty.params().is_empty() && func_ty.results().is_empty()) {
return Err("entry point has wrong signature");
}
}