Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
0xOsiris committed Dec 9, 2024
1 parent f57a95b commit 65abe71
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion world-chain-builder/bin/world-chain-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
6 changes: 4 additions & 2 deletions world-chain-builder/src/rpc/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 {
Expand Down
23 changes: 21 additions & 2 deletions world-chain-builder/src/test/e2e/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::{
validator::WorldChainTransactionValidator,
},
primitives::WorldChainPooledTransactionsElement,
rpc::bundle::{EthTransactionsExtServer, WorldChainEthApiExt},
};
use alloy_eips::eip2718::Decodable2718;
use alloy_genesis::{Genesis, GenesisAccount};
Expand All @@ -24,14 +25,17 @@ 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};
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,
Expand Down Expand Up @@ -77,7 +81,7 @@ type NodeAdapterType = NodeAdapter<
NodeTypesWithDBAdapter<WorldChainBuilder, Arc<TempDatabase<DatabaseEnv>>>,
>,
>,
reth::transaction_pool::Pool<
Pool<
TransactionValidationTaskExecutor<
WorldChainTransactionValidator<
BlockchainProvider<
Expand Down Expand Up @@ -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?;
Expand Down Expand Up @@ -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<()> {
Expand Down

0 comments on commit 65abe71

Please sign in to comment.