Decode raw conditional correctly (#14397)

Co-authored-by: VeerChaurasia <veerchaurasia2005@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Elijah Hampton
2025-02-11 10:31:51 +00:00
committed by GitHub
parent c9ea4231ff
commit 2ba54bf1c1
2 changed files with 9 additions and 7 deletions

View File

@ -34,7 +34,8 @@ reth-optimism-chainspec.workspace = true
reth-optimism-consensus.workspace = true reth-optimism-consensus.workspace = true
reth-optimism-evm.workspace = true reth-optimism-evm.workspace = true
reth-optimism-payload-builder.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 reth-optimism-forks.workspace = true
# ethereum # ethereum

View File

@ -5,11 +5,10 @@ use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{Bytes, B256}; use alloy_primitives::{Bytes, B256};
use alloy_rpc_types_eth::erc4337::TransactionConditional; use alloy_rpc_types_eth::erc4337::TransactionConditional;
use jsonrpsee_core::RpcResult; use jsonrpsee_core::RpcResult;
use op_alloy_network::TransactionResponse;
use op_alloy_rpc_types::Transaction;
use reth_provider::{BlockReaderIdExt, StateProviderFactory}; use reth_provider::{BlockReaderIdExt, StateProviderFactory};
use reth_rpc_eth_api::L2EthApiExtServer; 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; use std::sync::Arc;
/// Maximum execution const for conditional transactions. /// Maximum execution const for conditional transactions.
@ -50,7 +49,7 @@ impl<N> L2EthApiExtServer for OpEthApiExt<N>
where where
N: OpNodeCore + 'static, N: OpNodeCore + 'static,
N::Provider: BlockReaderIdExt + StateProviderFactory, N::Provider: BlockReaderIdExt + StateProviderFactory,
N::Pool: TransactionPool<Transaction = Transaction>, N::Pool: TransactionPool,
{ {
async fn send_raw_transaction_conditional( async fn send_raw_transaction_conditional(
&self, &self,
@ -63,10 +62,12 @@ where
return Err(TxConditionalErr::ConditionalCostExceeded.into()); 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) OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::FailedToDecodeSignedTransaction)
})?; })?;
let tx = <N::Pool as TransactionPool>::Transaction::from_pooled(recovered_tx);
// get current header // get current header
let header_not_found = || { let header_not_found = || {
OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::HeaderNotFound( OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::HeaderNotFound(
@ -94,7 +95,7 @@ where
.forward_raw_transaction_conditional(bytes.as_ref(), condition) .forward_raw_transaction_conditional(bytes.as_ref(), condition)
.await .await
.map_err(OpEthApiError::Sequencer)?; .map_err(OpEthApiError::Sequencer)?;
Ok(tx.tx_hash()) Ok(*tx.hash())
} else { } else {
// otherwise, add to pool // otherwise, add to pool
// TODO: include conditional // TODO: include conditional