Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
fix(core): check against ethers internal crate names (#1060)
Browse files Browse the repository at this point in the history
* fix(core): check against ethers internal crate names

* fix: add import back
  • Loading branch information
mattsse authored Mar 17, 2022
1 parent 2af28be commit 3d4fecc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ethers-contract/tests/abigen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ fn can_handle_underscore_numeric() {
_100pct(string)
]"#
);
let call = _100PctCall("message".to_string());
let _call = _100PctCall("message".to_string());

let provider = Arc::new(Provider::new(MockProvider::new()));
let contract = Test::new(Address::default(), Arc::clone(&provider));
Expand Down
15 changes: 12 additions & 3 deletions ethers-core/src/macros/ethers_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,18 @@ pub fn determine_ethers_crates() -> (&'static str, &'static str, &'static str) {
.and_then(|metadata| {
metadata.root_package().and_then(|pkg| {
let sub_crates = Some(("ethers_core", "ethers_contract", "ethers_providers"));
if pkg.name == "ethers-contract" {
// Note(mattsse): this is super hacky but required in order to compile the tests
// in the `ethers-contract` crate

// Note(mattsse): this is super hacky but required in order to compile and test
// ethers' internal crates
if [
"ethers-contract",
"ethers-derive-eip712",
"ethers-signers",
"ethers-middleware",
"ethers-solc",
]
.contains(&pkg.name.as_str())
{
return sub_crates
}

Expand Down
2 changes: 1 addition & 1 deletion ethers-etherscan/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ mod tests {

let balances = client
.get_ether_balance_multi(
&vec![&"0x58eB28A67731c570Ef827C365c89B5751F9E6b0a".parse().unwrap()],
&[&"0x58eB28A67731c570Ef827C365c89B5751F9E6b0a".parse().unwrap()],
None,
)
.await;
Expand Down
4 changes: 2 additions & 2 deletions ethers-etherscan/src/source_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mod tests {
},
],
};
st.write_to(&tempdir.path()).unwrap();
st.write_to(tempdir.path()).unwrap();
let written_paths = read_dir(tempdir.path()).unwrap();
let paths: Vec<PathBuf> =
written_paths.into_iter().filter_map(|x| x.ok()).map(|x| x.path()).collect();
Expand All @@ -83,7 +83,7 @@ mod tests {
},
],
};
st.write_to(&tempdir.path()).unwrap();
st.write_to(tempdir.path()).unwrap();
let written_paths = read_dir(tempdir.path()).unwrap();
let paths: Vec<PathBuf> =
written_paths.into_iter().filter_map(|x| x.ok()).map(|x| x.path()).collect();
Expand Down
3 changes: 2 additions & 1 deletion ethers-providers/tests/provider.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg(not(target_arch = "wasm32"))]
use ethers_providers::{Http, Middleware, Provider, RINKEBY};
use ethers_providers::{Http, Middleware, Provider};
use std::{convert::TryFrom, time::Duration};

#[cfg(not(feature = "celo"))]
Expand All @@ -9,6 +9,7 @@ mod eth_tests {
types::{Address, BlockId, TransactionRequest, H256},
utils::Ganache,
};
use ethers_providers::RINKEBY;

#[tokio::test]
async fn non_existing_data_works() {
Expand Down

0 comments on commit 3d4fecc

Please sign in to comment.