Unverified Commit 353a840d authored by Michael Müller's avatar Michael Müller Committed by GitHub
Browse files

Fix build warnings + clippy errors from latest nightly (#686)

* Fix build warning

* Fix `warn(clippy::redundant_slicing)`

* Remove unnecessary feature

* Reduce amount of ci fuzz tests, since it times out sometimes

* Apply rustfmt

* Revert "Remove unnecessary feature"

This reverts commit fdad2e89.

* Revert "Fix build warning"

This reverts commit 00ea9038.

* Fix build warning

* Revert me: Hotfix for funty issue

* Remove unstable `panic_any`

* Fix use
parent 8228bf0d
Pipeline #124808 canceled with stages
in 3 minutes and 54 seconds
......@@ -330,7 +330,7 @@ fuzz-tests:
<<: *docker-env
variables:
# The QUICKCHECK_TESTS default is 100
QUICKCHECK_TESTS: 50000
QUICKCHECK_TESTS: 40000
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
......
......@@ -40,6 +40,9 @@ blake2 = { version = "0.9", optional = true }
rand = { version = "0.8", default-features = false, features = ["alloc"], optional = true }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[features]
default = ["std"]
std = [
......
......@@ -269,7 +269,7 @@ where
self.func_id,
input,
ErrorCode::from_status_code,
|output| scale::Decode::decode(&mut &output[..]).map_err(Into::into),
|mut output| scale::Decode::decode(&mut output).map_err(Into::into),
)
})
}
......@@ -323,7 +323,7 @@ where
self.func_id,
input,
|_status_code| Ok(()),
|output| scale::Decode::decode(&mut &output[..]).map_err(Into::into),
|mut output| scale::Decode::decode(&mut output).map_err(Into::into),
)
})
}
......@@ -380,8 +380,8 @@ where
self.func_id,
input,
ErrorCode::from_status_code,
|output| {
let decoded = <O as scale::Decode>::decode(&mut &output[..])
|mut output| {
let decoded = <O as scale::Decode>::decode(&mut output)
.expect("encountered error while decoding chain extension method call return value");
Ok(decoded)
},
......@@ -429,8 +429,8 @@ where
self.func_id,
input,
|_status_code| Ok(()),
|output| {
let decoded = <O as scale::Decode>::decode(&mut &output[..])
|mut output| {
let decoded = <O as scale::Decode>::decode(&mut output)
.expect("encountered error while decoding chain extension method call return value");
Ok(decoded)
},
......
......@@ -205,12 +205,12 @@ impl EnvBackend for EnvInstance {
D: FnOnce(&[u8]) -> ::core::result::Result<T, E>,
{
let encoded_input = input.encode();
let (status_code, output) = self
let (status_code, mut output) = self
.chain_extension_handler
.eval(func_id, &encoded_input)
.expect("encountered unexpected missing chain extension method");
status_to_result(status_code)?;
let decoded = decode_to_result(&mut &output[..])?;
let decoded = decode_to_result(&mut output)?;
Ok(decoded)
}
}
......@@ -277,7 +277,7 @@ impl EnvInstance {
beneficiary,
transferred: all,
};
panic!(scale::Encode::encode(&res));
panic!("{:?}", scale::Encode::encode(&res));
}
}
......
......@@ -31,6 +31,7 @@ use crate::{
Result,
};
use ink_prelude::string::String;
use std::str::FromStr;
/// Pushes a contract execution context.
///
......@@ -420,11 +421,18 @@ pub fn assert_contract_termination<T, F>(
{
let value_any = ::std::panic::catch_unwind(should_terminate)
.expect_err("contract did not terminate");
let encoded_input: &Vec<u8> = value_any
.downcast_ref::<Vec<u8>>()
let encoded_input = value_any
.downcast_ref::<String>()
.expect("panic object can not be cast");
let deserialized_vec = encoded_input
.replace("[", "")
.replace("]", "")
.split(", ")
.map(|s| u8::from_str(s).expect("u8 cannot be extracted from str"))
.collect::<Vec<u8>>();
let res: ContractTerminationResult<T> =
scale::Decode::decode(&mut &encoded_input[..]).expect("input can not be decoded");
scale::Decode::decode(&mut &deserialized_vec[..])
.expect("input can not be decoded");
assert_eq!(res.beneficiary, expected_beneficiary);
assert_eq!(res.transferred, expected_balance);
......
......@@ -26,6 +26,9 @@ scale = { package = "parity-scale-codec", version = "2.0", default-features = fa
derive_more = { version = "0.99", default-features = false, features = ["from"] }
static_assertions = "1.1"
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[features]
default = ["std"]
std = [
......
......@@ -31,6 +31,9 @@ heck = "0.3.1"
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive", "full"] }
impl-serde = "0.3.1"
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[features]
default = ["std"]
std = [
......
......@@ -23,6 +23,9 @@ scale = { package = "parity-scale-codec", version = "2.0", default-features = fa
syn = "1"
proc-macro2 = "1"
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[dev-dependencies]
ink_metadata = { version = "3.0.0-rc2", path = "../../metadata/" }
ink_env = { version = "3.0.0-rc2", path = "../../env/" }
......
......@@ -19,6 +19,9 @@ ink_prelude = { version = "3.0.0-rc2", path = "../prelude/", default-features =
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive", "full"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[dev-dependencies]
criterion = "0.3.1"
......
......@@ -33,6 +33,9 @@ array-init = { version = "1.0", default-features = false, features = ["const-gen
# We haven't found a better solution yet.
criterion = { version = "0.3", optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[dev-dependencies]
quickcheck = "1.0"
quickcheck_macros = "1.0"
......
......@@ -14,6 +14,8 @@ ink_lang = { version = "3.0.0-rc1", path = "../../crates/lang", default-features
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "contract_terminate"
......
......@@ -14,6 +14,8 @@ ink_lang = { version = "3.0.0-rc1", path = "../../crates/lang", default-features
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "contract_transfer"
......
......@@ -18,6 +18,9 @@ subber = { version = "3.0.0-rc2", path = "subber", default-features = false, fea
accumulator = { version = "3.0.0-rc2", path = "accumulator", default-features = false, features = ["ink-as-dependency"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "delegator"
path = "lib.rs"
......
......@@ -14,6 +14,8 @@ ink_lang = { version = "3.0.0-rc2", path = "../../../crates/lang", default-featu
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "accumulator"
......
......@@ -16,6 +16,8 @@ accumulator = { version = "3.0.0-rc2", path = "../accumulator", default-features
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "adder"
......
......@@ -16,6 +16,8 @@ accumulator = { version = "3.0.0-rc2", path = "../accumulator", default-features
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "subber"
......
......@@ -14,6 +14,8 @@ ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "dns"
......
......@@ -14,6 +14,8 @@ ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "erc20"
......
......@@ -14,6 +14,8 @@ ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "erc721"
......
......@@ -14,6 +14,8 @@ ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features
scale = { package = "parity-scale-codec", version = "2.0", default-features = false, features = ["derive"] }
scale-info = { version = "0.6", default-features = false, features = ["derive"], optional = true }
# Should be removed once bitvecto-rs/bitvec#105 is resolved
funty = "=1.1.0"
[lib]
name = "flipper"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment