Repository: paradigmxyz/reth (language: rust)

Issue:
Decode raw conditional correctly
This currently decodes as json which isn't right

https://github.com/paradigmxyz/reth/blob/731b771fa20b6663dbb966fd0984c608f510946b/crates/optimism/rpc/src/eth/ext.rs#L66-L68

we need to convert this via rlp and then convert into the pooled tx:

https://github.com/paradigmxyz/reth/blob/731b771fa20b6663dbb966fd0984c608f510946b/crates/rpc/rpc/src/eth/helpers/transaction.rs#L28-L33


Discussion / hints:
hey @mattsse can i take this one?

yep, although this is somewhat urgend, so if you have bandwidth please open a draft shortly, ty

Fix patch:
diff --git a/crates/optimism/rpc/Cargo.toml b/crates/optimism/rpc/Cargo.toml
index ef063b1763a0..0e6c29545d73 100644
--- a/crates/optimism/rpc/Cargo.toml
+++ b/crates/optimism/rpc/Cargo.toml
@@ -34,7 +34,8 @@ reth-optimism-chainspec.workspace = true
 reth-optimism-consensus.workspace = true
 reth-optimism-evm.workspace = true
 reth-optimism-payload-builder.workspace = true
-reth-optimism-primitives.workspace = true
+# TODO remove node-builder import
+reth-optimism-primitives = { workspace = true, features = ["reth-codec", "serde-bincode-compat"] }
 reth-optimism-forks.workspace = true
 
 # ethereum
diff --git a/crates/optimism/rpc/src/eth/ext.rs b/crates/optimism/rpc/src/eth/ext.rs
index e5c371791d40..0be0073d5a64 100644
--- a/crates/optimism/rpc/src/eth/ext.rs
+++ b/crates/optimism/rpc/src/eth/ext.rs
@@ -5,11 +5,10 @@ use alloy_eips::BlockNumberOrTag;
 use alloy_primitives::{Bytes, B256};
 use alloy_rpc_types_eth::erc4337::TransactionConditional;
 use jsonrpsee_core::RpcResult;
-use op_alloy_network::TransactionResponse;
-use op_alloy_rpc_types::Transaction;
 use reth_provider::{BlockReaderIdExt, StateProviderFactory};
 use reth_rpc_eth_api::L2EthApiExtServer;
-use reth_transaction_pool::{TransactionOrigin, TransactionPool};
+use reth_rpc_eth_types::utils::recover_raw_transaction;
+use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool};
 use std::sync::Arc;
 
 /// Maximum execution const for conditional transactions.
@@ -50,7 +49,7 @@ impl<N> L2EthApiExtServer for OpEthApiExt<N>
 where
     N: OpNodeCore + 'static,
     N::Provider: BlockReaderIdExt + StateProviderFactory,
-    N::Pool: TransactionPool<Transaction = Transaction>,
+    N::Pool: TransactionPool,
 {
     async fn send_raw_transaction_conditional(
         &self,
@@ -63,10 +62,12 @@ where
             return Err(TxConditionalErr::ConditionalCostExceeded.into());
         }
 
-        let tx: Transaction = serde_json::from_slice(&bytes).map_err(|_| {
+        let recovered_tx = recover_raw_transaction(&bytes).map_err(|_| {
             OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::FailedToDecodeSignedTransaction)
         })?;
 
+        let tx = <N::Pool as TransactionPool>::Transaction::from_pooled(recovered_tx);
+
         // get current header
         let header_not_found = || {
             OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::HeaderNotFound(
@@ -94,7 +95,7 @@ where
                 .forward_raw_transaction_conditional(bytes.as_ref(), condition)
                 .await
                 .map_err(OpEthApiError::Sequencer)?;
-            Ok(tx.tx_hash())
+            Ok(*tx.hash())
         } else {
             // otherwise, add to pool
             // TODO: include conditional


Test patch: