From cd7379a04f57f7b49a5e251af2f257614520cbe1 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 14 Mar 2022 11:06:25 +0100 Subject: [PATCH 1/3] chore(solc): provide remappings on unresolved import message --- cli/src/term.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cli/src/term.rs b/cli/src/term.rs index f8627a7ebbcc..d5d7ed6bcd0e 100644 --- a/cli/src/term.rs +++ b/cli/src/term.rs @@ -1,7 +1,7 @@ //! terminal utils use atty::{self, Stream}; -use ethers::solc::{report::Reporter, CompilerInput, Solc}; +use ethers::solc::{remappings::Remapping, report::Reporter, CompilerInput, Solc}; use once_cell::sync::Lazy; use semver::Version; use std::{ @@ -220,8 +220,12 @@ impl Reporter for SpinnerReporter { self.send_msg(format!("Successfully installed solc {}", version)); } - fn on_unresolved_import(&self, import: &Path) { - self.send_msg(format!("Unable to resolve imported file: \"{}\"", import.display())); + fn on_unresolved_import(&self, import: &Path, remappings: &[Remapping]) { + self.send_msg(format!( + "Unable to resolve import: \"{}\" with remappings:\n {}", + import.display(), + remappings.iter().map(|r| r.to_string()).collect::>().join("\n ") + )); } } From 7db4629d184d970c4724ea96f88634b6a87b8f9f Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 14 Mar 2022 12:33:44 +0100 Subject: [PATCH 2/3] feat: add on solc error --- cli/src/term.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/src/term.rs b/cli/src/term.rs index d5d7ed6bcd0e..70990d26ac0e 100644 --- a/cli/src/term.rs +++ b/cli/src/term.rs @@ -1,5 +1,6 @@ //! terminal utils +use ansi_term::Colour; use atty::{self, Stream}; use ethers::solc::{remappings::Remapping, report::Reporter, CompilerInput, Solc}; use once_cell::sync::Lazy; @@ -220,6 +221,10 @@ impl Reporter for SpinnerReporter { self.send_msg(format!("Successfully installed solc {}", version)); } + fn on_solc_installation_error(&self, version: &Version, error: &str) { + self.send_msg(Colour::Red.paint(format!("Failed to install solc {}: {}", version, error))); + } + fn on_unresolved_import(&self, import: &Path, remappings: &[Remapping]) { self.send_msg(format!( "Unable to resolve import: \"{}\" with remappings:\n {}", From dcda2d2ea1c6ddb1989b69a7dba4c982a8ea23a9 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 14 Mar 2022 12:54:24 +0100 Subject: [PATCH 3/3] bump ethers --- Cargo.lock | 22 +++++++++++----------- cli/src/term.rs | 4 +++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1d1e6b428b8a..e635b376208e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "ethers" version = "0.6.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -1290,7 +1290,7 @@ dependencies = [ [[package]] name = "ethers-addressbook" version = "0.1.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "ethers-core", "once_cell", @@ -1301,7 +1301,7 @@ dependencies = [ [[package]] name = "ethers-contract" version = "0.6.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "ethers-contract-abigen", "ethers-contract-derive", @@ -1319,7 +1319,7 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" version = "0.6.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "Inflector", "cfg-if 1.0.0", @@ -1342,7 +1342,7 @@ dependencies = [ [[package]] name = "ethers-contract-derive" version = "0.6.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "ethers-contract-abigen", "ethers-core", @@ -1356,7 +1356,7 @@ dependencies = [ [[package]] name = "ethers-core" version = "0.6.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "arrayvec 0.7.2", "bytes", @@ -1384,7 +1384,7 @@ dependencies = [ [[package]] name = "ethers-etherscan" version = "0.2.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "ethers-core", "ethers-solc", @@ -1398,7 +1398,7 @@ dependencies = [ [[package]] name = "ethers-middleware" version = "0.6.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "async-trait", "ethers-contract", @@ -1421,7 +1421,7 @@ dependencies = [ [[package]] name = "ethers-providers" version = "0.6.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "async-trait", "auto_impl", @@ -1454,7 +1454,7 @@ dependencies = [ [[package]] name = "ethers-signers" version = "0.6.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "async-trait", "coins-bip32", @@ -1477,7 +1477,7 @@ dependencies = [ [[package]] name = "ethers-solc" version = "0.3.0" -source = "git+https://github.com/gakonst/ethers-rs#beffe32f15aa00c455722040517d589d81f242a8" +source = "git+https://github.com/gakonst/ethers-rs#f6d123241e3a74ab6384598f050c4eb85f0638fc" dependencies = [ "colored", "dunce", diff --git a/cli/src/term.rs b/cli/src/term.rs index 70990d26ac0e..6aa0db2016cd 100644 --- a/cli/src/term.rs +++ b/cli/src/term.rs @@ -222,7 +222,9 @@ impl Reporter for SpinnerReporter { } fn on_solc_installation_error(&self, version: &Version, error: &str) { - self.send_msg(Colour::Red.paint(format!("Failed to install solc {}: {}", version, error))); + self.send_msg( + Colour::Red.paint(format!("Failed to install solc {}: {}", version, error)).to_string(), + ); } fn on_unresolved_import(&self, import: &Path, remappings: &[Remapping]) {