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): switch to alloy types #8186

Merged
merged 10 commits into from
Jun 19, 2024
57 changes: 38 additions & 19 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ alloy-node-bindings = { version = "0.1.1", default-features = false }
alloy-provider = { version = "0.1.1", default-features = false }
alloy-pubsub = { version = "0.1.1", default-features = false }
alloy-rpc-client = { version = "0.1.1", default-features = false }
alloy-rpc-types-engine = { version = "0.1.1", default-features = false }
alloy-rpc-types-trace = { version = "0.1.1", default-features = false }
alloy-rpc-types = { version = "0.1.1", default-features = false }
alloy-serde = { version = "0.1.1", default-features = false }
alloy-signer = { version = "0.1.1", default-features = false }
Expand Down Expand Up @@ -262,6 +260,7 @@ tower-http = "0.5"
soldeer = "0.2.15"

[patch.crates-io]
alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "8dc637e" }
revm = { git = "https://github.com/bluealloy/revm.git", rev = "41e2f7f" }
revm-interpreter = { git = "https://github.com/bluealloy/revm.git", rev = "41e2f7f" }
revm-precompile = { git = "https://github.com/bluealloy/revm.git", rev = "41e2f7f" }
Expand Down
5 changes: 2 additions & 3 deletions crates/anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ alloy-signer = { workspace = true, features = ["eip712"] }
alloy-signer-local = { workspace = true, features = ["mnemonic"] }
alloy-sol-types = { workspace = true, features = ["std"] }
alloy-dyn-abi = { workspace = true, features = ["std", "eip712"] }
alloy-rpc-types = { workspace = true, features = ["txpool"] }
alloy-rpc-types-trace.workspace = true
alloy-rpc-types = { workspace = true, features = ["anvil", "trace", "txpool"] }
alloy-serde.workspace = true
alloy-provider = { workspace = true, features = [
"reqwest",
Expand Down Expand Up @@ -89,7 +88,7 @@ flate2 = "1.0"
serde_repr = "0.1"
serde_json.workspace = true
serde.workspace = true
thiserror .workspace = true
thiserror.workspace = true
yansi.workspace = true
tempfile.workspace = true
itertools.workspace = true
Expand Down
3 changes: 1 addition & 2 deletions crates/anvil/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ revm = { workspace = true, default-features = false, features = [
] }

alloy-primitives = { workspace = true, features = ["serde"] }
alloy-rpc-types.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-rpc-types = { workspace = true, features = ["anvil", "trace"] }
alloy-serde.workspace = true
alloy-rlp.workspace = true
alloy-eips.workspace = true
Expand Down
22 changes: 10 additions & 12 deletions crates/anvil/core/src/eth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
use crate::{
eth::subscription::SubscriptionId,
types::{EvmMineOptions, Forking, Index},
};
use crate::eth::subscription::SubscriptionId;
use alloy_primitives::{Address, Bytes, TxHash, B256, B64, U256};
use alloy_rpc_types::{
anvil::{Forking, MineOptions},
pubsub::{Params as SubscriptionParams, SubscriptionKind},
request::TransactionRequest,
state::StateOverride,
BlockId, BlockNumberOrTag as BlockNumber, Filter,
trace::geth::{GethDebugTracingOptions, GethDefaultTracingOptions},
BlockId, BlockNumberOrTag as BlockNumber, Filter, Index,
};
use alloy_rpc_types_trace::geth::{GethDebugTracingOptions, GethDefaultTracingOptions};
use alloy_serde::WithOtherFields;

pub mod block;
Expand Down Expand Up @@ -609,7 +607,7 @@ pub enum EthRequest {

/// Mine a single block
#[cfg_attr(feature = "serde", serde(rename = "evm_mine"))]
EvmMine(#[cfg_attr(feature = "serde", serde(default))] Option<Params<Option<EvmMineOptions>>>),
EvmMine(#[cfg_attr(feature = "serde", serde(default))] Option<Params<Option<MineOptions>>>),

/// Mine a single block and return detailed data
///
Expand All @@ -620,7 +618,7 @@ pub enum EthRequest {
serde(rename = "anvil_mine_detailed", alias = "evm_mine_detailed",)
)]
EvmMineDetailed(
#[cfg_attr(feature = "serde", serde(default))] Option<Params<Option<EvmMineOptions>>>,
#[cfg_attr(feature = "serde", serde(default))] Option<Params<Option<MineOptions>>>,
),

/// Execute a transaction regardless of signature status
Expand Down Expand Up @@ -1292,7 +1290,7 @@ mod tests {
EthRequest::EvmMine(params) => {
assert_eq!(
params.unwrap().params.unwrap_or_default(),
EvmMineOptions::Options { timestamp: Some(100), blocks: Some(100) }
MineOptions::Options { timestamp: Some(100), blocks: Some(100) }
)
}
_ => unreachable!(),
Expand Down Expand Up @@ -1329,7 +1327,7 @@ mod tests {
EthRequest::EvmMineDetailed(params) => {
assert_eq!(
params.unwrap().params.unwrap_or_default(),
EvmMineOptions::Options { timestamp: Some(100), blocks: Some(100) }
MineOptions::Options { timestamp: Some(100), blocks: Some(100) }
)
}
_ => unreachable!(),
Expand Down Expand Up @@ -1360,7 +1358,7 @@ mod tests {
EthRequest::EvmMine(params) => {
assert_eq!(
params.unwrap().params.unwrap_or_default(),
EvmMineOptions::Timestamp(Some(1672937224))
MineOptions::Timestamp(Some(1672937224))
)
}
_ => unreachable!(),
Expand All @@ -1373,7 +1371,7 @@ mod tests {
EthRequest::EvmMine(params) => {
assert_eq!(
params.unwrap().params.unwrap_or_default(),
EvmMineOptions::Options { timestamp: Some(1672937224), blocks: None }
MineOptions::Options { timestamp: Some(1672937224), blocks: None }
)
}
_ => unreachable!(),
Expand Down
Loading
Loading