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

chore: make abigen offline by default, fix ethers-solc features #2416

Merged
merged 2 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ethers-contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
[features]
default = ["abigen"]

abigen-offline = ["ethers-contract-abigen", "ethers-contract-derive"]
abigen = ["abigen-offline", "ethers-contract-abigen/online"]
abigen = ["ethers-contract-abigen", "ethers-contract-derive"]
abigen-online = ["abigen", "ethers-contract-abigen/online"]

celo = ["legacy", "ethers-core/celo", "ethers-providers/celo"]
legacy = []
Expand All @@ -60,4 +60,5 @@ rustls = ["ethers-contract-abigen/rustls"]
openssl = ["ethers-contract-abigen/openssl"]

# Deprecated
eip712 = []
abigen-offline = ["abigen"]
eip712 = []
4 changes: 2 additions & 2 deletions ethers-contract/ethers-contract-abigen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ getrandom.workspace = true

[features]
online = ["reqwest", "ethers-etherscan", "url", "tokio"]
openssl = ["online", "reqwest/native-tls", "ethers-etherscan/openssl"]
rustls = ["online", "reqwest/rustls-tls", "ethers-etherscan/rustls"]
rustls = ["reqwest?/rustls-tls", "ethers-etherscan?/rustls"]
openssl = ["reqwest?/native-tls", "ethers-etherscan?/openssl"]

[dev-dependencies]
tempfile.workspace = true
Expand Down
8 changes: 7 additions & 1 deletion ethers-contract/ethers-contract-abigen/src/source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ impl Source {
if let Ok(canonicalized) = dunce::canonicalize(&resolved) {
resolved = canonicalized;
} else {
return Err(eyre::eyre!("File does not exist: {}", resolved.display()))
let path = resolved.display().to_string();
let err = if path.contains(':') {
eyre::eyre!("File does not exist: {path}\nYou may need to enable the `online` feature to parse this source.")
} else {
eyre::eyre!("File does not exist: {path}")
};
return Err(err)
}

Ok(Source::Local(resolved))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ mod tests {
let tests2 = tests2.collect::<Result<Vec<_>>>().unwrap();

for slice in tests2.windows(2) {
let (a, b) = (&slice[0], &slice[1]);
let [a, b] = slice else { unreachable!() };
if a != b {
panic!("Expected: {expected:?}; Got: {a:?} | {b:?}");
}
Expand Down
1 change: 0 additions & 1 deletion ethers-contract/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ where
/// while let Some(Ok(approval)) = event_stream.next().await {
/// let Approval{token_owner,spender,tokens} = approval;
/// }
///
/// # }
/// ```
pub async fn stream(
Expand Down
2 changes: 1 addition & 1 deletion ethers-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ legacy = []
macros = ["syn", "cargo_metadata", "once_cell"]

# Deprecated
eip712 = []
eip712 = []
6 changes: 5 additions & 1 deletion ethers-etherscan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }

[features]
default = ["rustls"]
openssl = ["reqwest/native-tls"]
rustls = ["reqwest/rustls-tls"]
openssl = ["reqwest/native-tls"]

ethers-solc = ["dep:ethers-solc"]
solc-full = ["ethers-solc?/full"]
solc-tests = ["ethers-solc?/tests"]
2 changes: 1 addition & 1 deletion ethers-middleware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ tokio = { workspace = true, features = ["rt-multi-thread", "macros", "time"] }
[features]
default = ["rustls"]
celo = ["ethers-core/celo", "ethers-providers/celo", "ethers-signers/celo", "ethers-contract/celo"]
openssl = ["reqwest/native-tls"]
rustls = ["reqwest/rustls-tls"]
openssl = ["reqwest/native-tls"]
2 changes: 1 addition & 1 deletion ethers-providers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ ws = ["tokio-tungstenite", "futures-channel"]
legacy-ws = ["ws"]
ipc = ["tokio/io-util", "futures-channel", "winapi"]

openssl = ["tokio-tungstenite/native-tls", "reqwest/native-tls"]
# we use the webpki roots so we can build static binaries w/o any root cert dependencies
# on the host
rustls = ["tokio-tungstenite/rustls-tls-webpki-roots", "reqwest/rustls-tls"]
openssl = ["tokio-tungstenite/native-tls", "reqwest/native-tls"]
dev-rpc = []

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion ethers-solc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ svm-solc = ["svm", "svm-builds", "sha2"]
project-util = ["tempfile", "fs_extra", "rand"]

tests = []
openssl = ["svm?/openssl"]
rustls = ["svm?/rustls"]
openssl = ["svm?/openssl"]

# Deprecated
asm = []
45 changes: 24 additions & 21 deletions ethers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,53 +26,56 @@ all-features = true
[features]
default = ["abigen", "rustls"]

# workspace-wide features
legacy = ["ethers-core/legacy", "ethers-contract/legacy"]
celo = [
"ethers-contract/celo",
"ethers-core/celo",
"ethers-middleware/celo",
"ethers-providers/celo",
"ethers-signers/celo",
"ethers-contract/celo",
"ethers-middleware/celo",
"legacy",
]

legacy = ["ethers-core/legacy", "ethers-contract/legacy"]

# individual features per sub-crate
## providers
ws = ["ethers-providers/ws"]
legacy-ws = ["ethers-providers/legacy-ws"]
ipc = ["ethers-providers/ipc"]
rustls = [
"ethers-contract/rustls",
"ethers-etherscan/rustls",
"ethers-middleware/rustls",
"ethers-providers/rustls",
"ethers-etherscan/rustls",
"ethers-contract/rustls",
"ethers-solc/rustls",
"ethers-solc?/rustls",
]
openssl = [
"ethers-contract/openssl",
"ethers-etherscan/openssl",
"ethers-middleware/openssl",
"ethers-providers/openssl",
"ethers-etherscan/openssl",
"ethers-contract/openssl",
"ethers-solc/openssl",
"ethers-solc?/openssl",
]

# ethers-providers
ws = ["ethers-providers/ws"]
legacy-ws = ["ethers-providers/legacy-ws"]
ipc = ["ethers-providers/ipc"]
dev-rpc = ["ethers-providers/dev-rpc"]
## signers

# ethers-signers
ledger = ["ethers-signers/ledger"]
trezor = ["ethers-signers/trezor"]
yubi = ["ethers-signers/yubi"]
## contracts

# ethers-contracts
abigen = ["ethers-contract/abigen"]
### abigen without reqwest
abigen-offline = ["ethers-contract/abigen-offline"]
## solc
abigen-online = ["ethers-contract/abigen-online"]

# ethers-solc
ethers-solc = ["dep:ethers-solc", "ethers-etherscan/ethers-solc"]
solc-full = ["ethers-solc?/full"]
solc-tests = ["ethers-solc?/tests"]

# Deprecated
solc-sha2-asm = []
abigen-offline = ["abigen"]
eip712 = []
solc-sha2-asm = []

[dependencies]
ethers-addressbook.workspace = true
Expand Down