diff --git a/world-chain-builder/bin/world-chain-builder.rs b/world-chain-builder/bin/world-chain-builder.rs index 90f74d7..7da708a 100644 --- a/world-chain-builder/bin/world-chain-builder.rs +++ b/world-chain-builder/bin/world-chain-builder.rs @@ -35,7 +35,7 @@ fn main() { )?) .extend_rpc_modules(move |ctx| { let provider = ctx.provider().clone(); - let pool = ctx.pool().clone(); // Can we clone here? + let pool = ctx.pool().clone(); let eth_api_ext = WorldChainEthApiExt::new(pool, provider); ctx.modules.merge_configured(eth_api_ext.into_rpc())?; Ok(()) diff --git a/world-chain-builder/src/rpc/bundle.rs b/world-chain-builder/src/rpc/bundle.rs index 0ec579b..851eb6d 100644 --- a/world-chain-builder/src/rpc/bundle.rs +++ b/world-chain-builder/src/rpc/bundle.rs @@ -4,7 +4,7 @@ use alloy_rpc_types::erc4337::{AccountStorage, ConditionalOptions}; use jsonrpsee::{ core::{async_trait, RpcResult}, proc_macros::rpc, - types::{ErrorCode, ErrorObjectOwned}, + types::{ErrorCode, ErrorObject, ErrorObjectOwned}, }; use reth::transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool}; @@ -84,7 +84,9 @@ where let latest = self .provider() .block_by_id(BlockId::latest()) - .map_err(|_| ErrorObjectOwned::from(ErrorCode::InternalError))? + .map_err(|e| { + ErrorObject::owned(ErrorCode::InternalError.code(), e.to_string(), Some("")) + })? .ok_or(ErrorObjectOwned::from(ErrorCode::InternalError))?; if let Some(min_block) = options.block_number_min { diff --git a/world-chain-builder/src/test/e2e/mod.rs b/world-chain-builder/src/test/e2e/mod.rs index f843de8..1b72808 100644 --- a/world-chain-builder/src/test/e2e/mod.rs +++ b/world-chain-builder/src/test/e2e/mod.rs @@ -16,6 +16,7 @@ use crate::{ validator::WorldChainTransactionValidator, }, primitives::WorldChainPooledTransactionsElement, + rpc::bundle::{EthTransactionsExtServer, WorldChainEthApiExt}, }; use alloy_eips::eip2718::Decodable2718; use alloy_genesis::{Genesis, GenesisAccount}; @@ -24,7 +25,6 @@ use alloy_network::{Ethereum, EthereumWallet, TransactionBuilder}; use alloy_rpc_types::{TransactionInput, TransactionRequest}; use alloy_signer_local::PrivateKeySigner; use chrono::Utc; -use reth::builder::{NodeAdapter, NodeBuilder, NodeConfig, NodeHandle}; use reth::payload::{EthPayloadBuilderAttributes, PayloadId}; use reth::tasks::TaskManager; use reth::transaction_pool::{blobstore::DiskFileBlobStore, TransactionValidationTaskExecutor}; @@ -32,6 +32,10 @@ use reth::{ api::{FullNodeTypesAdapter, NodeTypesWithDBAdapter}, builder::components::Components, }; +use reth::{ + builder::{NodeAdapter, NodeBuilder, NodeConfig, NodeHandle}, + transaction_pool::Pool, +}; use reth_db::{ test_utils::{tempdir_path, TempDatabase}, DatabaseEnv, @@ -77,7 +81,7 @@ type NodeAdapterType = NodeAdapter< NodeTypesWithDBAdapter>>, >, >, - reth::transaction_pool::Pool< + Pool< TransactionValidationTaskExecutor< WorldChainTransactionValidator< BlockchainProvider< @@ -147,6 +151,13 @@ impl WorldChainBuilderTestContext { }, &path, )?) + .extend_rpc_modules(move |ctx| { + let provider = ctx.provider().clone(); + let pool = ctx.pool().clone(); + let eth_api_ext = WorldChainEthApiExt::new(pool, provider); + ctx.modules.merge_configured(eth_api_ext.into_rpc())?; + Ok(()) + }) .launch() .await?; let test_ctx = NodeTestContext::new(node, optimism_payload_attributes).await?; @@ -309,6 +320,14 @@ async fn test_invalidate_dup_tx_and_nullifier() -> eyre::Result<()> { Ok(()) } +#[tokio::test] +#[serial] +async fn test_send_raw_transaction_conditional() -> eyre::Result<()> { + let ctx = WorldChainBuilderTestContext::setup().await?; + println!("{:?}", ctx.node.rpc.inner.methods()); + Ok(()) +} + #[tokio::test] #[serial] async fn test_dup_pbh_nonce() -> eyre::Result<()> {