Skip to content

Commit

Permalink
Merge branch 'nightly' into yaziciahmet/set-zk-constants-from-env
Browse files Browse the repository at this point in the history
  • Loading branch information
yaziciahmet authored Dec 20, 2024
2 parents b9a0217 + 9626b78 commit 0aeeef3
Show file tree
Hide file tree
Showing 9 changed files with 496 additions and 763 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

13 changes: 1 addition & 12 deletions bin/citrea/src/eth.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::str::FromStr;
use std::sync::Arc;

use anyhow::Context as _;
Expand All @@ -20,15 +19,13 @@ pub(crate) fn register_ethereum<Da: DaService>(
soft_confirmation_rx: Option<broadcast::Receiver<u64>>,
) -> Result<(), anyhow::Error> {
let eth_rpc_config = {
let eth_signer = eth_dev_signer();
EthRpcConfig {
eth_signer,
gas_price_oracle_config: GasPriceOracleConfig::default(),
fee_history_cache_config: FeeHistoryCacheConfig::default(),
}
};

let ethereum_rpc = ethereum_rpc::get_ethereum_rpc::<DefaultContext, Da>(
let ethereum_rpc = ethereum_rpc::create_rpc_module::<DefaultContext, Da>(
da_service,
eth_rpc_config,
storage,
Expand All @@ -40,11 +37,3 @@ pub(crate) fn register_ethereum<Da: DaService>(
.merge(ethereum_rpc)
.context("Failed to merge Ethereum RPC modules")
}

// TODO: #840
fn eth_dev_signer() -> ethereum_rpc::DevSigner {
ethereum_rpc::DevSigner::new(vec![secp256k1::SecretKey::from_str(
"ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
)
.unwrap()])
}
6 changes: 0 additions & 6 deletions bin/citrea/tests/evm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,6 @@ async fn execute(client: &Box<TestClient>) -> Result<(), Box<dyn std::error::Err
pub async fn init_test_rollup(rpc_address: SocketAddr) -> Box<TestClient> {
let test_client = make_test_client(rpc_address).await.unwrap();

let etc_accounts = test_client.eth_accounts().await;
assert_eq!(
vec![Address::from_str("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266").unwrap()],
etc_accounts
);

let eth_chain_id = test_client.eth_chain_id().await;
assert_eq!(5655, eth_chain_id);

Expand Down
7 changes: 0 additions & 7 deletions bin/citrea/tests/test_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,6 @@ impl TestClient {
.unwrap()
}

pub(crate) async fn eth_accounts(&self) -> Vec<Address> {
self.http_client
.request("eth_accounts", rpc_params![])
.await
.unwrap()
}

pub(crate) async fn eth_chain_id(&self) -> u64 {
self.client.get_chain_id().await.unwrap()
}
Expand Down
5 changes: 1 addition & 4 deletions crates/ethereum-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resolver = "2"
[dependencies]
# 3rd-party dependencies
anyhow = { workspace = true }
async-trait = { workspace = true }
borsh = { workspace = true }
citrea-evm = { path = "../evm", features = ["native"] }
citrea-primitives = { path = "../primitives" }
Expand Down Expand Up @@ -46,7 +47,3 @@ sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface", features =

[dev-dependencies]
tokio = { workspace = true }

[features]
default = ["local"]
local = []
9 changes: 0 additions & 9 deletions crates/ethereum-rpc/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use std::sync::{Arc, Mutex};

use alloy_primitives::U256;
use alloy_rpc_types_trace::geth::GethTrace;
#[cfg(feature = "local")]
use citrea_evm::DevSigner;
use citrea_evm::Evm;
use jsonrpsee::http_client::HttpClient;
use rustc_version_runtime::version;
Expand All @@ -26,16 +24,12 @@ const DEFAULT_PRIORITY_FEE: U256 = U256::from_limbs([100, 0, 0, 0]);
pub struct EthRpcConfig {
pub gas_price_oracle_config: GasPriceOracleConfig,
pub fee_history_cache_config: FeeHistoryCacheConfig,
#[cfg(feature = "local")]
pub eth_signer: DevSigner,
}

pub struct Ethereum<C: sov_modules_api::Context, Da: DaService> {
#[allow(dead_code)]
pub(crate) da_service: Arc<Da>,
pub(crate) gas_price_oracle: GasPriceOracle<C>,
#[cfg(feature = "local")]
pub(crate) eth_signer: DevSigner,
pub(crate) storage: C::Storage,
pub(crate) ledger_db: LedgerDB,
pub(crate) sequencer_client: Option<HttpClient>,
Expand All @@ -50,7 +44,6 @@ impl<C: sov_modules_api::Context, Da: DaService> Ethereum<C, Da> {
da_service: Arc<Da>,
gas_price_oracle_config: GasPriceOracleConfig,
fee_history_cache_config: FeeHistoryCacheConfig,
#[cfg(feature = "local")] eth_signer: DevSigner,
storage: C::Storage,
ledger_db: LedgerDB,
sequencer_client: Option<HttpClient>,
Expand All @@ -74,8 +67,6 @@ impl<C: sov_modules_api::Context, Da: DaService> Ethereum<C, Da> {
Self {
da_service,
gas_price_oracle,
#[cfg(feature = "local")]
eth_signer,
storage,
ledger_db,
sequencer_client,
Expand Down
Loading

0 comments on commit 0aeeef3

Please sign in to comment.