mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
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:
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user