From e7df428274d22253aa186367506e46c2c4fc8895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Tue, 28 Jan 2020 22:34:41 +0100 Subject: [PATCH] Display `has_api_with` results if invalid version of Offchain Workers is detected. (#4749) * Display error message when checking has_api. * Cargo.lock. --- substrate/Cargo.lock | 6 +++--- substrate/client/offchain/src/lib.rs | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 6720e9c658..ecf929384a 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -2729,7 +2729,7 @@ dependencies = [ "log 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "yamux 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "yamux 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -8310,7 +8310,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "yamux" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -8954,7 +8954,7 @@ dependencies = [ "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1585dc1484373cbc1cee7aafda26634665cf449436fd6e24bfd1fad230538" "checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" -"checksum yamux 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9f937668802a2e862a4fed05267e10b20c310bf771adc89687710706d55a9a65" +"checksum yamux 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "809f4388471d280173404e3d4f889e2d36004960a37d822ce5637fbef33a0ce4" "checksum zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45af6a010d13e4cf5b54c94ba5a2b2eba5596b9e46bf5875612d332a1f2b3f86" "checksum zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" "checksum zeroize_derive 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" diff --git a/substrate/client/offchain/src/lib.rs b/substrate/client/offchain/src/lib.rs index 78760fb011..3cd3b2cba5 100644 --- a/substrate/client/offchain/src/lib.rs +++ b/substrate/client/offchain/src/lib.rs @@ -107,7 +107,11 @@ impl OffchainWorkers< let version = match (has_api_v1, has_api_v2) { (_, Ok(true)) => 2, (Ok(true), _) => 1, - _ => 0, + err => { + let help = "Consider turning off offchain workers if they are not part of your runtime."; + log::error!("Unsupported Offchain Worker API version: {:?}. {}.", err, help); + 0 + } }; debug!("Checking offchain workers at {:?}: version:{}", at, version); if version > 0 { @@ -140,8 +144,6 @@ impl OffchainWorkers< }); futures::future::Either::Left(runner.process()) } else { - let help = "Consider turning off offchain workers if they are not part of your runtime."; - log::error!("Unsupported Offchain Worker API version: {}. {}", version, help); futures::future::Either::Right(futures::future::ready(())) } }