mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: support blobs in eth_sendRawTransaction (#4495)
This commit is contained in:
@ -14,7 +14,7 @@ use crate::{
|
||||
use async_trait::async_trait;
|
||||
use reth_network_api::NetworkInfo;
|
||||
use reth_primitives::{
|
||||
Address, BlockId, BlockNumberOrTag, Bytes, FromRecoveredTransaction, Header,
|
||||
Address, BlockId, BlockNumberOrTag, Bytes, FromRecoveredPooledTransaction, Header,
|
||||
IntoRecoveredTransaction, Receipt, SealedBlock,
|
||||
TransactionKind::{Call, Create},
|
||||
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, H256, U128, U256, U64,
|
||||
@ -504,7 +504,7 @@ where
|
||||
let recovered =
|
||||
signed_tx.into_ecrecovered().ok_or(EthApiError::InvalidTransactionSignature)?;
|
||||
|
||||
let pool_transaction = <Pool::Transaction>::from_recovered_transaction(recovered);
|
||||
let pool_transaction = <Pool::Transaction>::from_recovered_transaction(recovered.into());
|
||||
|
||||
// submit the transaction to the pool with a `Local` origin
|
||||
let hash = self.pool().add_transaction(TransactionOrigin::Local, pool_transaction).await?;
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
//! Commonly used code snippets
|
||||
|
||||
use crate::eth::error::{EthApiError, EthResult};
|
||||
use reth_primitives::{Bytes, TransactionSigned, TransactionSignedEcRecovered};
|
||||
use reth_primitives::{Bytes, PooledTransactionsElement, PooledTransactionsElementEcRecovered};
|
||||
|
||||
/// Recovers a [TransactionSignedEcRecovered] from an enveloped encoded byte stream.
|
||||
/// Recovers a [PooledTransactionsElementEcRecovered] from an enveloped encoded byte stream.
|
||||
///
|
||||
/// See [TransactionSigned::decode_enveloped]
|
||||
pub(crate) fn recover_raw_transaction(data: Bytes) -> EthResult<TransactionSignedEcRecovered> {
|
||||
/// See [PooledTransactionsElement::decode_enveloped]
|
||||
pub(crate) fn recover_raw_transaction(
|
||||
data: Bytes,
|
||||
) -> EthResult<PooledTransactionsElementEcRecovered> {
|
||||
if data.is_empty() {
|
||||
return Err(EthApiError::EmptyRawTransactionData)
|
||||
}
|
||||
|
||||
let transaction = TransactionSigned::decode_enveloped(data)
|
||||
let transaction = PooledTransactionsElement::decode_enveloped(data)
|
||||
.map_err(|_| EthApiError::FailedToDecodeSignedTransaction)?;
|
||||
|
||||
transaction.into_ecrecovered().ok_or(EthApiError::InvalidTransactionSignature)
|
||||
transaction.try_into_ecrecovered().or(Err(EthApiError::InvalidTransactionSignature))
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ where
|
||||
.eth_api
|
||||
.evm_env_at(block_id.unwrap_or(BlockId::Number(BlockNumberOrTag::Latest)))
|
||||
.await?;
|
||||
let tx = tx_env_with_recovered(&tx);
|
||||
let tx = tx_env_with_recovered(&tx.into_ecrecovered_transaction());
|
||||
let env = Env { cfg, block, tx };
|
||||
|
||||
let config = tracing_config(&trace_types);
|
||||
|
||||
Reference in New Issue
Block a user