Skip to content

Commit

Permalink
feat: append tx conditional to pooled tx (#14403)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Feb 11, 2025
1 parent 5f15d1e commit fab686a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 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.

2 changes: 2 additions & 0 deletions crates/optimism/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ reth-optimism-chainspec.workspace = true
reth-optimism-consensus.workspace = true
reth-optimism-evm.workspace = true
reth-optimism-payload-builder.workspace = true
reth-optimism-txpool.workspace = true
# TODO remove node-builder import
reth-optimism-primitives = { workspace = true, features = ["reth-codec", "serde-bincode-compat"] }
reth-optimism-forks.workspace = true
Expand Down Expand Up @@ -79,6 +80,7 @@ optimism = [
"reth-optimism-consensus/optimism",
"reth-optimism-payload-builder/optimism",
"reth-optimism-primitives/optimism",
"reth-optimism-txpool/optimism",
]
client = [
"jsonrpsee/client",
Expand Down
9 changes: 5 additions & 4 deletions crates/optimism/rpc/src/eth/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{Bytes, B256};
use alloy_rpc_types_eth::erc4337::TransactionConditional;
use jsonrpsee_core::RpcResult;
use reth_optimism_txpool::conditional::MaybeConditionalTransaction;
use reth_provider::{BlockReaderIdExt, StateProviderFactory};
use reth_rpc_eth_api::L2EthApiExtServer;
use reth_rpc_eth_types::utils::recover_raw_transaction;
Expand Down Expand Up @@ -49,7 +50,7 @@ impl<N> L2EthApiExtServer for OpEthApiExt<N>
where
N: OpNodeCore + 'static,
N::Provider: BlockReaderIdExt + StateProviderFactory,
N::Pool: TransactionPool,
N::Pool: TransactionPool<Transaction: MaybeConditionalTransaction>,
{
async fn send_raw_transaction_conditional(
&self,
Expand All @@ -66,7 +67,7 @@ where
OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::FailedToDecodeSignedTransaction)
})?;

let tx = <N::Pool as TransactionPool>::Transaction::from_pooled(recovered_tx);
let mut tx = <N::Pool as TransactionPool>::Transaction::from_pooled(recovered_tx);

// get current header
let header_not_found = || {
Expand Down Expand Up @@ -97,8 +98,8 @@ where
.map_err(OpEthApiError::Sequencer)?;
Ok(*tx.hash())
} else {
// otherwise, add to pool
// TODO: include conditional
// otherwise, add to pool with the appended conditional
tx.set_conditional(condition);
let hash = self.pool().add_transaction(TransactionOrigin::External, tx).await.map_err(
|e| OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::PoolError(e.into())),
)?;
Expand Down

0 comments on commit fab686a

Please sign in to comment.