mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: Simplify traits
This commit is contained in:
@ -22,7 +22,8 @@ macro_rules! _count {
|
|||||||
($($arg:tt)*) => { _count!(@count $($arg)*) };
|
($($arg:tt)*) => { _count!(@count $($arg)*) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Pops n values from the stack and returns the top value. Fails the instruction if n values can't be popped.
|
/// Pops n values from the stack and returns the top value. Fails the instruction if n values can't
|
||||||
|
/// be popped.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[collapse_debuginfo(yes)]
|
#[collapse_debuginfo(yes)]
|
||||||
macro_rules! popn_top {
|
macro_rules! popn_top {
|
||||||
@ -62,7 +63,8 @@ pub fn blockhash_returning_placeholder<WIRE: InterpreterTypes, H: Host + ?Sized>
|
|||||||
}
|
}
|
||||||
|
|
||||||
*number = if diff <= BLOCK_HASH_HISTORY {
|
*number = if diff <= BLOCK_HASH_HISTORY {
|
||||||
// NOTE: This is HL-specific modifcation that returns the placeholder hash before specific block.
|
// NOTE: This is HL-specific modifcation that returns the placeholder hash before specific
|
||||||
|
// block.
|
||||||
let hash = keccak256(as_u64_saturated!(requested_number).to_string().as_bytes());
|
let hash = keccak256(as_u64_saturated!(requested_number).to_string().as_bytes());
|
||||||
U256::from_be_bytes(hash.0)
|
U256::from_be_bytes(hash.0)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -4,8 +4,6 @@ use std::str::FromStr;
|
|||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Default)]
|
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Default)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
#[allow(clippy::upper_case_acronyms)]
|
|
||||||
pub enum HlSpecId {
|
pub enum HlSpecId {
|
||||||
#[default]
|
#[default]
|
||||||
V1, // V1
|
V1, // V1
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use revm::{
|
|||||||
#[auto_impl(&, &mut, Box, Arc)]
|
#[auto_impl(&, &mut, Box, Arc)]
|
||||||
pub trait HlTxTr: Transaction {}
|
pub trait HlTxTr: Transaction {}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct HlTxEnv<T: Transaction> {
|
pub struct HlTxEnv<T: Transaction> {
|
||||||
pub base: T,
|
pub base: T,
|
||||||
@ -25,12 +25,6 @@ impl<T: Transaction> HlTxEnv<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HlTxEnv<TxEnv> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self { base: TxEnv::default() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: Transaction> Transaction for HlTxEnv<T> {
|
impl<T: Transaction> Transaction for HlTxEnv<T> {
|
||||||
type AccessListItem<'a>
|
type AccessListItem<'a>
|
||||||
= T::AccessListItem<'a>
|
= T::AccessListItem<'a>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use alloy_consensus::TxReceipt;
|
use alloy_consensus::TxReceipt;
|
||||||
use alloy_network::ReceiptResponse;
|
|
||||||
use alloy_eips::{BlockId, BlockNumberOrTag};
|
use alloy_eips::{BlockId, BlockNumberOrTag};
|
||||||
use alloy_json_rpc::RpcObject;
|
use alloy_json_rpc::RpcObject;
|
||||||
|
use alloy_network::ReceiptResponse;
|
||||||
use alloy_primitives::{B256, U256};
|
use alloy_primitives::{B256, U256};
|
||||||
use alloy_rpc_types::{
|
use alloy_rpc_types::{
|
||||||
pubsub::{Params, SubscriptionKind},
|
pubsub::{Params, SubscriptionKind},
|
||||||
@ -379,8 +379,8 @@ where
|
|||||||
let res =
|
let res =
|
||||||
self.eth_api.block_transaction_count_by_hash(hash).instrument(engine_span!()).await?;
|
self.eth_api.block_transaction_count_by_hash(hash).instrument(engine_span!()).await?;
|
||||||
Ok(res.map(|count| {
|
Ok(res.map(|count| {
|
||||||
count
|
count -
|
||||||
- U256::from(system_tx_count_for_block(&*self.eth_api, BlockId::Hash(hash.into())))
|
U256::from(system_tx_count_for_block(&*self.eth_api, BlockId::Hash(hash.into())))
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,12 +408,7 @@ where
|
|||||||
trace!(target: "rpc::eth", ?block_id, "Serving eth_getBlockReceipts");
|
trace!(target: "rpc::eth", ?block_id, "Serving eth_getBlockReceipts");
|
||||||
let res = self.eth_api.block_receipts(block_id).instrument(engine_span!()).await?;
|
let res = self.eth_api.block_receipts(block_id).instrument(engine_span!()).await?;
|
||||||
Ok(res.map(|receipts| {
|
Ok(res.map(|receipts| {
|
||||||
receipts
|
receipts.into_iter().filter(|receipt| receipt.cumulative_gas_used() > 0).collect()
|
||||||
.into_iter()
|
|
||||||
.filter(|receipt| {
|
|
||||||
receipt.cumulative_gas_used() > 0
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use reth::{
|
|||||||
api::FullNodeTypes,
|
api::FullNodeTypes,
|
||||||
builder::{components::ExecutorBuilder, BuilderContext},
|
builder::{components::ExecutorBuilder, BuilderContext},
|
||||||
};
|
};
|
||||||
use reth_evm::{Evm, EvmEnv};
|
use reth_evm::{Database, Evm, EvmEnv};
|
||||||
use revm::{
|
use revm::{
|
||||||
context::{
|
context::{
|
||||||
result::{EVMError, ExecutionResult, HaltReason, Output, ResultAndState, SuccessReason},
|
result::{EVMError, ExecutionResult, HaltReason, Output, ResultAndState, SuccessReason},
|
||||||
@ -21,7 +21,7 @@ use revm::{
|
|||||||
handler::{instructions::EthInstructions, EthPrecompiles, PrecompileProvider},
|
handler::{instructions::EthInstructions, EthPrecompiles, PrecompileProvider},
|
||||||
interpreter::{interpreter::EthInterpreter, InterpreterResult},
|
interpreter::{interpreter::EthInterpreter, InterpreterResult},
|
||||||
state::EvmState,
|
state::EvmState,
|
||||||
Context, Database, ExecuteEvm, InspectEvm, Inspector,
|
Context, ExecuteEvm, InspectEvm, Inspector,
|
||||||
};
|
};
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
@ -75,7 +75,6 @@ where
|
|||||||
DB: Database,
|
DB: Database,
|
||||||
I: Inspector<HlContext<DB>>,
|
I: Inspector<HlContext<DB>>,
|
||||||
P: PrecompileProvider<HlContext<DB>, Output = InterpreterResult>,
|
P: PrecompileProvider<HlContext<DB>, Output = InterpreterResult>,
|
||||||
<DB as revm::Database>::Error: std::marker::Send + std::marker::Sync + 'static,
|
|
||||||
{
|
{
|
||||||
type DB = DB;
|
type DB = DB;
|
||||||
type Tx = HlTxEnv<TxEnv>;
|
type Tx = HlTxEnv<TxEnv>;
|
||||||
@ -127,10 +126,6 @@ where
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn db_mut(&mut self) -> &mut Self::DB {
|
|
||||||
&mut self.journaled_state.database
|
|
||||||
}
|
|
||||||
|
|
||||||
fn finish(self) -> (Self::DB, EvmEnv<Self::Spec>) {
|
fn finish(self) -> (Self::DB, EvmEnv<Self::Spec>) {
|
||||||
let Context { block: block_env, cfg: cfg_env, journaled_state, .. } = self.inner.0.ctx;
|
let Context { block: block_env, cfg: cfg_env, journaled_state, .. } = self.inner.0.ctx;
|
||||||
|
|
||||||
@ -141,22 +136,6 @@ where
|
|||||||
self.inspect = enabled;
|
self.inspect = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn precompiles_mut(&mut self) -> &mut Self::Precompiles {
|
|
||||||
&mut self.inner.0.precompiles
|
|
||||||
}
|
|
||||||
|
|
||||||
fn inspector_mut(&mut self) -> &mut Self::Inspector {
|
|
||||||
&mut self.inner.0.inspector
|
|
||||||
}
|
|
||||||
|
|
||||||
fn precompiles(&self) -> &Self::Precompiles {
|
|
||||||
&self.inner.0.precompiles
|
|
||||||
}
|
|
||||||
|
|
||||||
fn inspector(&self) -> &Self::Inspector {
|
|
||||||
&self.inner.0.inspector
|
|
||||||
}
|
|
||||||
|
|
||||||
fn components(&self) -> (&Self::DB, &Self::Inspector, &Self::Precompiles) {
|
fn components(&self) -> (&Self::DB, &Self::Inspector, &Self::Precompiles) {
|
||||||
(
|
(
|
||||||
&self.inner.0.ctx.journaled_state.database,
|
&self.inner.0.ctx.journaled_state.database,
|
||||||
|
|||||||
301
src/node/pool.rs
301
src/node/pool.rs
@ -10,44 +10,30 @@ use crate::node::{primitives::TransactionSigned, HlNode};
|
|||||||
use alloy_consensus::{
|
use alloy_consensus::{
|
||||||
error::ValueError, EthereumTxEnvelope, Transaction as TransactionTrait, TxEip4844,
|
error::ValueError, EthereumTxEnvelope, Transaction as TransactionTrait, TxEip4844,
|
||||||
};
|
};
|
||||||
use alloy_eips::{
|
use alloy_eips::{eip7702::SignedAuthorization, Typed2718};
|
||||||
eip4844::BlobAndProofV2, eip7594::BlobTransactionSidecarVariant, eip7702::SignedAuthorization,
|
|
||||||
Typed2718,
|
|
||||||
};
|
|
||||||
use alloy_primitives::{Address, Bytes, ChainId, TxHash, TxKind, B256, U256};
|
use alloy_primitives::{Address, Bytes, ChainId, TxHash, TxKind, B256, U256};
|
||||||
use alloy_rpc_types::AccessList;
|
use alloy_rpc_types::AccessList;
|
||||||
use alloy_rpc_types_engine::BlobAndProofV1;
|
|
||||||
use reth::{
|
use reth::{
|
||||||
api::FullNodeTypes,
|
api::FullNodeTypes, builder::components::PoolBuilder, transaction_pool::PoolTransaction,
|
||||||
builder::components::PoolBuilder,
|
|
||||||
transaction_pool::{PoolResult, PoolSize, PoolTransaction, TransactionOrigin, TransactionPool},
|
|
||||||
};
|
};
|
||||||
use reth_eth_wire::HandleMempoolData;
|
|
||||||
use reth_ethereum_primitives::PooledTransactionVariant;
|
use reth_ethereum_primitives::PooledTransactionVariant;
|
||||||
use reth_primitives::Recovered;
|
use reth_primitives::Recovered;
|
||||||
use reth_primitives_traits::InMemorySize;
|
use reth_primitives_traits::InMemorySize;
|
||||||
use reth_transaction_pool::{
|
use reth_transaction_pool::{noop::NoopTransactionPool, EthPoolTransaction};
|
||||||
error::InvalidPoolTransactionError, pool::AddedTransactionState, AddedTransactionOutcome,
|
use std::sync::Arc;
|
||||||
AllPoolTransactions, AllTransactionsEvents, BestTransactions, BestTransactionsAttributes,
|
|
||||||
BlobStoreError, BlockInfo, EthPoolTransaction, GetPooledTransactionLimit, NewBlobSidecar,
|
|
||||||
NewTransactionEvent, PropagatedTransactions, TransactionEvents, TransactionListenerKind,
|
|
||||||
ValidPoolTransaction,
|
|
||||||
};
|
|
||||||
use std::{collections::HashSet, sync::Arc};
|
|
||||||
use tokio::sync::mpsc::{self, Receiver};
|
|
||||||
|
|
||||||
pub struct HlPoolBuilder;
|
pub struct HlPoolBuilder;
|
||||||
impl<Node> PoolBuilder<Node> for HlPoolBuilder
|
impl<Node> PoolBuilder<Node> for HlPoolBuilder
|
||||||
where
|
where
|
||||||
Node: FullNodeTypes<Types = HlNode>,
|
Node: FullNodeTypes<Types = HlNode>,
|
||||||
{
|
{
|
||||||
type Pool = HlTransactionPool;
|
type Pool = NoopTransactionPool<HlPooledTransaction>;
|
||||||
|
|
||||||
async fn build_pool(
|
async fn build_pool(
|
||||||
self,
|
self,
|
||||||
_ctx: &reth::builder::BuilderContext<Node>,
|
_ctx: &reth::builder::BuilderContext<Node>,
|
||||||
) -> eyre::Result<Self::Pool> {
|
) -> eyre::Result<Self::Pool> {
|
||||||
Ok(HlTransactionPool)
|
Ok(NoopTransactionPool::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,16 +111,6 @@ impl PoolTransaction for HlPooledTransaction {
|
|||||||
type Consensus = TransactionSigned;
|
type Consensus = TransactionSigned;
|
||||||
type Pooled = PooledTransactionVariant;
|
type Pooled = PooledTransactionVariant;
|
||||||
|
|
||||||
fn try_from_consensus(
|
|
||||||
_tx: Recovered<Self::Consensus>,
|
|
||||||
) -> Result<Self, Self::TryFromConsensusError> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn clone_into_consensus(&self) -> Recovered<Self::Consensus> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn into_consensus(self) -> Recovered<Self::Consensus> {
|
fn into_consensus(self) -> Recovered<Self::Consensus> {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
@ -162,13 +138,6 @@ impl PoolTransaction for HlPooledTransaction {
|
|||||||
fn encoded_length(&self) -> usize {
|
fn encoded_length(&self) -> usize {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ensure_max_init_code_size(
|
|
||||||
&self,
|
|
||||||
_max_init_code_size: usize,
|
|
||||||
) -> Result<(), InvalidPoolTransactionError> {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EthPoolTransaction for HlPooledTransaction {
|
impl EthPoolTransaction for HlPooledTransaction {
|
||||||
@ -198,261 +167,3 @@ impl EthPoolTransaction for HlPooledTransaction {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
||||||
pub struct HlTransactionPool;
|
|
||||||
impl TransactionPool for HlTransactionPool {
|
|
||||||
type Transaction = HlPooledTransaction;
|
|
||||||
|
|
||||||
fn pool_size(&self) -> PoolSize {
|
|
||||||
PoolSize::default()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn block_info(&self) -> BlockInfo {
|
|
||||||
BlockInfo::default()
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn add_transaction_and_subscribe(
|
|
||||||
&self,
|
|
||||||
_origin: TransactionOrigin,
|
|
||||||
_transaction: Self::Transaction,
|
|
||||||
) -> PoolResult<TransactionEvents> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn add_transaction(
|
|
||||||
&self,
|
|
||||||
_origin: TransactionOrigin,
|
|
||||||
_transaction: Self::Transaction,
|
|
||||||
) -> PoolResult<AddedTransactionOutcome> {
|
|
||||||
Ok(AddedTransactionOutcome {
|
|
||||||
hash: TxHash::default(),
|
|
||||||
state: AddedTransactionState::Pending,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn add_transactions(
|
|
||||||
&self,
|
|
||||||
_origin: TransactionOrigin,
|
|
||||||
_transactions: Vec<Self::Transaction>,
|
|
||||||
) -> Vec<PoolResult<AddedTransactionOutcome>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn transaction_event_listener(&self, _tx_hash: TxHash) -> Option<TransactionEvents> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn all_transactions_event_listener(&self) -> AllTransactionsEvents<Self::Transaction> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn pending_transactions_listener_for(
|
|
||||||
&self,
|
|
||||||
_kind: TransactionListenerKind,
|
|
||||||
) -> Receiver<TxHash> {
|
|
||||||
mpsc::channel(1).1
|
|
||||||
}
|
|
||||||
|
|
||||||
fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar> {
|
|
||||||
mpsc::channel(1).1
|
|
||||||
}
|
|
||||||
|
|
||||||
fn new_transactions_listener_for(
|
|
||||||
&self,
|
|
||||||
_kind: TransactionListenerKind,
|
|
||||||
) -> Receiver<NewTransactionEvent<Self::Transaction>> {
|
|
||||||
mpsc::channel(1).1
|
|
||||||
}
|
|
||||||
fn pooled_transaction_hashes(&self) -> Vec<TxHash> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn pooled_transaction_hashes_max(&self, _max: usize) -> Vec<TxHash> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn pooled_transactions(&self) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn pooled_transactions_max(
|
|
||||||
&self,
|
|
||||||
_max: usize,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn get_pooled_transaction_elements(
|
|
||||||
&self,
|
|
||||||
_tx_hashes: Vec<TxHash>,
|
|
||||||
_limit: GetPooledTransactionLimit,
|
|
||||||
) -> Vec<<Self::Transaction as PoolTransaction>::Pooled> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn get_pooled_transaction_element(
|
|
||||||
&self,
|
|
||||||
_tx_hash: TxHash,
|
|
||||||
) -> Option<Recovered<<Self::Transaction as PoolTransaction>::Pooled>> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
fn best_transactions(
|
|
||||||
&self,
|
|
||||||
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>> {
|
|
||||||
Box::new(std::iter::empty())
|
|
||||||
}
|
|
||||||
fn best_transactions_with_attributes(
|
|
||||||
&self,
|
|
||||||
_best_transactions_attributes: BestTransactionsAttributes,
|
|
||||||
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>> {
|
|
||||||
Box::new(std::iter::empty())
|
|
||||||
}
|
|
||||||
fn pending_transactions(&self) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn pending_transactions_max(
|
|
||||||
&self,
|
|
||||||
_max: usize,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn queued_transactions(&self) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn all_transactions(&self) -> AllPoolTransactions<Self::Transaction> {
|
|
||||||
AllPoolTransactions::default()
|
|
||||||
}
|
|
||||||
fn remove_transactions(
|
|
||||||
&self,
|
|
||||||
_hashes: Vec<TxHash>,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn remove_transactions_and_descendants(
|
|
||||||
&self,
|
|
||||||
_hashes: Vec<TxHash>,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn remove_transactions_by_sender(
|
|
||||||
&self,
|
|
||||||
_sender: Address,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn retain_unknown<A>(&self, _announcement: &mut A)
|
|
||||||
where
|
|
||||||
A: HandleMempoolData,
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
fn get(&self, _tx_hash: &TxHash) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
fn get_all(&self, _txs: Vec<TxHash>) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn on_propagated(&self, _txs: PropagatedTransactions) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
fn get_transactions_by_sender(
|
|
||||||
&self,
|
|
||||||
_sender: Address,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn get_pending_transactions_with_predicate(
|
|
||||||
&self,
|
|
||||||
_predicate: impl FnMut(&ValidPoolTransaction<Self::Transaction>) -> bool,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn get_pending_transactions_by_sender(
|
|
||||||
&self,
|
|
||||||
_sender: Address,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
fn get_queued_transactions_by_sender(
|
|
||||||
&self,
|
|
||||||
_sender: Address,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
fn get_highest_transaction_by_sender(
|
|
||||||
&self,
|
|
||||||
_sender: Address,
|
|
||||||
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
fn get_highest_consecutive_transaction_by_sender(
|
|
||||||
&self,
|
|
||||||
_sender: Address,
|
|
||||||
_on_chain_nonce: u64,
|
|
||||||
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
fn get_transaction_by_sender_and_nonce(
|
|
||||||
&self,
|
|
||||||
_sender: Address,
|
|
||||||
_nonce: u64,
|
|
||||||
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
fn get_transactions_by_origin(
|
|
||||||
&self,
|
|
||||||
_origin: TransactionOrigin,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
fn get_pending_transactions_by_origin(
|
|
||||||
&self,
|
|
||||||
_origin: TransactionOrigin,
|
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
fn unique_senders(&self) -> HashSet<Address> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
fn get_blob(
|
|
||||||
&self,
|
|
||||||
_tx_hash: TxHash,
|
|
||||||
) -> Result<Option<Arc<BlobTransactionSidecarVariant>>, BlobStoreError> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
fn get_all_blobs(
|
|
||||||
&self,
|
|
||||||
_tx_hashes: Vec<TxHash>,
|
|
||||||
) -> Result<Vec<(TxHash, Arc<BlobTransactionSidecarVariant>)>, BlobStoreError> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
fn get_all_blobs_exact(
|
|
||||||
&self,
|
|
||||||
_tx_hashes: Vec<TxHash>,
|
|
||||||
) -> Result<Vec<Arc<BlobTransactionSidecarVariant>>, BlobStoreError> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
fn get_blobs_for_versioned_hashes_v1(
|
|
||||||
&self,
|
|
||||||
_versioned_hashes: &[B256],
|
|
||||||
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
fn get_blobs_for_versioned_hashes_v2(
|
|
||||||
&self,
|
|
||||||
_versioned_hashes: &[B256],
|
|
||||||
) -> Result<Option<Vec<BlobAndProofV2>>, BlobStoreError> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn add_transactions_with_origins(
|
|
||||||
&self,
|
|
||||||
_transactions: Vec<(TransactionOrigin, Self::Transaction)>,
|
|
||||||
) -> Vec<PoolResult<AddedTransactionOutcome>> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn pending_and_queued_txn_count(&self) -> (usize, usize) {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn all_transaction_hashes(&self) -> Vec<TxHash> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
|
|
||||||
use crate::node::rpc::HlEthApi;
|
use crate::node::rpc::HlEthApi;
|
||||||
use reth::{
|
use reth::rpc::server_types::eth::{
|
||||||
rpc::server_types::eth::{
|
|
||||||
builder::config::PendingBlockKind, error::FromEvmError, EthApiError, PendingBlock,
|
builder::config::PendingBlockKind, error::FromEvmError, EthApiError, PendingBlock,
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use reth_rpc_eth_api::{
|
use reth_rpc_eth_api::{
|
||||||
helpers::{
|
helpers::{
|
||||||
pending_block::PendingEnvBuilder, EthBlocks, LoadBlock, LoadPendingBlock, LoadReceipt,
|
pending_block::PendingEnvBuilder, EthBlocks, LoadBlock, LoadPendingBlock, LoadReceipt,
|
||||||
}, RpcConvert, RpcNodeCore
|
},
|
||||||
|
RpcConvert, RpcNodeCore,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<N, Rpc> EthBlocks for HlEthApi<N, Rpc>
|
impl<N, Rpc> EthBlocks for HlEthApi<N, Rpc>
|
||||||
@ -17,7 +15,6 @@ where
|
|||||||
EthApiError: FromEvmError<N::Evm>,
|
EthApiError: FromEvmError<N::Evm>,
|
||||||
Rpc: RpcConvert<Primitives = N::Primitives, Error = EthApiError>,
|
Rpc: RpcConvert<Primitives = N::Primitives, Error = EthApiError>,
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N, Rpc> LoadBlock for HlEthApi<N, Rpc>
|
impl<N, Rpc> LoadBlock for HlEthApi<N, Rpc>
|
||||||
|
|||||||
@ -6,12 +6,11 @@ use reth::{
|
|||||||
rpc::{EthApiBuilder, EthApiCtx},
|
rpc::{EthApiBuilder, EthApiCtx},
|
||||||
FullNodeComponents,
|
FullNodeComponents,
|
||||||
},
|
},
|
||||||
primitives::EthereumHardforks,
|
|
||||||
rpc::{
|
rpc::{
|
||||||
eth::{core::EthApiInner, DevSigner, FullEthApiServer},
|
eth::{core::EthApiInner, DevSigner, FullEthApiServer},
|
||||||
server_types::eth::{
|
server_types::eth::{
|
||||||
receipt::EthReceiptConverter,
|
receipt::EthReceiptConverter, EthApiError, EthStateCache, FeeHistoryCache,
|
||||||
EthApiError, EthStateCache, FeeHistoryCache, GasPriceOracle,
|
GasPriceOracle,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tasks::{
|
tasks::{
|
||||||
@ -20,7 +19,6 @@ use reth::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
use reth_evm::ConfigureEvm;
|
use reth_evm::ConfigureEvm;
|
||||||
use reth_primitives::{NodePrimitives, Receipt};
|
|
||||||
use reth_provider::{ChainSpecProvider, ProviderHeader, ProviderTx};
|
use reth_provider::{ChainSpecProvider, ProviderHeader, ProviderTx};
|
||||||
use reth_rpc::RpcTypes;
|
use reth_rpc::RpcTypes;
|
||||||
use reth_rpc_eth_api::{
|
use reth_rpc_eth_api::{
|
||||||
@ -41,7 +39,6 @@ pub mod engine_api;
|
|||||||
mod transaction;
|
mod transaction;
|
||||||
|
|
||||||
/// Container type `HlEthApi`
|
/// Container type `HlEthApi`
|
||||||
#[allow(missing_debug_implementations)]
|
|
||||||
pub(crate) struct HlEthApiInner<N: RpcNodeCore, Rpc: RpcConvert> {
|
pub(crate) struct HlEthApiInner<N: RpcNodeCore, Rpc: RpcConvert> {
|
||||||
/// Gateway to node's core components.
|
/// Gateway to node's core components.
|
||||||
pub(crate) eth_api: EthApiInner<N, Rpc>,
|
pub(crate) eth_api: EthApiInner<N, Rpc>,
|
||||||
@ -242,18 +239,10 @@ impl<NetworkT> Default for HlEthApiBuilder<NetworkT> {
|
|||||||
|
|
||||||
impl<N, NetworkT> EthApiBuilder<N> for HlEthApiBuilder<NetworkT>
|
impl<N, NetworkT> EthApiBuilder<N> for HlEthApiBuilder<NetworkT>
|
||||||
where
|
where
|
||||||
N: FullNodeComponents<
|
N: FullNodeComponents<Types: NodeTypes<ChainSpec = HlChainSpec>>
|
||||||
Types: NodeTypes<ChainSpec: EthereumHardforks>,
|
+ RpcNodeCore<
|
||||||
Evm: ConfigureEvm<
|
Primitives = PrimitivesTy<N::Types>,
|
||||||
NextBlockEnvCtx: BuildPendingEnv<HeaderTy<N::Types>>,
|
Evm: ConfigureEvm<NextBlockEnvCtx: BuildPendingEnv<HeaderTy<N::Types>>>,
|
||||||
Primitives: NodePrimitives,
|
|
||||||
>,
|
|
||||||
> + RpcNodeCore<Primitives = PrimitivesTy<N::Types>>
|
|
||||||
+ FullNodeTypes<
|
|
||||||
Types: NodeTypes<
|
|
||||||
Primitives: NodePrimitives<Receipt = Receipt>,
|
|
||||||
ChainSpec = HlChainSpec,
|
|
||||||
>,
|
|
||||||
>,
|
>,
|
||||||
NetworkT: RpcTypes,
|
NetworkT: RpcTypes,
|
||||||
HlRpcConvert<N, NetworkT>: RpcConvert<Network = NetworkT, Primitives = PrimitivesTy<N::Types>>,
|
HlRpcConvert<N, NetworkT>: RpcConvert<Network = NetworkT, Primitives = PrimitivesTy<N::Types>>,
|
||||||
@ -261,7 +250,6 @@ where
|
|||||||
Provider = <N as FullNodeTypes>::Provider,
|
Provider = <N as FullNodeTypes>::Provider,
|
||||||
Pool = <N as FullNodeComponents>::Pool,
|
Pool = <N as FullNodeComponents>::Pool,
|
||||||
> + AddDevSigners,
|
> + AddDevSigners,
|
||||||
<<N as RpcNodeCore>::Evm as ConfigureEvm>::NextBlockEnvCtx: BuildPendingEnv<HeaderTy<N::Types>>,
|
|
||||||
{
|
{
|
||||||
type EthApi = HlEthApi<N, HlRpcConvert<N, NetworkT>>;
|
type EthApi = HlEthApi<N, HlRpcConvert<N, NetworkT>>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user