Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(anvil): add ipc support #3134

Merged
merged 14 commits into from
Sep 15, 2022
109 changes: 85 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["ws"] }
trie-db = { version = "0.23" }
hash-db = { version = "0.15" }
memory-db = { version = "0.29" }
revm_precompiles = "1.1.0"

# axum related
axum = { version = "0.5", features = ["ws"] }
Expand Down Expand Up @@ -77,6 +76,12 @@ fdlimit = { version = "0.2.1", optional = true }
clap_complete_fig = "3.2.4"
ethereum-forkid = "0.10.0"

# ethers
[target.'cfg(not(windows))'.dependencies]
ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["ws", "ipc"] }
[target.'cfg(windows)'.dependencies]
ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["ws"] }

[dev-dependencies]
ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["abigen"] }
ethers-solc = { git = "https://github.com/gakonst/ethers-rs", features = ["project-util", "full"] }
Expand Down
12 changes: 12 additions & 0 deletions anvil/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,24 @@ tracing = "0.1"
parking_lot = "0.12"
futures = "0.3"

# ipc
parity-tokio-ipc = { version = "0.9.0", optional = true }
bytes = { version = "1.2" , optional = true }
tokio-util = { version = "0.7.4", features = ["codec"], optional = true }

# misc
serde_json = "1.0.67"
serde = { version = "1.0.136", features = ["derive"] }
async-trait = "0.1.53"
thiserror = "1.0.34"

clap = { version = "3.0.10", features = [
"derive",
"env",
], optional = true }
pin-project = "1.0.12"


[features]
default = ["ipc"]
ipc = ["parity-tokio-ipc", "bytes", "tokio-util"]
14 changes: 14 additions & 0 deletions anvil/server/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! Error variants used to unify different connection streams

/// An error that can occur when reading an incoming request
#[derive(Debug, thiserror::Error)]
pub enum RequestError {
#[error(transparent)]
Axum(#[from] axum::Error),
#[error(transparent)]
Serde(#[from] serde_json::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("Disconnect")]
Disconnect,
}