Skip to content

Commit

Permalink
fix tests + reformatting
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Edison <gregory.edison1993@gmail.com>
  • Loading branch information
greged93 committed Oct 29, 2024
1 parent 2824175 commit 7ab54cc
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 58 deletions.
117 changes: 107 additions & 10 deletions Cargo.lock

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

55 changes: 30 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,25 @@ starknet = { version = "0.12", default-features = false }
num-traits = { version = "0.2", default-features = false }

# Ethereum dependencies
alloy-rlp = { version = "0.3.8", default-features = false }
alloy-sol-types = { version = "0.8.4", default-features = false }
alloy-consensus = { version = "0.4.2", default-features = false, optional = true }
alloy-contract = { version = "0.3.6", default-features = false }
alloy-provider = { version = "0.4.2", default-features = false, optional = true }
alloy-rlp = { version = "0.3.8", default-features = false }
alloy-rpc-types = { version = "0.4.2", features = [
"eth",
"arbitrary",
], default-features = false }
alloy-consensus = { version = "0.4.2", default-features = false, optional = true }
alloy-rpc-types-txpool = { version = "0.4.2", default-features = false }
alloy-rpc-types-trace = { version = "0.4.2", default-features = false }
alloy-sol-types = { version = "0.8.4", default-features = false }
jsonrpsee = { version = "0.24", features = ["macros", "server"] }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, features = [
"std",
] }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, features = [
"std",
] }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, features = [
"alloy-compat",
Expand All @@ -86,12 +88,11 @@ reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, features = [
"std",
] }
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, optional = true }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
revm-inspectors = "0.8.1"

# Error
Expand Down Expand Up @@ -148,17 +149,36 @@ hyper-util = { version = "0.1", default-features = false, features = [
http-body-util = { version = "0.1", default-features = false }
pin-project-lite = { version = "0.2", default-features = false }

# Testing crates
#### Testing crates ####
# Ethereum
foundry-config = { git = "https://github.com/foundry-rs/foundry", branch = "master", optional = true }
revm-interpreter = { version = "10.0", default-features = false, optional = true }
revm-primitives = { version = "10.0", default-features = false, optional = true }

# Alloy
alloy-dyn-abi = { version = "0.8.4", default-features = false }
alloy-eips = { version = "0.4.2", default-features = false }
alloy-json-abi = { version = "0.8.4", default-features = false, optional = true }
alloy-primitives = { version = "0.8.4", default-features = false }
alloy-signer-local = { version = "0.4.2", default-features = false, optional = true }
alloy-signer = { version = "0.4.2", default-features = false, optional = true }
alloy-serde = { version = "0.4.2", default-features = false }
alloy-eips = { version = "0.4.2", default-features = false }

# Starknet
dojo-test-utils = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, optional = true }
katana-node = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, optional = true }
katana-primitives = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, features = [
"serde",
], optional = true }
starknet_api = { version = "0.13.0-rc.0", optional = true }
starknet-crypto = { version = "0.7", optional = true }

# Misc
anyhow = { version = "1", default-features = false, optional = true }
arbitrary = { version = "1", features = ["derive"], optional = true }
foundry-config = { git = "https://github.com/foundry-rs/foundry", branch = "master", optional = true }
clap = { version = "4.5.17", optional = true }
mockall = { version = "0.13.0", default-features = false, optional = true }
mockito = { version = "1.5.0", default-features = false, optional = true }
rand = { version = "0.8", default-features = false }
rayon = { version = "1", default-features = false, optional = true }
rstest = { version = "0.21", default-features = false, optional = true }
Expand All @@ -172,21 +192,6 @@ tokio-util = { version = "0.7", features = [
tokio-stream = { version = "0.1", default-features = false, optional = true }
walkdir = { version = "2.5", default-features = false, optional = true }

dojo-test-utils = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, optional = true }
katana-node = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, optional = true }
katana-primitives = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, features = [
"serde",
], optional = true }
mockall = { version = "0.13.0", default-features = false, optional = true }
clap = { version = "4.5.17", optional = true }
mockito = { version = "1.5.0", default-features = false, optional = true }


starknet_api = { version = "0.13.0-rc.0", optional = true }
revm-interpreter = { version = "10.0", default-features = false, optional = true }
revm-primitives = { version = "10.0", default-features = false, optional = true }
starknet-crypto = { version = "0.7", optional = true }

[dev-dependencies]
hex = { version = "0.4", default-features = false }
proptest = { version = "1.5", default-features = false }
Expand Down Expand Up @@ -224,7 +229,7 @@ testing = [
]
binaries = ["clap"]
hive = []
rpc_forwarding = []
forwarding = ["alloy-provider/reqwest"]
arbitrary = ["dep:arbitrary"]

[[bin]]
Expand Down
18 changes: 9 additions & 9 deletions src/eth_rpc/servers/eth_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
client::{EthClient, KakarotTransactions, TransactionHashProvider},
client::{EthClient, TransactionHashProvider},
eth_rpc::api::eth_api::EthApiServer,
providers::eth_provider::{
constant::MAX_PRIORITY_FEE_PER_GAS,
Expand All @@ -19,12 +19,6 @@ use reth_primitives::{BlockId, BlockNumberOrTag};
use serde_json::Value;
use starknet::providers::Provider;
use std::sync::Arc;
#[cfg(feature = "rpc_forwarding")]
use {
crate::providers::eth_provider::constant::MAIN_RPC_URL,
alloy_provider::{Provider as provider_alloy, ProviderBuilder},
url::Url,
};

/// The RPC module for the Ethereum protocol required by Kakarot.
#[derive(Debug)]
Expand Down Expand Up @@ -262,8 +256,13 @@ where
#[tracing::instrument(skip_all, ret, err)]
async fn send_raw_transaction(&self, bytes: Bytes) -> RpcResult<B256> {
tracing::info!("Serving eth_sendRawTransaction");
#[cfg(feature = "rpc_forwarding")]

#[cfg(feature = "forwarding")]
{
use crate::providers::eth_provider::constant::MAIN_RPC_URL;
use alloy_provider::{Provider as _, ProviderBuilder};
use url::Url;

let provider = ProviderBuilder::new().on_http(Url::parse(MAIN_RPC_URL.as_ref()).unwrap());
let tx_hash = provider
.send_raw_transaction(&bytes)
Expand All @@ -272,7 +271,8 @@ where

return Ok(*tx_hash.tx_hash());
}
#[cfg(not(feature = "rpc_forwarding"))]

#[cfg(not(feature = "forwarding"))]
Ok(self.eth_client.send_raw_transaction(bytes).await?)
}

Expand Down
Loading

0 comments on commit 7ab54cc

Please sign in to comment.